AlgoTraderAlgoTrader Documentation

Appendix K. Example Strategy "NLP"

Natural Language Processing, shortened as NLP, is a branch of artificial intelligence that uses the natural language to deal with the interaction between computers and humans.

The purpose of NLP is to read, understand and analyse the human languages to make is valuable.

The idea of the strategy is to receive tweets about the chosen instrument and basing on their average sentiment enter long or short position.

The sentiment is calculated based on Standford CoreNLP library.

The main artifacts needed for the implementation of a new strategy are described in Chapter 4, Strategy Development.

The NLP Strategy consist of the following artifacts:


The strategy service class providing the main methods invoked by the application on certain events.


The service class connects to Twitter and provides tweets.


The service class uses natural language processing to calculate the overall sentiment of a tweet.


Contains parameters used by the strategy (e.g. accountId, securityId, orderQuantity, windowTimeInMinutes, openPositionFactor, closePositionFactor, consumerKey and consumerSecret)


Contains the MySQL database records. Needs to be imported into the database before running the strategy with the MySQL database.

To start the Strategy please see the explanations in Chapter 3, Starting AlgoTrader.

To setup the strategy for back testing and live trading on a development workstation please execute the following steps:

To start the strategy in live trading mode on a development workstation please execute the following steps: