{"uid":"cap_llf8scQYoDQFPga_u_Fwc","slug":"massive-x402-api-simple-moving-average-sma-62178f03","name":"Massive x402 API – Simple Moving Average (SMA)","description":"US stock market data, sold per request over x402. Every path here answers 402 with the payment terms in the PAYMENT-REQUIRED header, and answers with the data once the payment settles. No account, no API key, no subscription.","url":"https://agent.massive.com/v1/indicators/sma/%7BstockTicker%7D","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"pathParams":{"type":"object","required":["stockTicker"],"properties":{"stockTicker":{"type":"string","description":"Specify a case-sensitive ticker symbol for which to get simple moving average (SMA) data. For example, AAPL represents Apple Inc."}}},"queryParams":{"type":"object","properties":{"limit":{"type":"integer","default":10,"maximum":5000,"description":"Limit the number of results returned, default is 10 and max is 5000"},"order":{"enum":["asc","desc"],"type":"string","default":"desc","description":"The order in which to return the results, ordered by timestamp."},"window":{"type":"integer","default":50,"description":"The window size used to calculate the simple moving average (SMA). i.e. a window size of 10 with daily aggregates would result in a 10 day moving average."},"adjusted":{"type":"boolean","default":true,"description":"Whether or not the aggregates used to calculate the simple moving average are adjusted for splits. By default, aggregates are adjusted. Set this to false to get results that are NOT adjusted for splits."},"timespan":{"enum":["minute","hour","day","week","month","quarter","year"],"type":"string","default":"day","description":"The size of the aggregate time window."},"timestamp":{"type":"string","description":"Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp."},"series_type":{"enum":["open","high","low","close"],"type":"string","default":"close","description":"The price in the aggregate which will be used to calculate the simple moving average. i.e. 'close' will result in using close prices to calculate the simple moving average (SMA)."},"timestamp.gt":{"type":"string","description":"Range by timestamp."},"timestamp.lt":{"type":"string","description":"Range by timestamp."},"timestamp.gte":{"type":"string","description":"Range by timestamp."},"timestamp.lte":{"type":"string","description":"Range by timestamp."},"expand_underlying":{"type":"boolean","default":false,"description":"Whether or not to include the aggregates used to calculate this indicator in the response."}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":{"type":"json","example":{"status":"OK","results":{"values":[{"value":140.139,"timestamp":1517562000016}],"underlying":{"url":"https://api.massive.com/v2/aggs/ticker/AAPL/range/1/day/2003-01-01/2022-07-25","aggregates":[{"c":75.0875,"h":75.15,"l":73.7975,"n":1,"o":74.06,"t":1577941200000,"v":135647456,"vw":74.6099},{"c":74.3575,"h":75.145,"l":74.125,"n":1,"o":74.2875,"t":1578027600000,"v":146535512,"vw":74.7026}]}},"next_url":"https://api.massive.com/v1/indicators/sma/AAPL?cursor=YWN0aXZlPXRydWUmZGF0ZT0yMDIxLTA0LTI1JmxpbWl0PTEmb3JkZXI9YXNjJnBhZ2VfbWFya2VyPUElN0M5YWRjMjY0ZTgyM2E1ZjBiOGUyNDc5YmZiOGE1YmYwNDVkYzU0YjgwMDcyMWE2YmI1ZjBjMjQwMjU4MjFmNGZiJnNvcnQ9dGlja2Vy","request_id":"a47d1beb8c11b6ae897ab76cdbbf35a3"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_cEXozIxDgm15BtI67HYz3","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns the simple moving average (SMA) for a given US stock ticker over a configurable time range and window, paid per-request via x402 with no account or API key required.","exampleAgentPrompt":"Can you get me the 50-day simple moving average for AAPL using daily close prices, going back over the last 30 results in descending order?","exampleUseCases":[{"title":"Daily SMA for portfolio monitoring","prompt":"Pull the 50-day SMA for NVDA using daily close prices, give me the last 20 values in descending order — I want to see if it's trending above or below its average."},{"title":"Technical analysis with custom window","prompt":"Get me a 200-day moving average for SPY based on daily close prices, most recent 10 results, split-adjusted, so I can check the long-term trend."},{"title":"Intraday SMA on hourly bars","prompt":"Fetch the 10-period SMA for TSLA on an hourly timespan using close prices, limit to 5 results in ascending order, from 2024-01-15 onward."}],"resultDescription":"Returns a JSON object containing an array of SMA values each with a computed value and Unix millisecond timestamp, along with underlying aggregate OHLC bars used in the calculation, a next_url cursor for pagination, a request ID, and a status field. Payment is settled automatically via x402 before data is returned.","failureModes":["402 Payment Required if x402 payment header is missing or payment fails — response includes payment terms in PAYMENT-REQUIRED header","Invalid or unknown ticker symbol returns an error or empty results","Out-of-range limit (above 5000) rejected by schema validation","Invalid timespan or series_type enum value returns a bad request error","Malformed timestamp format (not YYYY-MM-DD or millisecond epoch) causes query failure","No data available for the requested date range returns empty values array"],"whenToPreferThis":"Choose this endpoint when you need on-demand, pay-per-call SMA data for US stocks without signing up for a subscription or managing API keys. It is ideal for AI agents that make infrequent or variable-volume requests to technical indicator data and can settle micropayments via x402. Prefer this over subscription-based financial data APIs when cost should scale strictly with usage, or when operating in a wallet-enabled agent environment.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T06:53:16.541Z","isFirstParty":false}