Test whether mood leads returns

Check whether changes in the Sentiment Index come before changes in prices, using your own price data and a few simple tests.

You need: an API key (opens in a new tab), your own price series and a notebook with Python or R.

  1. Get the index series

    Call get_market_index for 90 days and save the daily values. Repeat each month to build a longer history.

    A Python example that asks for 90 days of the index
  2. Join it with your prices

    Join the index with your own daily price series by date. Remember that the index for a day is calculated for the previous UTC day.

  3. Test with lags

    Compare the index with returns shifted by one, two, three and more days. Note which lags show a relation, and whether it holds in each half of the data.

  4. Write down the result

    Report the sample size, the lags and what failed. A weak or absent relation is also a result. Link the Sentiment index (opens in a new tab) page as the source.

  • What you will see

    A small study: the relation between the index and returns at several lags, with the sample size and the limits.

  • Data used

    get_market_index (7, 30 or 90 days), through the API (opens in a new tab). Store the daily values to build a longer history.

  • Limits

    • A short history gives weak tests.
    • A relation in the past may not hold later, and mood is not a trading signal.