ctubio / Krypto-trading-bot

Self-hosted crypto trading bot (automated high frequency market making) written in C++
https://127.0.0.1:3000
Other
3.37k stars 823 forks source link

Gdax - works for some time then stop #195

Closed Jorman closed 7 years ago

Jorman commented 7 years ago

Like always ... I don't know if this kind of problem is only for Gdax or not.

I saw that the server ram is very good, so I started the bot without any cron for a restart, like 1 or 2h, but every time I found the bot "freeze".

I tried to make a log, I don't think is very helpfull but ...

18:32:36.229725 CF settings loaded from JSON file gdax-btc-eur-3000 OK.
18:32:36.625533 UI ready over HTTPS on external port 3000.
18:32:47.358257 GW Coinbase allows client IP.
18:32:47.365260 GW Coinbase:
- autoBot: yes
- pair: BTC-EUR
- minTick: 0.01000000
- minSize: 0.01000000
- makeFee: 0.00000000
- takeFee: 0.00000000
18:32:47.553819 DB /data/db/K.3.0.2.db loaded OK.
18:32:48.229983 DB loaded Quoting Parameters OK.
18:32:48.279748 DB loaded 16 historical Trades.
18:32:48.340909 DB loaded 49 STDEV Periods.
18:32:48.373213 DB loaded EWMA Long = 4093.17195604.
18:32:48.376193 DB loaded EWMA Medium = 4095.61282788.
18:32:48.379442 DB loaded EWMA Short = 4095.61282788.
18:32:48.394866 DB loaded TBP = 0.02770532 BTC.
18:32:50.168057 GW Coinbase FIX success Logon.
18:33:03.896228 GW Coinbase WS Error, reconnecting..
18:33:04.042 main Event loop delay 7700ms
18:33:05.447 main Event loop delay 300ms
18:33:05.583002 1 UI currently connected, last connection was from ::ffff:188.155.170.75
18:33:06.540276 GW Coinbase WS Streaming book levels.
18:33:06.548849 GW Coinbase Changed quoting state to Enabled.
18:33:13.839 main Event loop delay 6800ms
18:33:16.071 main Event loop delay 1700ms
18:33:18.364 main Event loop delay 200ms
18:33:21.828 main Event loop delay 200ms
18:33:26.878 main Event loop delay 300ms
18:33:28.125 main Event loop delay 200ms
18:33:30.909 main Event loop delay 1700ms
18:33:46.768 main Event loop delay 2500ms
18:34:02.318 main Event loop delay 2900ms
18:34:08.197 main Event loop delay 200ms
18:34:17.094 main Event loop delay 2900ms
18:34:18.288 main Event loop delay 300ms
18:34:23.924657 TBP 56% = 0.02781783 BTC
18:34:24.133 main Event loop delay 200ms
18:34:31.142 main Event loop delay 1600ms
18:34:40.534 main Event loop delay 500ms
18:34:45.884 main Event loop delay 1500ms
18:34:47.216 main Event loop delay 300ms
18:34:51.783 main Event loop delay 300ms
18:34:54.257 main Event loop delay 300ms
18:34:56.754 main Event loop delay 300ms
18:34:58.168 main Event loop delay 400ms
18:34:59.053 main Event loop delay 300ms
18:35:02.644 main Event loop delay 3000ms
18:35:04.451 main Event loop delay 500ms
18:35:07.477 main Event loop delay 200ms
18:35:11.204 main Event loop delay 400ms
18:35:17.749 main Event loop delay 3400ms
18:35:19.635 main Event loop delay 300ms
18:35:20.961 main Event loop delay 200ms
18:35:31.512 main Event loop delay 2000ms
18:35:46.541 main Event loop delay 1700ms
18:35:52.324 main Event loop delay 400ms
18:35:55.765 main Event loop delay 300ms
18:36:01.946 main Event loop delay 2300ms

18:55:37.347435 Excellent decision! When Chuck Norris break the build, you can't fix it, because there is not a single line of code left.
18:55:39.234012 GW Coinbase Attempting to cancel all open orders, please wait..

As you can see, at certain point freeze, and freeze too the CTRL+C ... strange

ctubio commented 7 years ago

im not sure how to reproduce this, my coinbase bots looks fine; ima try to look carefully on them

Jorman commented 7 years ago

I try to make a clean installation, maybe help, I'll report the result

Jorman commented 7 years ago

After a reinstall, seems better but freeze after some h.

Do you think is better to cron a restart? I don't want to "risk" that at every restart the bot try to start from scratch and don't consider the history like ewma or Others, for example if the bot right before the restart is trying to sell some, after a restart what happen? Try to sell again or restart and try to buy? I don't know if I explained myself in a good way

J

Jorman commented 7 years ago

Nope, even with the last commit, after some, hours or minutes stop working, what I can do to make a good log to check?

ctubio commented 7 years ago

ewmas should continue after restart cos are saved in the database

Jorman commented 7 years ago

Ok, tnx.

Do you have any idea how about I can make a more complete log?

ctubio commented 7 years ago

not sure what you mean by "complete log" just run the application in the foreground instead that in the brackground to see the log

Jorman commented 7 years ago

I can't see nothing, buy I only see that a certain point stop working, no error nothing, and after 5 minutes (because cxl?) the order on gdax is cancelled but with no confirmation on console.

With complete log I mean, is possible run the bot and have more log data to "understand" why freeze? Maybe is ubuntu 16.04?

***EDIT nope, even with debian on vmachine on localhost aaa

Jorman commented 7 years ago

A little news

I tried on gdax with AK-47. Whit this algo works, don't freeze and I works good too with the cron to restart every 30 min

So if I use Top or PingPong, the bot freeze

Hope can help in anyway.

ctubio commented 7 years ago

many thanks for the infos, still i was not able to reproduce it; but i was trying with Boomerang, lemme see Top

Jorman commented 7 years ago

Hi, tnx! I think is related to this https://github.com/ctubio/Krypto-trading-bot/issues/202

Here the log


gw.h                                          85             0xda7b9

terminate called after throwing an instance of 'std::domain_error'
  what():  cannot use value() with number
08:27:38.644204 Errrror: Signal 6 Aborted (Three-Headed Monkey found).
Jorman commented 7 years ago

With the very last commit also bitfinex have some problem

10:39:20.152922 TBP 0% = 0.00000000 IOT
BitfinexBook
terminate called after throwing an instance of 'std::domain_error'
  what():  type must be string, but is null
mgcyung commented 7 years ago

The same problem in OkCoin

OkCoin Trades
  terminate called after throwing an instance of 'std::domain_error'
    what():  cannot use value() with null