81trust / 100

Analytics Weighted Score

by Market Intelligence API in Markets & finance

x402 APIPassing, checked 3 h ago

Use to combine factor scores into one composite ($0.01), e.g. momentum, fundamentals and risk: send factors {name, score, weight}; get the 0-100 score with each factor's normalised weight and contribution. Weights need not sum to 1. Transparent and reproducible, no data fetched.

POST https://api.marketintelligenceapi.com/api/v1/analytics/weighted-score

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
58 ms typical, 58 ms slowest 5%
Last check
3 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://api.marketintelligenceapi.com/api/v1/analytics/weighted-score" \
  -H "content-type: application/json" \
  -d '{"factors":[{"name":"momentum","score":82,"weight":0.3},{"name":"fundamentals","score":74,"weight":0.4},{"name":"risk","score":63,"weight":0.3}]}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.marketintelligenceapi.com%2Fapi%2Fv1%2Fanalytics%2Fweighted-score
const res = await pay("https://api.marketintelligenceapi.com/api/v1/analytics/weighted-score", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"factors":[{"name":"momentum","score":82,"weight":0.3},{"name":"fundamentals","score":74,"weight":0.4},{"name":"risk","score":63,"weight":0.3}]}),
});
console.log(await res.json());

Example input

{
  "factors": [
    {
      "name": "momentum",
      "score": 82,
      "weight": 0.3
    },
    {
      "name": "fundamentals",
      "score": 74,
      "weight": 0.4
    },
    {
      "name": "risk",
      "score": 63,
      "weight": 0.3
    }
  ]
}

Example output

{
  "components": [
    {
      "contribution": 24.6,
      "name": "momentum",
      "normalizedWeight": 0.3,
      "score": 82,
      "weight": 0.3
    },
    {
      "contribution": 29.6,
      "name": "fundamentals",
      "normalizedWeight": 0.4,
      "score": 74,
      "weight": 0.4
    },
    {
      "contribution": 18.9,
      "name": "risk",
      "normalizedWeight": 0.3,
      "score": 63,
      "weight": 0.3
    }
  ],
  "factors": 3,
  "method": "WEIGHTED_MEAN",
  "operation": "weighted-score",
  "result": 73.1,
  "score": 73.1,
  "scoreRange": {
    "max": 100,
    "min": 0
  },
  "totalWeight": 1,
  "weightsNormalized": false
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
3 h agoPassed40261 ms$0.01
8 h agoPassed40258 ms$0.01