Posts

Building a Trading Bot from Scratch

avatar of @leoplaw
25
@leoplaw
·
·
0 views
·
2 min read

I set the Gekko trading bot up a couple of months back, it made some trades, I came out with 33% profit. But I kept tinkering with things and added a couple of other bot instances to the server. (got greedy) I waited, waited, waited, and waited with no trades happening. I thought because the price was continually on the rise, it wouldn't trade until a bigger dip.

Then I check against the back testing, and it should have done multiple trades over that period. I then took the bot of line... when the big dump happened, and missed it. I waited and put it back online... still nothing.

Then recently I had the idea, what if I reduced the instances of the bot to only one.

BINGO! The bot was trading again. Then I seemed to have remembered some discussion buried on a forum about needing multiple servers to run multiple instance of the bot.

D'oh!

Currently it's made a small profit again, I'm checking it regularly. When after say a month of trades, I'll share with you the results.

In the meantime I am looking at extra hosting options to set up more bot instances.

Programming My Own Bot

Beyond that I am still developing my own bot. It seemed like a simple project on the surface, but it's quickly revealed itself to a complicated machine with many "moving" parts that need to mesh together. So much time has also been devoted to just thinking it through and documenting it so I have a structured plan of what parts rely on each other, thus giving me an order components to develop.

On top of that, I've had to get up to speed with programming Node.js, which I've now more or less accomplished.

There's no pretty interface yet, just text being printed to the command line to tell me what it's doing.

Currently it validates the inputs for the trading strategy, connects to the exchange and downloads the price history for a given time span and stores in the database. Now I am gong to connect it up to the live price feed and feed that to the trading strategy.

Next steps:

  • Have the strategy process the prices.
  • Decide to short, long or wait
  • Store the trades (paper only atm.) in a journal (data base)
  • Add back testing (stored prices, no live) ... (store this?)
  • Live trading (against a test net first)

This will be V 1.0 alpha

A major difference will be, unlike the Gekko trading bot, it should be able to run multiple instances on the server.

After this I will start on the graphical user interface.

It will come with a number of basic trading strategies that I will port from Gekko. If you have programming knowledge you will be able to write your own for it and back test them before running them live.

Further down the line are plans to enable more complicated trading strategies.

This will keep me busy for a while, but in the mean time, I'll still have Gekko trading for me.

Posted Using LeoFinance Beta