Skip to main content

Daily Stock Data API

This API provides access to daily stock data, beta values, mutual fund profiles, and residuals. It supports time range filtering, field selection, and data retrieval in JSON or CSV format. Authentication is required via API key.


Base URL

https://api.riskmodels.net/daily-stock-data-api

Authentication

All endpoints require an API key to be passed in the request header:

apikey: <your-api-key>

Endpoints

1. GET /daily – Retrieve Daily Stock Data

Retrieve daily stock data, optionally filtered by time range, specific fields, and format.

Example Request:

curl --header "apikey: <API_KEY>" \
--request GET "https://api.riskmodels.net/daily-stock-data-api/daily?symbols=AAPL,GOOG&start_time=2024-10-04&end_time=2024-10-04&fields=close,volume,symbol"

Parameters:

NameInTypeRequiredDescription
symbolsquerystringYesComma-separated list of stock tickers to filter by.
start_timequerystringYesStart of the time range (YYYY-MM-DD).
end_timequerystringNoEnd of the time range (YYYY-MM-DD).
fieldsquerystringNoComma-separated list of fields (e.g., close,volume).
formatquerystringNoFormat to retrieve data (json or csv). Default: json.

Response Example:

[
{
"symbol": "AAPL",
"close": 149.55,
"volume": 9812314,
},
{
"symbol": "GOOG",
"close": 168.56,
"volume": 11435318,
}
]

2. GET /betas – Retrieve Beta Data

Retrieve beta values for specific symbols and factors.

Example Request:

curl --header "apikey: <API_KEY>" \
--request GET "https://api.riskmodels.net/daily-stock-data-api/betas?symbols=AAPL,GOOG&start_time=2024-10-04&end_time=2024-10-04&fact=Mkt"

Parameters:

NameInTypeRequiredDescription
symbolsquerystringYesComma-separated list of stock tickers to filter by.
factquerystringYesFactor name to filter by.
start_timequerystringYesStart of the time range (YYYY-MM-DD).
end_timequerystringNoEnd of the time range (YYYY-MM-DD).
formatquerystringNoFormat to retrieve data (json or csv). Default: json.

Response Example:

[
{
"teo": "2024-10-04",
"symbol": "AAPL",
"factor_beta": 0.861774725720499,
"fact": "Mkt"
},
{
"teo": "2024-10-04",
"symbol": "GOOG",
"factor_beta": 0.969178634609282,
"fact": "Mkt"
}
]

3. GET /facts – Retrieve Facts Data

Retrieve fact return values filtered by factor and date.

Example Request:

curl --header "apikey: <API_KEY>" \
--request GET "https://api.riskmodels.net/daily-stock-data-api/facts?fact=Energy&start_time=2024-10-04&end_time=2024-10-07"

Parameters:

NameInTypeRequiredDescription
factquerystringYesFactor to filter by (e.g., Energy, Mkt).
start_timequerystringYesStart of the time range (YYYY-MM-DD).
end_timequerystringNoEnd of the time range (YYYY-MM-DD).
formatquerystringNoFormat to retrieve data (json or csv). Default: json.

Response Example:

[
{
"teo": "2024-10-04T00:00:00",
"fact": "Energy",
"factor_return": 0.47414848827427347
},
{
"teo": "2024-10-07T00:00:00",
"fact": "Energy",
"factor_return": 0.7559717995628776
}
]

4. GET /gross – Retrieve Gross Data

Retrieve gross return values filtered by symbols and date.

Example Request:

curl --header "apikey: <API_KEY>" \
--request GET "https://api.riskmodels.net/daily-stock-data-api/gross?symbols=GOOGL,AAPL&start_time=2024-10-04&end_time=2024-10-05

Parameters:

NameInTypeRequiredDescription
symbolsquerystringYesComma-separated list of stock tickers to filter by.
start_timequerystringYesStart of the time range (YYYY-MM-DD).
end_timequerystringNoEnd of the time range (YYYY-MM-DD).
formatquerystringNoFormat to retrieve data (json or csv). Default: json.

Response Example:

[
{
"teo": "2024-10-04T00:00:00",
"symbol": "GOOGL",
"gross_return": 0.7235
},
{
"teo": "2024-10-04T00:00:00",
"symbol": "AAPL",
"gross_return": 0.5007
}
]

5. GET /resids – Retrieve Residuals Data

Retrieve residual data for specific symbols over a time range.

Example Request:

curl --header "apikey: <API_KEY>" \
--request GET "https://api.riskmodels.net/daily-stock-data-api/resids?symbols=AAPL,GOOG&start_time=2024-10-04&end_time=2024-10-04"

Parameters:

NameInTypeRequiredDescription
symbolsquerystringYesComma-separated list of stock tickers to filter by.
start_timequerystringYesStart of the time range (YYYY-MM-DD).
end_timequerystringNoEnd of the time range (YYYY-MM-DD).
formatquerystringNoFormat to retrieve data (json or csv). Default: json.

Response Example:

[
{
"teo": "2024-10-04",
"residual_return": -0.202475783971016,
"symbol": "AAPL"
},
{
"teo": "2024-10-04",
"residual_return": -0.0489799958486298,
"symbol": "GOOG"
}
]

6. GET /symbol_list – Retrieve Top Stock Symbols

Retrieve top_n symbol list by top_by such as mktcap, mktcap_rank, close, return, turnover, volume. Sector specific symbol list can be retrieve by specifying option sector_code parameter.

Example Request:

curl --header "apikey: <API_KEY>" \
--request GET "https://api.riskmodels.net/daily-stock-data-api/symbol_list?top_n=5"

Parameters:

NameInTypeRequiredDescription
sector_codequerystringNoTo retrieve symbol list specific to given sector. Default: None.
top_nqueryintegerYesNumber of top stock symbols to return. Default: 10.
top_byquerystringNoColumn to sort by (e.g., mktcap, mktcap_rank, close, turnover, volume, return). Default: mktcap.
ascendingquerybooleanNoWhether to sort in ascending order. Default: false.

Response Example:

{
"symbols": [
"AAPL",
"NVDA",
"MSFT",
"AMZN",
"META"
]
}