What is Business F&G INDEX ?
As it stated in it's name, the Fear & Greed Index or Investor Sentiment Index is a way to evaluate stock market movements and to estimate whether stocks are fairly priced.
The logic is simple, we expect that excessive fear tends drive down share prices, and greedy emotions have the opposite effect.
The Index itself is calculated and provided by CNN BUSINESS.
The F&G INDEX is a complex KPI that consists of seven different indicators that measure some aspect of stock market behavior.
They are market momentum, stock price strength, stock price breadth, put and call options, junk bond demand, market volatility, and safe haven demand.
The F&G INDEX tracks how much these individual indicators deviate from their averages compared to how much they normally diverge.
The calculated result score takes values from 0 to 100, with 100 representing maximum greediness and 0 signaling maximum fear.
Python Knowledge Base: Make coding great again.
- Updated:
2024-12-20 by Andrey BRATUS, Senior Data Analyst.
Python code to get a FEAR & GREED INDEX:
FEAR & GREED INDEX data output:
How to get Fear & Greed Index data ?
As we already know the Fear & Greed Index is used to gauge the mood of the market.
When combined with fundamentals and other analytical tools, the Index can be a helpful way to assess market sentiment.
In our case we will use Python to access free Business F&G INDEX APIs from rapidapi.com, you need to get "your-api-key".
Free API key will allow certain amount of requests per day and per month, in case of wider commercial use you can chose sutable paid subscription.
Output data is in JSON format which can be easily converted to any suitable form for further visualisation and analysis,
Fear & Greed Index data will give you a new way to fell market sentiments and gain stable profitable market profits.
import requests
url = "https://fear-and-greed-index.p.rapidapi.com/v1/fgi"
headers = {
"X-RapidAPI-Key": "your-api-key",
"X-RapidAPI-Host": "fear-and-greed-index.p.rapidapi.com"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
{"lastUpdated":{"epochUnixSeconds":1667329020,"humanDate":"2022-11-01T18:57:00Z"},"fgi":{"now":{"value":58,"valueText":"Greed"},"previousClose":{"value":58,"valueText":"Greed"},"oneWeekAgo":{"value":52,"valueText":"Neutral"},"oneMonthAgo":{"value":15,"valueText":"Extreme Fear"},"oneYearAgo":{"value":66,"valueText":"Greed"}}}