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
string
The company's ticker symbol.
- symbol
-
As a query parameter:
- symbols
string
Comma-separated list of ticker symbols.
- symbols
Response Attributes
- Success
- No Data
- Error
-
s
string
Will always be
ok
when 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
string
Status will only be
no_data
if 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
string
Status will be
error
if the request produces an error response. -
errmsg
string
An error message.