Getting day gainers and losers data for trading.
One of the traders everyday activities is catching the stocks trends and using statistics on day gainers and loosers you can deside to join the common market trend or on contrary to guess backward market direction. In our case we will use Python to access trading statistics from Mboum Finance Official API which provides stocks day gainers and losers data.
Python Knowledge Base: Make coding great again.
- Updated:
2024-11-20 by Andrey BRATUS, Senior Data Analyst.
Python code to get trading day gainers:
Trading day gainers output (shown partly):
Python code to get trading day losers:
Trading day losers output (shown partly):
To use necessary API you need to get "your-api-key" directly from Mboum Finance, or using rapidapi.com, the way I recommend. Output data is in JSON format which can be easily converted to any suitable form for further visualisation and analysis, stocks day gainers/losers are stocks ordered in descending/ascending order by price percent delta.
Day gainers are simply stocks ordered in descending order by price percent change with respect to the previous close.
import requests
url = "https://mboum-finance.p.rapidapi.com/co/collections/day_gainers"
querystring = {"start":"0"}
headers = {
"X-RapidAPI-Key": "your-api-key",
"X-RapidAPI-Host": "mboum-finance.p.rapidapi.com"
}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Day losers are simply stocks ordered in ascending order by price percent change with respect to the previous close.
import requests
url = "https://mboum-finance.p.rapidapi.com/co/collections/day_losers"
querystring = {"start":"0"}
headers = {
"X-RapidAPI-Key": "your-api-key",
"X-RapidAPI-Host": "mboum-finance.p.rapidapi.com"
}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)