Trading On News Sentiment

Sep 14, 2022 by Eugene

Market news and sentiment

Did you ever wish to try out market news & sentiment trading but didn't know how to implement it?

Alpha Vantage provides a news feed API that returns both live and historical market news for stock and crypto symbols. After installing Wealth-Lab 8 build 17 you can get up to 200 latest news items for a supported symbol from AV. Previously, motivated traders would have to run historical news (from a source like SeekingAlpha, available in a Wealth-Lab extension) through a natural language processing API. Such preprocessing of news headlines requires development skills.

Alpha Vantage's killer feature is a sentiment score assigned to each news item, ranging from -0.35 to 0.35:

<= -0.35: Bearish
from -0.35 to -0.15: Somewhat Bearish
from -0.15 to < 0.15: Neutral
from 0.15 to < 0.35: Somewhat Bullish
>= 0.35: Bullish

Flagging a news story with a score frees you up from the hassle of linking up to an NLP API and also speeds up the backtest.

Setting up

Firstly, claim your free API key at the Alpha Vantage website at this direct link.

While their EOD data requires a premium subscription, the market news and sentiment remains free at the moment of writing this blog (September 2022). Then open the Data Manager enter the API key as shown below:

Enter your AlphaVantage API key

Switch to the Event Providers tab, check "AlphaVantage" first and then check "News". You're all set. Now our goal is to trade automatically based on the news sentiment.

Enable AlphaVantage event provider and the News item

Building a trading system from Blocks

Let's see if you can get an edge by trading on news sentiment data with Alpha Vantage in Wealth-Lab 8. Sentiment can serve as a signal to gain an insight whether you should take a long or short position. A popular assumption is positive news on a company drive its share price higher and vice versa. To leverage this idea, we lay out a simple trading system from Building Blocks:

  1. Drag "Indicator compare to value" condition onto the Buy block, choosing the "Fundamental" indicator and picking "News" as the source. A stock is bought if the news is ranked "somewhat bearish" (-0.35 to -0.15) or "bearish" (<= -0.35). The value should be less than or equal to it.
  2. Do the same for the sell side except that the value should be "somewhat bullish" (i.e. ranges from 0.15 to 0.35) or "bullish" (above 0.35).

Create a strategy from Blocks

See below on a chart of WDC some characteristic trades taken by the strategy we quickly created in Wealth-Lab 8. The green and red arrows on the chart plot the individual news items. Not all of them result in trades, of course. The histogram at the bottom of the chart plots AlphaVantage's killer feature in action: gloomy news are behind the downward bars (below zero) and rising bars (above zero) indicate optimistic news releases.

Strategy in action

Although the concept looks promising, traders will definitely want to combine sentiment data with historical data, fundamentals and technical indicators to have a broader view and a more robust trading strategy. For example, it may not be enough to look for stocks in their moment of extreme pessimism. Savvy traders would want to see the stock to be beaten-down but be backed up by strong fundamentals to enter at a bargain price.