My Algo-Trading Environment

Developing, Hosting and Managing Strategies

Matthew Tweed
Automation Generation
5 min readDec 9, 2018

--

Photo by Todd Quackenbush on Unsplash

(This is 12/8 post for Trading API Advent Calendar 2018)

Getting into algorithmic trading can seem pretty daunting and its hard to know where to start. One of the most important parts of any project is getting your tools right.

We’ll look at the software and infrastructure I use in my daily workflow and how it helps support development and trading.

Software for Development

Operating System

First off, the operating system — Linux Mint.

I find Linux to give great customisability and ease of use once you get familiar with it, especially so when it comes to installing and managing the software packages you’ll need for development.

While both MacOS and Windows offer most of the basic functionality, and often with cleaner graphical interfaces, I find the deeper customisability more important when refining my workflow for strategy design and testing.

IDE

For creating and evaluating the strategies I mostly use Python, with Geany as my IDE (Integrated Development Environment).

While Geany is fairly sparse for the built-in features you might expect from a modern IDE, it makes up for this with the ability to customize your own set of build, execute and test commands.

This allows me to run python scripts in an external Gnome Terminal with the simple press of F5. While this may seem fairly insignificant, it gives the ability to easily run multiple different instances of the same script at once, without having to leave the IDE — a feature which I found to be missing in the other IDEs I tried.

I use this, along with Linux workspaces, to split everything across multiple screens and reduce the need to minimise and move around windows.

My Linux workspace…

Hosting Your Strategy

My Previous Setup

For hosting live strategies, a cloud instance is highly recommended, especially so for intra-day trading, where internet reliability is essential.

I used an AWS EC2 instance running Ubuntu Server up until recently since they provide easy setup, management, and good reliability. However, I found their data transfer pricing to be too expensive, at $0.09 per GB of inbound data (for 1GB to 9.99TB of transfer per month).

While this may not be a concern for strategies which require less data, it added an unexpected cost to my hosting set up, prompting me to move to OVH, whose VPS instances offered reliable hosting at a better-fixed cost.

My New Setup

The new instance is still running Ubuntu Server. I later added Mate Desktop for ease of use with any GUI (Graphical User Interface) based software. This can then be accessed via VNC4 server on the instance and Vinagre as the client.

The trading strategies themselves then run on the instance either as programs which I leave running, or daily/hourly scripts which I schedule using Crontab.

Strategy Management

Almost all of my programs are run via command line, again, in Gnome Terminal. This helps keep everything simple since complex output data can be better analyzed externally.

I’d recommend writing as much data as possible to log files, everything from trade records, equity levels and market data to user inputs and debugging info. This makes life a lot easier if you ever have to diagnose crashes or bugs in the code, especially bugs which show up infrequently.

Storing strategy data also gives the opportunity to analyze the real-life strategy performance in depth, allowing you to adjust estimates and assumptions for any future back-testing and refinement.

You may also wish to add email alerts to your code, which is made easy by smtplib. This allows you to keep up-to-date with any trades or signals without having to constantly keep watch.

Summary

The software and services I’ve mentioned are what I’ve found work best for me in my development and trading.

While it makes a good starting place, I’d recommend trying a wide range of different IDEs, cloud hosts, etc until you find what works best for you and your workflow.

Technology and services are offered by AlpacaDB, Inc. Brokerage services are provided by Alpaca Securities LLC (alpaca.markets), member FINRA/SIPC. Alpaca Securities LLC is a wholly-owned subsidiary of AlpacaDB, Inc.

You can find us @AlpacaHQ, if you use twitter.

Follow Automation Generation, a Medium’s publication created for developers/makers in trading and fintech.

--

--