fear-and-greed
fear-and-greed copied to clipboard
Python wrapper for CNN's Fear & Greed Index.
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.