Real-Time Prices High Usage
Get real-time midpoint prices for one or more stocks. This endpoint returns real-time prices for stocks, using the SmartMid model.
Data Availability
This endpoint is available to all users and does not require any exchange entitlements. All users receive real-time prices regardless of their plan or access level.
User Type | Exchange Entitlement | Price Type |
---|---|---|
All Users | Not Required | Real-time |
Entitlements are permissions granted by exchanges that allow access to real-time data. This endpoint does not require any exchange entitlements and provides real-time prices to all users. Learn more about entitlements.
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],
"change": [-2.052, 1.23, -0.85],
"changepct": [-0.0088, 0.0039, -0.0022],
"updated": [1663958092, 1663958092, 1663958092]
}
Request Parameters
- Required
- Optional
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
-
extended
boolean
Control the inclusion of extended hours data in the price output. Defaults to
true
if omitted.- When set to
true
, the most recent price is always returned, without regard to whether the market is open for primary trading or extended hours trading. - When set to
false
, only prices from the primary trading session are returned. When the market is closed or in extended hours, a historical price from the last closing bell of the primary trading session is returned instead of an extended hours price.
- When set to
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.
-
change
array[number]
Array of price changes in currency units compared to the closing price of the previous primary trading session.
-
changepct
array[number]
Array of price changes in percent, expressed as a decimal, compared to the closing price of the previous day. For example, a 3% change will be represented as 0.03.
- When the market is open for primary trading, change and changepct are always calculated using the current midpoint price and the last primary session close. When the market is closed or in extended hours, this criteria is also used as long as
extended
is omitted or set totrue
. - When
extended
is set tofalse
, and the market is closed or in extended hours, prices from extended hours are not considered. The values for change and changepct will be calculated using the last two closing prices instead.
-
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.