Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
fear-and-greed-crypto
Advanced tools
A simple wrapper for the Alternative.me 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.
pip install fear-and-greed-crypto
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)
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 timestampget_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 datescalculate_average(days: int)
- Calculate average index value over specified dayscalculate_median(days: int)
- Calculate median index value over specified daysdef 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 provided by Alternative.me. When using this data, please properly acknowledge the source and prominently reference it accordingly.
This project is licensed under the MIT License. See the LICENSE file for more information.
Rhett Reisman
Email: rhett@rhett.blog
GitHub: https://github.com/rhettre/fear-and-greed-crypto
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.
FAQs
A simple wrapper for the Alternative.me Crypto Fear and Greed Index API
We found that fear-and-greed-crypto demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.