fear-and-greed-crypto


Namefear-and-greed-crypto JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/rhettre/fear-and-greed-crypto
SummaryA simple wrapper for the Alternative.me Crypto Fear and Greed Index API
upload_time2024-12-29 19:08:17
maintainerNone
docs_urlNone
authorRhett Reisman
requires_python>=3.9
licenseMIT
keywords bitcoin crypto fear-and-greed-index trading finance cryptocurrency market-sentiment alternative-me bitcoin-trading crypto-trading market-analysis trading-signals api-wrapper technical-analysis market-indicators crypto-sentiment bitcoin-sentiment market-psychology trading-psychology
VCS
bugtrack_url
requirements requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```bash
pip install fear-and-greed-crypto
```

## Quick Start

```python
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 classification
- `get_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 days
- `get_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 days
- `calculate_median(days: int)` - Calculate median index value over specified days

## Example Trading Strategy

```python
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](https://alternative.me/crypto/fear-and-greed-index/). 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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rhettre/fear-and-greed-crypto",
    "name": "fear-and-greed-crypto",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "bitcoin, crypto, fear-and-greed-index, trading, finance, cryptocurrency, market-sentiment, alternative-me, bitcoin-trading, crypto-trading, market-analysis, trading-signals, api-wrapper, technical-analysis, market-indicators, crypto-sentiment, bitcoin-sentiment, market-psychology, trading-psychology",
    "author": "Rhett Reisman",
    "author_email": "rhett@rhett.blog",
    "download_url": "https://files.pythonhosted.org/packages/48/fc/2fd1dae8c32458c2c21677168e2a45a8a33bd76cab7bc14af1709502263c/fear_and_greed_crypto-0.1.0.tar.gz",
    "platform": null,
    "description": "# Crypto Fear and Greed Index API\n\nA simple Python wrapper for the Alternative.me Crypto Fear and Greed Index API. Get Bitcoin market sentiment data easily with intuitive methods.\n\n## Installation\n\n```bash\npip install fear-and-greed-crypto\n```\n\n## Quick Start\n\n```python\nfrom fear_and_greed import FearAndGreedIndex\n\n# Initialize the client\nfng = FearAndGreedIndex()\n\n# Get current index value (0-100)\nvalue = fng.get_current_value()\nprint(f\"Current Fear & Greed Index: {value}\")\n\n# Get current classification\nsentiment = fng.get_current_classification()\nprint(f\"Market sentiment: {sentiment}\")  # e.g., \"Extreme Fear\", \"Neutral\", \"Greed\"\n\n# Get complete current data\ntoday = fng.get_current_data()\n\n# Get historical data\nfrom datetime import datetime, timedelta\n\n# Last 7 days\nweek_data = fng.get_last_n_days(7)\n\n# Data between specific dates\nstart_date = datetime.now() - timedelta(days=30)\nmonthly_data = fng.get_historical_data(start_date)\n\n# Calculate averages and medians\nweek_avg = fng.calculate_average(7)\nmonth_median = fng.calculate_median(30)\n```\n\n## Available Methods\n\n### Basic Methods\n- `get_current_value()` - Get current fear and greed index (0-100)\n- `get_current_classification()` - Get current market sentiment classification\n- `get_current_data()` - Get complete current data including value, classification, and timestamp\n\n### Historical Data\n- `get_last_n_days(days: int)` - Get data for the last n days\n- `get_historical_data(start_date: datetime, end_date: Optional[datetime] = None)` - Get data between dates\n\n### Analysis Methods\n- `calculate_average(days: int)` - Calculate average index value over specified days\n- `calculate_median(days: int)` - Calculate median index value over specified days\n\n## Example Trading Strategy\n\n```python\ndef should_buy_bitcoin():\n    fng = FearAndGreedIndex()\n    fear_level = fng.get_current_value()\n    \n    # Buy when fear is high (value < 30)\n    return fear_level < 30\n\n# Example usage\nif should_buy_bitcoin():\n    print(\"Market shows extreme fear - consider buying!\")\n```\n\nSee more examples in the `examples` directory.\n\n## Data Attribution\n\nData provided by [Alternative.me](https://alternative.me/crypto/fear-and-greed-index/). When using this data, please properly acknowledge the source and prominently reference it accordingly.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for more information.\n\n## Author\n\nRhett Reisman\n\nEmail: rhett@rhett.blog\n\nGitHub: https://github.com/rhettre/fear-and-greed-crypto\n\n## Disclaimer\n\nThis 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.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple wrapper for the Alternative.me Crypto Fear and Greed Index API",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/rhettre/fear-and-greed-crypto"
    },
    "split_keywords": [
        "bitcoin",
        " crypto",
        " fear-and-greed-index",
        " trading",
        " finance",
        " cryptocurrency",
        " market-sentiment",
        " alternative-me",
        " bitcoin-trading",
        " crypto-trading",
        " market-analysis",
        " trading-signals",
        " api-wrapper",
        " technical-analysis",
        " market-indicators",
        " crypto-sentiment",
        " bitcoin-sentiment",
        " market-psychology",
        " trading-psychology"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1cc63c297ad216db78a20fbe259006fe354540d831bae1563816a2219e25cbfe",
                "md5": "aaf3bd8c6bfad246e583b114503fb21c",
                "sha256": "89ba66f6683dbffdb97c5561d1bf8b5425ebf992e4b77b457b9471a22c9ffc1f"
            },
            "downloads": -1,
            "filename": "fear_and_greed_crypto-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "aaf3bd8c6bfad246e583b114503fb21c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 4970,
            "upload_time": "2024-12-29T19:08:14",
            "upload_time_iso_8601": "2024-12-29T19:08:14.817061Z",
            "url": "https://files.pythonhosted.org/packages/1c/c6/3c297ad216db78a20fbe259006fe354540d831bae1563816a2219e25cbfe/fear_and_greed_crypto-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "48fc2fd1dae8c32458c2c21677168e2a45a8a33bd76cab7bc14af1709502263c",
                "md5": "9f8647334c4711d0d7595bc13d7b0048",
                "sha256": "6c9fa59e00fc82d08723291c416f3e6d7d5aeb1064e110cdb67a132b22997752"
            },
            "downloads": -1,
            "filename": "fear_and_greed_crypto-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9f8647334c4711d0d7595bc13d7b0048",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 6475,
            "upload_time": "2024-12-29T19:08:17",
            "upload_time_iso_8601": "2024-12-29T19:08:17.232080Z",
            "url": "https://files.pythonhosted.org/packages/48/fc/2fd1dae8c32458c2c21677168e2a45a8a33bd76cab7bc14af1709502263c/fear_and_greed_crypto-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-29 19:08:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rhettre",
    "github_project": "fear-and-greed-crypto",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.32.3"
                ]
            ]
        }
    ],
    "lcname": "fear-and-greed-crypto"
}
        
Elapsed time: 0.48727s