Chapter 10: Hands-On Exercise – Building a Trading Bot with Flair
In this final chapter, we will go through a hands-on programming exercise where we will leverage a number of Flair's pre-trained models to build a real-world application. We will build a simple trading bot that uses Flair's Named Entity Recognition (NER) and sentiment analysis tools to make trading decisions. The trading strategy consists of taking the current day's news headlines as input and using NER to determine whether the news articles are discussing a company we are interested in. We will then run sentiment analysis that helps us make a call about whether to hold, buy, or sell this company's stock.
In the first section, we will cover the details of our trading strategy by explaining the motivation behind news sentiment-based trading approaches. Then, we will implement a trading bot using Flair. We plan to wrap the book up with a Flair coding cheat sheet containing a list of the most...