Working with Real-Time Data and Sockets

ZeroMQ is a lightweight, fast, and scalable socket programming library. ZeroMQ supports different patterns for socket communication. One of those patterns is the so-called publisher-subscriber (PUB-SUB) pattern where a single socket publishes data and multiple sockets simultaneously retrieve the data. Running a Simple Tick Data Server Euler discretisation of geometric Brownian motion S is the…

Building Classes for Event-Based Backtesting

Potential shortcomings of the approach are the following: Look-ahead bias Vectorised backtesting is based on the complete data set available and does not take into account that new data arrives incrementally. Simplification For example, fixed transaction costs cannot be modelled by vectorisation, which is mainly based on relative returns. Also, fixed amounts per trade or…

Predicting Market Movements with Machine Learning

Using Linear Regression for Market Movement Prediction Using logistic regression to predict market direction Without considering transaction costs Consider the same strategy applied to the GDX ETF, for which an out-of-sample outperformance (over the year 2018) Taking transaction costs into account Using deep learning for market movement prediction The simple classification problem revisited “MLP” stands…

Zipline and PyFolio

Zipline and PyFolio abstract away the complexities of the backtesting and performance/risk analysis aspects of algorithmic trading strategies. Backtesting should include all relevant factors, such as slippage and trading costs. Zipline is one of the most advanced open source Python libraries for algorithmic trading backtesting engines. PyFolio is an open-source Python performance and risk analysis…