How to trade with machine learning [Binance, FTX, Alpaca, Interactive Brokers]

Swiss33
6 min readSep 6, 2022

--

This short article explains how you can create your machine learning models and deploy them to predict the stock, forex and crypto market 24/7. It is divided into 4 parts depending on your trading platform: Binance, FTX, Alpaca and Interactive Brokers. If you don’t like to read, you can check out the equivalent of this article in video form here: https://www.youtube.com/watch?v=umIxeznWWDw.

Otherwise, enjoy reading.

Trading with machine learning on Binance

First, go to swiss33.com and create an account. Then create a model here that uses Binance as a data source. To understand how to create a model, you can read this documentation. Once you created your model, you can train & backtest it. Once you’ve backtested it, you get a report like that :

Backtest report

To understand how to interpret this report, you can read the documentation. But to make it simple, this model sounds really good. Once you’re ok with your model, let’s create a trading bot. Go here and create your bot that uses your previous model and connect it to Binance. Then choose between the paper and the live mode. To get paper mode API keys, go here, and to get live mode API keys, go to you Binance account. Save you bot, then power it on. Then, after some time, you’ll get some data like that:

Orders executed by the machine learning trading bot

This is a record of the last 20 orders fired by the bot. As you can see, it sounds pretty good. To have an overview of all your bots and their profits related to each models, you can go to your dashboard here.

Trading with machine learning on FTX

First, go to swiss33.com and create an account. Then create a model here that uses FTX as a data source. To understand how to create a model, you can read this documentation. Once you created your model, you can train & backtest it. Once you’ve backtested it, you get a report like that :

Backtest report

To understand how to interpret this report, you can read the documentation. But to make it simple, this model sounds really good. Once you’re ok with your model, let’s create a trading bot. Go here and create your bot that uses your previous model and connect it to FTX. Then choose between the paper and the live mode. No API keys are required for the paper mode. To get live mode API keys, go to you FTX account. Save you bot, then power it on. Then, after some time, you’ll get some data like that:

Orders executed by the machine learning trading bot

This is a record of the last 20 orders fired by the bot. As you can see, it sounds pretty good. To have an overview of all your bots and their profits related to each models, you can go to your dashboard here.

Trading with machine learning on Alpaca

First, go to swiss33.com and create an account. Then create a model here that uses Alpaca as a data source. To understand how to create a model, you can read this documentation. Once you created your model, you can train & backtest it. Once you’ve backtested it, you get a report like that :

Backtest report

To understand how to interpret this report, you can read the documentation. But to make it simple, this model sounds really good. Once you’re ok with your model, let’s create a trading bot. Go here and create your bot that uses your previous model and connect it to Alpaca. Then choose between the paper and the live mode. To get paper / live mode API keys, go to you Alpaca account, genereate them and copy / paste them. Save you bot, then power it on. Then, after some time, you’ll get some data like that:

Orders executed by the machine learning trading bot

This is a record of the last 20 orders fired by the bot. As you can see, it sounds pretty good. To have an overview of all your bots and their profits related to each models, you can go to your dashboard here.

Trading with machine learning on Interactive Brokers

First, go to swiss33.com and create an account. Then create a model here that uses Interactive Brokers as a data source. To understand how to create a model, you can read this documentation. You will be asked to enter your Trader Workstation login address. To do this, you must have an Interactive Brokers account. Also, you need to download the Trader Workstation here. Finally, create an Ngrok account and download the software. Launch Trader Workstation live if you want to trade live, and paper if you want to trade paper. Once you are logged in to your Trader Workstation, go to settings>API>settings then:
- check “Enable ActiveX and Socket Clients
- uncheck “Read-only API”.
- register the Socket port (by default 7497 for paper, and 7496 for live)

Once this is done, go to your terminal and type …

ngrok tcp 7497

… to redirect your localhost to an address accessible by Swiss33.
Copy this address and paste it into Swiss33 in the “Trader Workstation’s connection” section. Then continue to create your model as like the other platforms. Once you created your model, you can train & backtest it. Once you’ve backtested it, you get a report like that :

Backtest report

To understand how to interpret this report, you can read the documentation. But to make it simple, this model sounds really good. Once you’re ok with your model, let’s create a trading bot. Go here and create your bot that uses your previous model and connect it to Interactive Brokers. To trade in paper mode, login to your TWS in paper mode. To trade in live mode, login to your TWS in live mode. Your TWS and Ngrok must be on during all the training and trading process. Save you bot, then power it on. Then, after some time, you’ll get some data like that:

Orders executed by the machine learning trading bot

This is a record of the last 20 orders fired by the bot. As you can see, it sounds pretty good. To have an overview of all your bots and their profits related to each models, you can go to your dashboard here.

--

--