Module Information
Description: CNN Fear and Greed Index Connector for QuantJourney Framework
This connector facilitates the downloading and parsing of the CNN Fear and Greed Index and its components. The index provides insight into the market's mood, contributing to financial market analysis in the QuantJourney Framework.
date: 2024-03-18
Author: jpolec
Class: CnnfConnector:()
Method: get_cnnfg_index_for_day
def get_cnnfg_index_for_day(
day
) -> pd.DataFrame
Fetches the Fear and Greed Index for a specific day.
Examples:
data = await cnnfg.get_cnnfg_index_for_day('2024-03-18')
x fg_value fg_rating
date
2024-03-18 1.710720e+12 71.085714 greed
2024-03-19 1.710806e+12 69.114286 greed
2024-03-20 1.710893e+12 73.171429 greed
2024-03-21 1.710979e+12 73.142857 greed
2024-03-22 1.711066e+12 68.771429 greed
2024-03-25 1.711325e+12 69.600000 greed
2024-03-26 1.711411e+12 67.828571 greed
2024-03-27 1.711498e+12 69.257143 greed
2024-03-28 1.711584e+12 71.028571 greed
2024-03-29 1.711670e+12 69.485714 greed
2024-04-01 1.711930e+12 67.371429 greed
2024-04-02 1.712016e+12 62.393822 greed
2024-04-03 1.712102e+12 63.428571 greed
2024-04-04 1.712189e+12 58.428571 greed
2024-04-05 1.712275e+12 62.321805 greed
2024-04-08 1.712534e+12 62.371429 greed
2024-04-09 1.712621e+12 54.769925 neutral
2024-04-10 1.712707e+12 51.988868 neutral
Parameters:
Name | Type | Description |
---|---|---|
day |
str |
The day for which to fetch the index in 'YYYY-MM-DD' format. |
Returns:
Type | Description |
---|---|
pd.DataFrame |
DataFrame containing the index and its components for the specified day. |
Method: parse_cnnfg_index_data
def parse_cnnfg_index_data(
data
) -> pd.DataFrame
Parses the Fear and Greed Index data from the CNN API response. Parameters:
Name | Type | Description |
---|---|---|
data |
dict |
The raw data from the CNN API. |
Returns:
Type | Description |
---|---|
pd.DataFrame |
DataFrame containing the index and its components. |
Method: get_cnnfg_index_range
def get_cnnfg_index_range(
start_date,
end_date
) -> pd.DataFrame
Fetches the Fear and Greed Index for a range of dates. Parameters:
Name | Type | Description |
---|---|---|
start_date |
str |
The start date in 'YYYY-MM-DD' format. |
end_date |
str |
The end date in 'YYYY-MM-DD' |
Returns:
Type | Description |
---|---|
pd.DataFrame |
DataFrame containing the index and its components for the specified date range. |