A holdings row uses the post-market price when that field is present, and the regular-session price when it is not.
One quotes call accepts a comma-separated ticker list. The documented example publishes those two prices as separate fields.
To access this endpoint, you must obtain an API key: Get your API key
Pass the book as one ticker list
ticker is required. Spaces around the commas are trimmed. The request sends the docs example list.
Prefer the post-market price
Regular-session price, post-market price, and the regular-session percent are numbers, and the percent has no percent sign to strip. The script prefers the post-market price and keeps the session label and the short name. The quote object carries more fields than the excerpt.
import requests
url = "https://api.mboum.com/v1/markets/stock/quotes"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
params = {"ticker": "AAPL,TSLA"}
response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
payload = response.json()
for quote in payload.get("body", []):
post = quote.get("postMarketPrice")
price = post if post is not None else quote["regularMarketPrice"]
print(quote["symbol"], quote["shortName"], quote["marketState"], price, quote["regularMarketChangePercent"])
The excerpt keeps the fields the row uses from the first quote in the example file. The file continues after that object.
{
"body": [
{
"preMarketPrice": null,
"postMarketPrice": 178.43,
"shortName": "Apple Inc.",
"marketState": "POSTPOST",
"regularMarketPrice": 177.97,
"regularMarketChangePercent": -0.1234644,
"symbol": "AAPL"
}
]
}
Split a book that passes 200 symbols
A list of more than 200 tickers is refused with the message: Please limit tickers to 200. Split a larger book into separate calls.
Learn more or explore other endpoints: Mboum stock quotes