Skip to main content

Python wrapper for CNN Fear & Greed Index.

Project description

Python wrapper for CNN's Fear & Greed Index.

Fetches CNN's website, parses the index value and returns the data as a three-element tuple.

Installation

pip install fear-and-greed

Usage example

import fear_and_greed

fear_and_greed.get()

Returns a three-element namedtuple with (a) the current value of the Fear & Greed Index, (b) a description of the category into which the index value falls (from "Extreme Fear" to "Extreme Greed") and (c) the timestamp at which the index value was last updated on CNN's website. Example:

FearGreedIndex(
    value=31.4266,
    description='fear',
    last_update=datetime.datetime(2022, 4, 25, 16, 51, 9, 254000, tzinfo=datetime.timezone.utc)),
 )

Requests to CNN's website are locally cached for 1m.

Test workflow PyPI badge Black badge

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fear-and-greed-0.4.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

fear_and_greed-0.4-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page