Bitcoin Forum
May 08, 2024, 10:51:36 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Development blog] Algorithmic trading bot | follow the project and comment  (Read 798 times)
Zaeccis (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 21, 2017, 11:46:17 AM
Last edit: August 28, 2017, 10:11:37 AM by Zaeccis
 #1

Hello everyone!


1st update: https://bitcointalk.org/index.php?topic=2107831.msg21154507#msg21154507
2nd update: https://bitcointalk.org/index.php?topic=2107831.msg21275997#msg21275997



I've been lurking on this forum for a while now and thought it would be fun to share my project with you guys and get some comments and suggestions.
So what I'm doing here is writing an algorithmic trading bot from scratch. I'm not a seasoned  coder and one of the main reasons for this project is learning and getting better at coding.
I've been doing this for couple of weeks now, but because of all the stuff in my life, the progress hasn't been too fast. And I can make no promises for how quickly this is going go forward.
I plan to update this thread every time I get something new to show or talk about, meanwhile I'd really like to see what you think about what I'm doing and if you have some ideas or comments.

So, let me introduce you to:

                                               CoinBot

(okay that looks horrible, like some beginning of 2000s web font)




So how's the Bot doing at the moment?

I'm going to use Binance as my current exchange, although I plan to add more in the future. Reasons why I chose this is because their solid API, good volume and especially their low fees.
The Bot is going to make lots of trades with low profit marking so fees make a big difference here. Almost all US or EUROPE based exchanges have something like (0.25%/0.15%) fees (those are taker/maker).
Meanwhile binance has 0.1%/0.1% and those can even be reduced by 50% for the first year of trading through their BNB system. So for one buy/sell cycle I only have to pay 0.1% compared to 0.4% of these better known exchanges.

Language I'm developing this with is scala. Here the main reason is that it's the only language I know well enough Cheesy
For Graphical UI I'm using ScalaFX which is basically wrapper for java's JavaFX, well documented and widely used UI library.

I've been mainly doing the backend and implementing Binance's API and making it easy to use inside the program. On the frontend I have basic groundwork done and runnable base on top of which to build the GUI.
Now it only has terminal output implemented where bot gives updates while it's running and shows errors.

So we're at the very beginning and I'm really exited to see where this leads!
Give me your thoughts and See you soon with first update!


Oh, and have some screenshots:


http://imgur.com/kbQLDtT
http://imgur.com/G0ws1Ta




1715165496
Hero Member
*
Offline Offline

Posts: 1715165496

View Profile Personal Message (Offline)

Ignore
1715165496
Reply with quote  #2

1715165496
Report to moderator
1715165496
Hero Member
*
Offline Offline

Posts: 1715165496

View Profile Personal Message (Offline)

Ignore
1715165496
Reply with quote  #2

1715165496
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Zaeccis (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 24, 2017, 08:11:22 AM
 #2

Well, the amount of comments here isn't exactly what I was hoping for Grin,
but maybe we get this going

Anyway, Here is the first update on progress I've made.

http://imgur.com/vWcgw8w


So I finished implementing the API and now I have the core trading loop set up.
What it does is every 5 minutes (or 10min or 4h or whatever you set the candle size) it retrieves latest data, executes the algorithm based on that and previous data and the goes back to waiting for new candle
The biggest problem so far is binance API, It's only couple of weeks into beta and semi-frequently connection times out. For now I've solved this so that program tries again until it gets data. It always works within 10secs of first connection error. This has no effect on trading with cycle frequency of 1min or more but it means HFT is yet no-go. Although HFT wouldn't really be feasible anyway with basic http API or with exchange on the other side of world.

Also now I have Stoplimit feature! It watches your balance of currency pair you are trading and if it falls more than x% bot stops trading.

next I'll try to ease my own work and set up working settings page, so I don't have to change all the values in code anymore but can do it from actual GUI

See you with the next update!

yoona
Sr. Member
****
Offline Offline

Activity: 493
Merit: 250


Live by your own rules


View Profile
August 24, 2017, 11:44:50 AM
 #3

Hi, I'm working on a bot on Binance aswell at the moment! I'm working in php and javascript (ajax/jquery) mostly. Can you explain how you were able to sign your request to your own api? I'm successfull at implementing the public websocket but i cant seem to get the private signed part working...

Looking forward to your progress!

Zaeccis (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 25, 2017, 09:04:58 AM
 #4

@yoona

I'm sorry but I haven't made myself familiar with websocket API but instead settled with basic Http APi which was well documented and rather easy to use.

Maybe if all-websocket isn't must you could use http for private calls (orders, balance checking etc.) and websocket for data retrieval as you already have it working.

If it's Http APi you are having trouble with, then I might know better how to help.
Zaeccis (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 28, 2017, 10:10:02 AM
 #5

Another update! YAY!

Okay, here again. I made very simple settings tab where I can change settings and kind of reset the bot to state it is after launching, but with new settings in use.
That tab looks so empty right now but I imagine it will gradually fill with new settings. Now you can change used algorithm, trading pair, stoplimit and candle size.

Now you can see the bot actually running! (1st screenshot) WHOO! what a success Grin
Right now it just fetches new data every x minutes and on every cycle runs algorithm which follows 4 and 10 candles long moving exponential averages and makes buying and selling decisions based on them crossing each other. It gets to trade some serious money already! Okay actually it just trades 4€ worth of BNB and this is like the most basic TA trading strategy there is, so I don't expect it to make any money, propably loses little bit every day.
Point of all of this is to test the core trading loop and find possible errors the bot could run into.

Bot already makes and collects candle data and two different EMAs and next I plan to implement some way to draw these into chart.
I'm not sure yet if I'll use javafx chart tools or maybe google charts or something else.
Also I have some boring stuff to take care of like handling errors binance might throw (like when your balance is too low for trade to be executed). Now program just crashes if something unexpected happens. Hence the testing I'm doing right now.


https://i.imgur.com/R46r0pi.png
https://i.imgur.com/HAdxjd2.png


Tell me what you think and see you (hopefully soon) with next update!
ACDataScientist
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
January 18, 2018, 07:42:39 PM
 #6


I'm a seasoned data scientist and scraper who's doing it in Python/Pandas. For someone like me who's learning time series and market prediction, I really recommend the Quantopian lectures on Youtube. I assume there are Wall St quants out there doing the same thing but I hope to beat them with novel data sources and novel approaches. But I'm learning the basics of being a quant first anyway.
Jantapw
Copper Member
Full Member
***
Offline Offline

Activity: 364
Merit: 101



View Profile
March 28, 2018, 04:58:41 PM
 #7

Would also suggest you to try GUNBOT from https://tradingbotpro.com
one of the best trading bot for binance, bittrex and other exchanges
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!