A simple moving average smooths a price series over a fixed window.
Send one ticker plus interval, series type, time period, and limit, then read timestamped SMA points. The docs list a default limit of 50 when you do not override it. This is a single-ticker indicator call.
To access this endpoint, you must obtain an API key: Get your API key
The Endpoint
GET /v1/markets/indicators/sma returns the simple moving average for one ticker. The sample request is ticker=AAPL, interval=1d, series_type=close, time_period=50, and limit=50.
Parameters
- ticker: Required. One ticker per request. The example is
AAPL. This endpoint is not a batch quote call. - interval: Required. Allowed values and approximate ranges:
1m— about 1 day5m— about 1 month15m— about 1 month30m— about 1 month1d— about 5 years1wk— about 5 years1mo— about 10 years3mo— about 10 years
- series_type: The price series that feeds the average. Use
open,close,high, orlow. The example usesclose. - time_period: The window length. The example is
50. - limit: How many points to return. The example is
50. The docs say the default limit is 50.
Python Example
The script requests a 50-day SMA on daily closes for AAPL and prints each timestamp and SMA. Send a Bearer token from your Mboum API key.
import requests
url = "https://api.mboum.com/v1/markets/indicators/sma"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
params = {
"ticker": "AAPL",
"interval": "1d",
"series_type": "close",
"time_period": 50,
"limit": 50,
}
response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
payload = response.json()
for item in payload["body"]:
print(item["timestamp"], item["SMA"])
Understanding the Response
A successful response has meta and body. Meta echoes the request so you can confirm the series. Each body item is one SMA point. The shortened example below is one point.
{
"meta": {
"symbol": "AAPL",
"interval": "1d",
"series_type": "close",
"indicator": "Simple Moving Average (SMA)",
"time_period": 50
},
"body": [
{
"timestamp": 1700000000,
"SMA": 185.12
}
]
}
Walk the body in order and pair each timestamp with its SMA value. That is the full series this endpoint returns for the parameters you sent. If the plot looks shorter or longer than you expected, check limit and whether the interval’s available history matches the window you had in mind.
Key Fields
- symbol, interval, series_type, indicator, and time_period: Meta for the request that produced the series. In the sample, the indicator is Simple Moving Average (SMA), the symbol is
AAPL, the interval is1d, the series type isclose, and the time period is 50. - timestamp: The point’s time. The shortened example uses 1700000000.
- SMA: The simple moving average at that timestamp. The shortened example uses 185.12.
Practical Use Cases
A 50-day close average
Use daily bars when you want a multi-year SMA context. Set interval=1d, series_type=close, and time_period=50. Keep limit=50 if that return size is enough. Confirm meta shows the same symbol, interval, series type, and time period, then print each timestamp and SMA.
Matching the interval to the window
A 1m interval covers about one day of candles, while 1d covers about five years. The same time_period number means very different calendar spans depending on the interval. Switch to a minute interval only when you need intraday smoothing, and always send exactly one ticker.
Learn more or explore other endpoints: SMA indicator