How do I develop Trading Systems?

Often, trading model developers “spoil” the eventual results of their model by making errors early in the process. These errors could be using poorly-collected data, not accounting for survivorship bias, or testing too many specifications of a similar model. Data snooping such as that can be particularly costly in that it is an error that cannot be reversed. Therefore, if you haven’t yet begun the active work of acquiring data, specifying a model, or backtesting, then you have the opportunity to conduct the testing and development process optimally.

https://www.linkedin.com/pulse/how-do-i-develop-trading-systems-ariel

Introduction to Zipline in Python

Zipline is a Python library for trading applications that powers the Quantopian service mentioned above. It is an event-driven system that supports both backtesting and live-trading.

In this article we will learn how to install Zipline and then how to implement Moving Average Crossover strategy and calculate P&L, Portfolio value etc.

This article is divided into the following four sections:

  • Benefits of Zipline
  • Installation (how to install Zipline on local)
  • Structure (format to write code in Zipline),
  • Coding Moving average crossover strategy with Zipline

Benefits of Zipline

  • Ease of use
  • Zipline comes “batteries included” as many common statistics like moving average and linear regression can be readily accessed from within a user-written algorithm.
  • Input of historical data and output of performance statistics are based on Pandas DataFrames to integrate nicely into the existing PyData ecosystem
  • Statistic and machine learning libraries like matplotlib, scipy, statsmodels, and sklearn support development, analysis, and visualization of state-of-the-art trading systems

http://www.quantinsti.com/blog/introduction-zipline-python/

Machine learning for financial prediction: experimentation with David Aronson’s latest work

One of the first books I read when I began studying the markets a few years ago was David Aronson’s Evidence Based Technical Analysis. The engineer in me was attracted to the ‘Evidence Based’ part of the title. This was soon after I had digested a trading book that claimed a basis in chaos theory, the link to which actually turned out to be non-existent. Apparently using complex-sounding terms in the title of a trading book lends some measure of credibility. Anyway, Evidence Based Technical Analysis is largely a justification of a scientific approach to trading, including a method for rigorous assessment of the presence of data mining bias in backtest results. There is also a compelling discussion based in cognitive psychology of the reasons that some traders turn away from objective methods and embrace subjective beliefs. I find this area fascinating.

Readers of this blog will know that I am very interested in using machine learning to profit from the markets. Imagine my delight when I discovered that David Aronson had co-authored a new book with Timothy Masters titled Statistically Sound Machine Learning for Algorithmic Trading of Financial Instruments – which I will herein refer to as SSML. I quickly devoured the book and have used it as a handy reference ever since. While it is intended as a companion to Aronson’s (free) software platform for strategy development, it contains numerous practical tips for any machine learning practitioner and I’ve implemented most of his ideas in R.

I used SSML to guide my early forays into machine learning for trading, and this series describes some of those early experiments. While a detailed review of everything I learned from SSML and all the research it inspired is a bit voluminous to relate in detail, what follows is an account of what I found to be some of the more significant and practical learnings that I encountered along the way.

This post will focus on feature engineering and also introduce the data mining approach. The next post will focus on algorithm selection and ensemble methods for combining the predictions of numerous learners.

http://robotwealth.com/machine-learning-financial-prediction-david-aronson/

PyThalesians – Open Source Financial Library

PyThalesians is a Python financial library developed by the Thalesians (http://www.thalesians.com). I have used the library to develop my own trading strategies and I’ve included simple samples which show some of the functionality including an FX trend following model and other bits of financial analysis.

There are many open source Python libraries for making trading strategies around! However, I’ve developed this one to be as flexible as possible in terms of what types of strategies you can develop with it. In addition, a lot of the library can be used to analyse and plot financial data for broader based analysis, of the type that I’ve had to face being in markets over the years. Hence, it can be used by a wider array of users.

At present the PyThalesians offers:

  • Backtesting of systematic trading strategies for cash markets (including cross sectional style trading strategies)
  • Sensitivity analysis for systematic trading strategies parameters
  • Seamless historic data downloading from Bloomberg (requires licence), Yahoo, Quandl, Dukascopy and other market data sources
  • Produces beautiful line plots with PyThalesians wrapper (via Matplotlib), Plotly (via cufflinks) and a simple wrapper for Bokeh
  • Analyse seasonality analysis of markets
  • Calculates some technical indicators and gives trading signals based on these
  • Helper functions built on top of Pandas
  • Automatic tweeting of charts
  • And much more!
  • Please bear in mind at present PyThalesians is currently a highly experimental alpha project and isn’t yet fully documented
  • Uses Apache 2.0 licence

https://github.com/thalesians/pythalesians

pytrader

pytrader is a cryptocurrency trading robot that uses machine learning to predict price movements at confidence intervals, and sometimes execute trades. It is programmed to work on the poloniex.com cryptocurrency platform.

Prettymuch, this:

I (@owocki) built this as a side project in January / February 2016, as a practical means of getting some experience with machine learning, quantitative finance, and of course hopefully making some profit ;).


3/26/2016 – My test portfolio was initialized with a 1 BTC deposit, and after 2 months and 23,413 trades, exited with 0.955 BTC. The system paid 2.486 BTC in fees to poloniex. CALL TO ACTION — Get this trader to profitability. A strategy is being fleshed out here.

https://github.com/owocki/pytrader

Stock Price Prediction With Big Data and Machine Learning

“This post is based on Modeling high-frequency limit order book dynamics with support vector machines paper. Roughly speaking I’m implementing ideas introduced in this paper in scala with Spark and Spark MLLib. Authors are using sampling, I’m going to use full order log from NYSE (sample data is available from NYSE FTP), just because I can easily do it with Spark. Instead of using SVM, I’m going to use Decision Tree algorithm for classification, because in Spark MLLib it supports multiclass classification out of the box…”

http://eugenezhulenev.com/blog/2014/11/14/stock-price-prediction-with-big-data-and-machine-learning/

Intro to Technical Analysis

“Looking back over this “Intro to Technical Analysis” series I have tried to cover a wide range of topics related to technical analysis without getting to deep into its complexities. Here is a list of the things we have covered…”

http://stocks.about.com/od/Technical-Analysis/fl/Intro-to-Technical-Analysis-Does-it-Work.htm
http://stocks.about.com/od/Technical-Analysis/fl/Intro-to-Technical-Analysis-Resources.htm
http://stocks.about.com/od/Technical-Analysis/fl/Intro-to-Technical-Analysis-The-Books.htm