Data Sources
Alternative.me Fear and Greed Index API

“Each day, [Alternative.me] analyze emotions and sentiments from different sources and crunch them into one simple number: The Fear & Greed Index for Bitcoin and other large cryptocurrencies.”
Visit Alternative.me
Authentication:
No API key is required; this is a public API.
Rate Limits:
No official documentation on rate limits, but we ensured responsible usage with a single daily pull per session.
Endpoint Used:
https://api.alternative.me/fng/?limit=0&format=json— returns historical daily sentiment values
Data Structure:
The JSON response contains a list of daily entries. We extracted:
value(sentiment score from 0 to 100)
value_classification(labelled category like “Greed” or “Fear”)
timestamp(converted from UNIX seconds to standarddatetimeformat)
Each entry was normalised into a pandas DataFrame and filtered to only include the last 365 days.
Error Handling:
We checked for successful API responses using:
if response.status_code != 200:
raise Exception("Failed to fetch Fear & Greed Index")CoinGecko API

“CoinGecko provides a fundamental analysis of the crypto market. In addition to tracking price, volume and market capitalisation, CoinGecko tracks community growth, open-source code development, major events and on-chain metrics.”
Visit CoinGecko
Authentication:
A demo API key was used and securely stored using the dotenv library to avoid exposing credentials in version control.
Rate Limits:
CoinGecko’s free-tier API has usage limits (50–100 calls/minute). We respected rate limits by including time.sleep(1.5) between calls.
Endpoints Used:
/coins/{coin_id}/ohlc— retrieves open, high, low, and close prices
/coins/{coin_id}/market_chart— retrieves market cap and total trading volume
Data Structure:
Both endpoints return data in JSON format. Timestamps (in milliseconds) were converted to datetime. We reshaped the nested data into a flat pandas DataFrame.
Error Handling:
API responses were checked for a 200 OK status. Failures raised exceptions and printed messages to ensure transparency. Example:
if resp.status_code != 200:
raise Exception("Failed to fetch data")