Crypto Fear and Greed Analytics is a Python-based tool that fetches, processes, and visualizes historical Fear and Greed Index data from the CoinMarketCap API. This project enables you to analyze investor sentiment trends over time and derive meaningful insights.
-
Fetch Data from CoinMarketCap API:
- Automatically fetch historical Fear and Greed Index data using the CoinMarketCap API.
-
Analyze Sentiment:
- Perform statistical analysis (max, min, mean) on the sentiment data.
-
Visualize Trends:
- Generate interactive visualizations to track Fear and Greed Index trends over time.
-
Export Processed Data:
- Save the processed data into CSV format for further analysis.
Crypto-Fear-And-Greed-Analytics/
├── data/
│ ├── raw/ # Stores raw JSON data
│ │ └── fear_greed.json
│ └── processed/ # Stores processed CSV data
│ └── fear_greed.csv
├── src/
│ ├── fetch_data.py # Script to fetch and save raw data
│ ├── analyze_data.py # Script to process data and export to CSV
│ ├── visualize_data.py # Script to generate visualizations
│ └── config.py # Contains the API key
├── requirements.txt # Python dependencies
└── README.md # Project documentation
git clone https://github.com/Vikranth3140/Crypto-Fear-And-Greed-Analytics.git
cd Crypto-Fear-And-Greed-Analytics
Install the required Python libraries:
pip install -r requirements.txt
- Sign up at CoinMarketCap and get your API key.
- Add your API key to the
config/config.py
file:API_KEY = "your_api_key_here"
Run the fetch_data.py
script to fetch historical Fear and Greed Index data from the CoinMarketCap API:
python src/fetch_data.py
This will save the raw data in data/raw/fear_greed.json
.
Run the analyze_data.py
script to process the raw data, calculate statistics, and save it to a CSV file:
python src/analyze_data.py
The processed data will be saved in data/processed/fear_greed.csv
.
Run the visualize_data.py
script to generate a time-series plot of the Fear and Greed Index:
python src/visualize_data.py
Statistics: {'max_value': 88, 'min_value': 26, 'mean_value': 57.55}
Endpoint:
GET https://pro-api.coinmarketcap.com/v3/fear-and-greed/historical
Query Parameters:
start
(optional): Starting timestamp for data retrieval.limit
(optional): Number of records to retrieve (default: 50).
Headers:
{
"X-CMC_PRO_API_KEY": "your_api_key_here"
}
Response Example:
{
"status": {
"timestamp": "2024-12-05T12:00:00.000Z",
"error_code": 0,
"error_message": null
},
"data": [
{ "timestamp": 1733356800, "value": 80, "value_classification": "Extreme Greed" },
{ "timestamp": 1733260400, "value": 83, "value_classification": "Extreme Greed" }
]
}
For more details, visit CoinMarketCap API Documentation.
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
. - Commit your changes:
git commit -m "Add feature-name"
. - Push to the branch:
git push origin feature-name
. - Open a pull request.
This project is licensed under the MIT License.