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 ...

Get Natural Language Processing with Flair now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.