Send a message when the mood hits an extreme
A small script that tells you only when the market mood goes beyond limits you chose.
You need: an API key (opens in a new tab) and a place to run a daily script and send a message.
Get an API key
Create a key on the API keys (opens in a new tab) page and keep it in an environment variable, not in your code. Each request uses credits.


Choose two limits
Decide the upper and lower limit, for example 75 and 25. Write them in the script.
Read the index
Once a day call
get_market_indexand take the latest value.

Send a message only when a limit is crossed
Compare the value with the limits. Send a message with the value and a link to the Sentiment index (opens in a new tab) only if one is crossed. Keep quiet otherwise.
What you will see
A quiet script that sends one message when the market mood is beyond your limits.
Data used
get_market_indexthrough the API (opens in a new tab).Limits
- The latest value is for the previous day, so this is a daily check, not a live alert.
- An extreme can last for weeks: send the message once per crossing.
More use cases
Look for crowded moods
When almost everyone is bullish or bearish, a portfolio may be more exposed to a sudden reversal.
Add a mood filter to a trading bot
A bot can skip or shrink entries when the market mood is at an extreme.
Ask what changed since last week
Ask your assistant for a short comparison of the market mood and the top assets this week and last week.
Test whether mood leads returns
Check whether changes in the index come before changes in prices in your own data.