Crypto Fear and Greed Index API
A simple Python wrapper for the Alternative.me Crypto Fear and Greed Index API. Get Bitcoin market sentiment data easily with intuitive methods.
Installation
pip install fear-and-greed-crypto
Quick Start
from fear_and_greed import FearAndGreedIndex
# Initialize the client
fng = FearAndGreedIndex()
# Get current index value (0-100)
value = fng.get_current_value()
print(f"Current Fear & Greed Index: {value}")
# Get current classification
sentiment = fng.get_current_classification()
print(f"Market sentiment: {sentiment}") # e.g., "Extreme Fear", "Neutral", "Greed"
# Get complete current data
today = fng.get_current_data()
# Get historical data
from datetime import datetime, timedelta
# Last 7 days
week_data = fng.get_last_n_days(7)
# Data between specific dates
start_date = datetime.now() - timedelta(days=30)
monthly_data = fng.get_historical_data(start_date)
# Calculate averages and medians
week_avg = fng.calculate_average(7)
month_median = fng.calculate_median(30)
Available Methods
Basic Methods
get_current_value()- Get current fear and greed index (0-100)get_current_classification()- Get current market sentiment classificationget_current_data()- Get complete current data including value, classification, and timestamp
Historical Data
get_last_n_days(days: int)- Get data for the last n daysget_historical_data(start_date: datetime, end_date: Optional[datetime] = None)- Get data between dates
Analysis Methods
calculate_average(days: int)- Calculate average index value over specified dayscalculate_median(days: int)- Calculate median index value over specified days
Example Trading Strategy
def should_buy_bitcoin():
fng = FearAndGreedIndex()
fear_level = fng.get_current_value()
# Buy when fear is high (value < 30)
return fear_level < 30
# Example usage
if should_buy_bitcoin():
print("Market shows extreme fear - consider buying!")
See more examples in the examples directory.
Data Attribution
Data provided by Alternative.me. When using this data, please properly acknowledge the source and prominently reference it accordingly.
License
This project is licensed under the MIT License. See the LICENSE file for more information.
Author
Rhett Reisman
Email: rhett@rhett.blog
GitHub: https://github.com/rhettre/fear-and-greed-crypto
Disclaimer
This project is not affiliated with, maintained, or endorsed by Alternative.me. Use this software at your own risk. Trading cryptocurrencies carries a risk of financial loss. The developers of this software are not responsible for any financial losses or damages incurred while using this software. Nothing in this software should be seen as an inducement to trade with a particular strategy or as financial advice.
Metadata
Release files for fear-and-greed-crypto 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fear_and_greed_crypto-0.1.0.tar.gz | 6.5 kB | Without provenance | Details for fear_and_greed_crypto-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fear_and_greed_crypto-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for fear_and_greed_crypto-0.1.0-py3-none-any.whl |
Total release size: 11.4 kB
Release files / fear_and_greed_crypto-0.1.0.tar.gz
| Download URL | fear_and_greed_crypto-0.1.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c9fa59e00fc82d08723291c416f3e6d7d5aeb1064e110cdb67a132b22997752
|
|
BLAKE2b-256 checksum How to use checksums |
48fc2fd1dae8c32458c2c21677168e2a45a8a33bd76cab7bc14af1709502263c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.5
|
Release files / fear_and_greed_crypto-0.1.0-py3-none-any.whl
| Download URL | fear_and_greed_crypto-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89ba66f6683dbffdb97c5561d1bf8b5425ebf992e4b77b457b9471a22c9ffc1f
|
|
BLAKE2b-256 checksum How to use checksums |
1cc63c297ad216db78a20fbe259006fe354540d831bae1563816a2219e25cbfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.5
|
Security for fear-and-greed-crypto 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.