Dollar volume for a percent gainer is last price times volume, after both display strings are parsed.
One movers call returns a single ranking. The documented example is the percent ranking in the up direction.
To access this endpoint, you must obtain an API key: Get your API key
Pull the percent-up page
change_type PERCENT ranks by percent change, and direction UP keeps the advances. The request uses the docs example page.
Percent change includes a percent sign, volume includes commas, and last price is a numeric string. The excerpt is the first row, and the example file continues after it. The row carries more fundamental strings than this excerpt.
{
"meta": {
"count": 20,
"total": 200,
"page": 1
},
"body": [
{
"symbol": "HELE",
"lastPrice": "73.79",
"percentChange": "+18.31%",
"volume": "2,418,808"
}
]
}
Multiply price by volume
The helper strips commas, percent signs, and a leading plus, then multiplies last price by volume. The percent is parsed the same way so it can sit beside the dollar volume.
import requests
url = "https://api.mboum.com/v2/markets/movers"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
params = {"change_type": "PERCENT", "direction": "UP", "page": 1}
response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
payload = response.json()
def num(value):
return float(str(value).replace(",", "").replace("%", "").replace("+", ""))
for row in payload.get("body", [])[:5]:
last = num(row["lastPrice"])
volume = num(row["volume"])
print(row["symbol"], num(row["percentChange"]), last * volume)
Price and gap stay on their own pages
A price ranking uses change_type PRICE. An overnight-gap ranking uses GAP. Declines on the same change type use direction DOWN. An omitted direction selects advances. Meta count is the page in hand, and total is the larger ranking.
Learn more or explore other endpoints: Mboum v2 movers