Real-Time Prices High Usage
This endpoint is currently in open beta. It is available to all users (including free trial users) during our open beta test. We welcome your feedback.
Get real-time midpoint prices for one or more stocks. This endpoint returns real-time prices for stocks, using the SmartMid model.
Endpoint
https://api.marketdata.app/v1/stocks/prices/{symbol}/
or
https://api.marketdata.app/v1/stocks/prices/?symbols={symbol1},{symbol2},...
Method
GET
Request Examples
- Single Symbol
- Multiple Symbols
- HTTP
- NodeJS
- Python
fetch("https://api.marketdata.app/v1/stocks/prices/AAPL/")
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
import requests
url = "https://api.marketdata.app/v1/stocks/prices/AAPL/"
response = requests.request("GET", url)
print(response.text)
- HTTP
- NodeJS
- Python
fetch("https://api.marketdata.app/v1/stocks/prices/?symbols=AAPL,META,MSFT")
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
import requests
url = "https://api.marketdata.app/v1/stocks/prices/"
params = {"symbols": "AAPL,META,MSFT"}
response = requests.request("GET", url, params=params)
print(response.text)
Response Example
{
"s": "ok",
"symbol": ["AAPL", "META", "MSFT"],
"mid": [149.07, 320.45, 380.12],
"updated": [1663958092, 1663958092, 1663958092]
}
Request Parameters
- Required
You can provide the symbol(s) in one of two ways:
-
As part of the URL path:
- symbol
stringThe company's ticker symbol.
- symbol
-
As a query parameter:
- symbols
stringComma-separated list of ticker symbols.
- symbols
Response Attributes
- Success
- No Data
- Error
-
s
stringWill always be
okwhen there is data for the symbols requested. -
symbol
array[string]Array of ticker symbols that were requested.
-
mid
array[number]Array of midpoint prices, as calculated by the SmartMid model.
-
updated
array[date]Array of date/times for each stock price.
-
s
stringStatus will only be
no_dataif no prices can be found for all of the symbols. If a price for any symbol can be returned, the request will be successful.
-
s
stringStatus will be
errorif the request produces an error response. -
errmsg
stringAn error message.