Machine Learning for Trading

Machine Learning for Stock Trading, Forex Trading, Daytrading or even long-term investing is already here. You can opt to use a fee-based or performance based service and let them manage your money.

If, on the other hand, you are an active investor or trader, you might want to develop your own trading system with your own unique insights. This tutorial will shortly lay out the landscape of such a system. Also, in our On-Demand Course (Machine Learning for Trading) you can learn how to develop such a system on your own.

Data Source / API

First, you need data. Data is key for a machine learning System. Without proper data, nothing else matters. You can get free data from your broker (like Oanda). But with that data your chances to build a profitable system are slim.

It’s therefore advised to make use of paid alternative data. Such data can cost anywhere from 99$ per month to 4999$ per month or even higher. (Example: https://www.quandl.com/alternative-data)

Database

You’ll need to have your own database. For one, you want to save the data you pay for. You also want to save the manipulated data you create (e.g. when you compute the moving average or similar indicators). Also, you need to keep track of your trades, wins, losses, etc.

For this you want to use MySQL or NoSQL (MongoDB) database. If you don’t want to operate and manage a Database yourself, you should take a look at AWS RDS and Goole Cloud SQL Services. They’ll make your life easier in this aspect.

Machine Learning System

This is the actual brain of you system, the one that decides what to do with the incoming chunk of data from your data provider. Do you execute a trade? Do you close a current one? Do you do just nothing?

Your system can be a supervised machine learning model (like a neural net) or it can be an autonomous agent (see: Reinforcement Learning). The latter is gaining momentum in the algorithmic trading scene.

You want to host your system on a performant but most importantly a reliable Computing Machine. Here again, I advise you to use a Cloud Service (AWS EC2, Google Cloud Computer, MS Azure, …).

Backtest

Before you unleash your system onto your real account, you want backtest it. For this you need your own backtesting system or use a library for that (Example: https://pypi.org/project/backtrader/). Only after a backtest seems to be promising, should you release the system onto your demo account. And only after that onto your real account.

Execute Calls (Buy, Close, Change SL)

This is where the magic hits the real world. You need to keep a close eye on your system. If it fails for a few hours and you don’t notice it, it might leave a short trade that should have been closed. Automatic Alerts are a common thing in the Cloud Service Providers – they’ll even notify you via SMS.

Also, since your System will be running on the servers, without any User Interface, you should think about how you will get a current statement of your account. Maybe you have to build one yourself. Maybe your Broker has one.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.