---
title: "Writing a Twitter Stock Trading Bot"
date: 2017-02-01
author: Matt
url: https://www.mattwarren.co/2017/02/writing-a-twitter-stock-trading-bot/
---

# Writing a Twitter Stock Trading Bot

My project for the month is a stock trading bot that will ingest tweets from accounts I consider to be market influencers and do some parsing and sentiment analysis to help create and execute a trade through my broker.

For years I’ve wanted to build something to do automated trading and this is something that seems simple enough to accomplish in a month.  That makes it a worthy experiment.

There are several steps to this process:

1. connect to the twitter stream API and listen to specific user accounts
2. for each tweet that comes in, parse it for a company name or CEO name
3. if there is a company or CEO mentioned, find the ticker symbol
4. run a sentiment analysis on the tweet
5. look up the current price of the stock
6. decide on a trade (long/short) and size, limits and stop loss
7. execute trade through broker

This project will be open-source for those of you interested in watching the progress or curious to see how it works. [Twitter Trading Project](https://github.com/mfwarren/twittertrading)