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.32k stars 819 forks source link

Kraken Bot freezing and Errrror: Segmentation fault (Three-Headed Monkey found) #990

Closed JakeFit closed 3 years ago

JakeFit commented 5 years ago

Got the below issues running in a docker container. Bot also freezes a lot after a short amount of run time, generally freezes with a 0 size order for a cost of 0 but does also freeze with the last cancelled order as well.

As a test, i tried to submit an order while it was frozen in the described state, the bot then crashes. image

Besides that, the below error seems to happen randomly.

08/26 13:16:46.111123 Errrror: Segmentation fault (Three-Headed Monkey found):
- exchange: KRAKEN
- currency: XRP/USD
- binbuild: K-trading-bot linux-x86_64
- lastbeat: 30.149288
- tracelog:
  11: K-trading-bot(_start+0x2a) [0x560aa010904a]
  10: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7fcc0a63709b]
  9: K-trading-bot(main+0x1e) [0x560aa010624e]
  8: K-trading-bot(_ZN3₿6Events4walkEv+0x7f) [0x560aa0117fff]
  7: K-trading-bot(_ZNK3₿9WebServer8Frontend4ioWsMUlvE_clEv+0xf5) [0x560aa0121a85]
  6: K-trading-bot(_ZNSt17_Function_handlerIFNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_RKS5_EN3₿6Client7messageMUlS5_S7_E_EE9_M_invokeERKSt9_Any_dataOS5_S7_+0x50) [0x560aa016bce0]
  5: K-trading-bot(_ZNK3₿6Client7messageMUlNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS6_E_clES6_S8_+0x68f) [0x560aa016bb0f]
  4: K-trading-bot(_ZN3₿7tribeca20ButtonSubmitNewOrder5clickERKN8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerEEE+0x1d7) [0x560aa0156937]
  3: K-trading-bot(_ZNK3₿6Client7clickedEPKNS0_9ClickableERKN8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS4_14adl_serializerEEE+0x90) [0x560aa011a9b0]
  2: K-trading-bot(_ZNSt17_Function_handlerIFvRKN8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS0_14adl_serializerEEEEZN3₿7tribeca6BrokerC4ERKNSF_11KryptoNinjaERKNSG_13QuotingParamsERNSG_6OrdersERKNSG_7ButtonsERKNSG_12MarketLevelsERKNSG_14WalletPositionEEUlSD_E_E9_M_invokeERKSt9_Any_dataSD_+0x3eb) [0x560aa015236b]
  1: /lib/x86_64-linux-gnu/libc.so.6(+0x37840) [0x7fcc0a64a840]
  0: K-trading-bot(_ZN3₿6Ending3wtfEi+0x293) [0x560aa0168103]
JakeFit commented 5 years ago

e.g. image

This warning is also received frequently: GW KRAKEN Warrrrning: CURL Request Error: Timeout was reached.

ctubio commented 5 years ago

moring''' thanks for the report; seems this crash is when ButtonSubmitNewOrder is clicked (as seen in your pasted tracelog)

but it may happen anytime kraken api is used if you say that is so fequent :S

:koala: lemme rereview the manual submit button and other api calls on kraken soOn''

JakeFit commented 5 years ago

Thank you!! I've been struggling with this issue for a while. In just under 24 hours of trade time, the bot has successfully executed 6 trades because it keeps stopping like in the screenshot above. I originally thought it was my lack of knowledge, but even with the most basic settings it still happens.

I think it may have also triggered Kraken's Cloudflare protection because I can't login to Kraken via a sign-in window anymore. I'm talking to them about getting it removed. Lel

ctubio commented 5 years ago

about the rate limits, is expected as long as Kraken does not suport order data over websockets, we are waiting for it at https://github.com/ctubio/Krypto-trading-bot/issues/893

to avoid it for now one option is to use --lifetime argument

ctubio commented 3 years ago

:koala: this was fixed at https://github.com/ctubio/Krypto-trading-bot/commit/5990dda8ad4b83dd0b26bff05f3964b6a110c072, sorry for taking so long