Introduction
This API call is used to retrieve the simple moving average for the specified stock symbol over
a specified period from a database and returns the results as JSON. The API call takes in the symbol,
maxDate, and length as parameters and returns the simple moving average data for the symbol.
Endpoint
/simple-moving-average/:symbol/:maxDate/:length
Parameters
- symbol (string, required) – The stock symbol for which to retrieve historical data.
- maxDate (date, required) – The maximum date to include in the calculation. Format:
‘yyyy-mm-dd’. - length (integer, required) – The number of days to calculate the moving average over.
Examples
List of several example calls, URLs, and responses to show users how to interact with the API
call. These examples should include a variety of input parameters to demonstrate the different scenarios that the
API call can handle.
-
https://api.deltaneutral.net/simple-moving-average/AAPL/2023-04-23/20?apikey=DEMOAPIKEY
-
https://api.deltaneutral.net/simple-moving-average/GOOG/2023-04-23/50?apikey=DEMOAPIKEY
Related Calls
None
Error Handling and Hints
If no data comes back, please check for valid input parameters. This API call returns 1 year of data at a time. If you want all of 2022, you would set the maxDate to ‘2022-12-31’.
Example Response
[{"length":"20",
"data":
[{"length":"20","data":
[{
"quotedate":"2023-04-21T00:00:00.000Z",
"sma":"155.56"
},
{
"quotedate":"2023-04-20T00:00:00.000Z",
"sma":"155.26"
},
{
"quotedate":"2023-04-19T00:00:00.000Z",
"sma":"154.82"
}
}]
}]