Krypto-trading-bot: BitMEX - Got Some Negative Values - Depleted Funds On Both Sides

Created on 22 Jul 2019  Â·  15Comments  Â·  Source: ctubio/Krypto-trading-bot

It says depleted funds on both the bid and the ask side, then after rebooting I got this error;

K exit code 1.
K crashed with exit code 1.. Respawning..
K-trading-bot linux-x86_64 2019-07-22 02:54:12.
v0.5.3+53 (0day).
07/22 11:18:34.388796 CF Outbound IP address is 46.101.166.124.
07/22 11:18:34.389736 GW BITMEX cached handshake:

  • gateway: https://www.bitmex.com/api/v1
  • gateway: wss://www.bitmex.com/realtime
  • autoBot: no
  • symbols: XBT/U19 (0.00000001/0.0000001)
  • minSize: 1 Contract
  • makeFee: -0.05%
  • takeFee: 0.25%.
    07/22 11:18:34.390543 DB loaded OK from /var/lib/K/db/K-trading-bot.BITMEX.EOS.U19.db.
    07/22 11:18:34.393150 DB loaded last Quoting Parameters OK.
    07/22 11:18:34.393535 DB Warrrrning: consider to warm up some EWMA Values.
    07/22 11:18:34.394368 DB loaded 344 historical Fair Values.
    terminate called after throwing an instance of 'nlohmann::detail::type_error'
    what(): [json.exception.type_error.302] type must be number, but is null
    07/22 11:18:34.677433 Errrror: Aborted (Three-Headed Monkey found):
  • exchange: BITMEX
  • currency: EOS/U19
  • binbuild: K-trading-bot linux-x86_64
  • lastbeat: 0.071329
  • tracelog:
    15: K-trading-bot(_start+0x2a) [0x55a5730029fa]
    14: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7efe85a20b6b]
    13: K-trading-bot(main+0x22) [0x55a573001502]
    12: K-trading-bot(_ZN3â‚¿11KryptoNinja4mainEiPPc+0x52f) [0x55a573001e3f]
    11: K-trading-bot(_ZN3â‚¿6Sqlite7backupsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_+0x5be) [0x55a57304ff1e]
    10: K-trading-bot(_ZN3â‚¿6Sqlite12StructBackupINS_7mTargetEE4pullERKN8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS4_14adl_serializerEEE+0x11b) [0x55a5730532fb]
    9: K-trading-bot(_ZNK8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS_14adl_serializerEE5valueIdLi0EEET_RKS8_RKSC_+0x73) [0x55a573049d23]
    8: K-trading-bot(_ZN8nlohmann6detail20get_arithmetic_valueINS_10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS_14adl_serializerEEEdLi0EEEvRKT_RT0_+0x122) [0x55a573049c22]
    7: K-trading-bot(+0x4e2e54) [0x55a573374e54]
    6: K-trading-bot(+0x4e2f11) [0x55a573374f11]
    5: K-trading-bot(_ZN10__cxxabiv111__terminateEPFvvE+0x6) [0x55a573374ed6]
    4: K-trading-bot(+0x16c97d) [0x55a572ffe97d]
    3: /lib/x86_64-linux-gnu/libc.so.6(abort+0x121) [0x7efe85a1f535]
    2: /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7) [0x7efe85a3ded7]
    1: /lib/x86_64-linux-gnu/libc.so.6(+0x43f60) [0x7efe85a3df60]
    0: K-trading-bot(_ZN3â‚¿6Ending3wtfEi+0x419) [0x55a573061be9]
acknowledged bug

All 15 comments

umf iSee, it fails to set the leverage when positions are already opened; hope for a fix this afternoOn

about the negative balance, i need to investigate morr to understand what is expected

i was not able to reproduce yet this exact error;

maybe rm -f /var/lib/K/db/K-trading-bot.BITMEX.EOS.U19.db helps? (it will if those null values are stored in the database)

appart from the null profit issue you pasted (that i hope is in your database) i had fixed buncha more BitMEX issues but still need to fix more so allow me to not commit yet

Haha, didn't see this till after I removed the database. That fixed it. Also updated to the latest commit. I'll be testing as soon as some more test funds get into the account. I misunderstood TBP I think and blew my last test funds.

TBP is in bitcoin, not in contracts like the bid size?

that is right, TBP value is in XBT currency (not in Contracts)

image

I know you aren't done fixing stuff yet, but while it loads now, I still see the depleted funds issue. I have no trades open on the exchange. It looks like it isn't calculating the EOS balance correctly.

Still on reboot I'm getting this error again too, so I'm guessing whatever value that's messed up causing the depleted funds issue is getting stuck in the database.

Not sure this fixed it, still showing 0 balance in EOS. Am I doing something wrong?

im not sure without more info :S i can see wallet data fine while using API_CURRENCY=EOS/U19

you see some balance on API_CURRENCY=XBT/USD but 0 balance on API_CURRENCY=EOS/U19?

Yeah. I have 0.01 XBT on and 0.0000042 on U19, should be closer to 25 in
U19.

On Mon, Jul 22, 2019 at 7:24 PM Carles Tubio notifications@github.com
wrote:

im not sure without more info :S i can see wallet data fine while using
API_CURRENCY=EOS/U19

you have some balance on API_CURRENCY=XBT/USD but 0 balance on
API_CURRENCY=EOS/U19?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/ctubio/Krypto-trading-bot/issues/964?email_source=notifications&email_token=ABTMUZG7DVCKT3OZHTULHNTQAY6RFA5CNFSM4IFXRXSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2ROGTI#issuecomment-513991501,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABTMUZCCBBWYEQGGPIR4AQLQAY6RFANCNFSM4IFXRXSA
.

Sorry for opening the other thread, not sure if you see replys once the issue is closed.I'll show you some pics.
image
image

ah you mean now the numbers under Value:, the 0.0000040 is what is wrong? (cos i believe numbers under XBT: are correct)

Yes, XBT : is correct, it's the Value: that is wrong. The first number is correct, but the second is wrong. I think that might be what's stopping it from trading. If it's reading the value as both 0.9963 ~$100 USD equivalent, and 0.0000040, ~$0.000016 USD equivalent at the same time.

well i see that the calculation should be on EOSU19: available wallet / market price
but on XBTUSD the calculation should be: available wallet * market price

im just not sure yet how to know when to apply one calculation and when to apply the other; lemme see the differences of https://www.bitmex.com/api/v1/instrument?symbol=EOSU19 and https://www.bitmex.com/api/v1/instrument?symbol=XBTUSD oor otherwise find out where is the difference :S (hope for tomorrow zZzzzzz)

:koala: many thanks for all your help reporting issues''''

Perhaps there is some code in here that can help: https://github.com/BitMEX/sample-market-maker

ok found it https://github.com/BitMEX/sample-market-maker/blob/3bd34fcc4a9eaefd0da30690b4d642c1f0c6bcc5/market_maker/market_maker.py#L107-L116

so isInverse that may be true|false is the condition to multiply or to divide quantities and prices

XBTUSD has isInverse=true (multiply)
EOSU19 has isInverse=false (divide)

:koala: moar info at https://blog.bitmex.com/why-quanto/

(thanks again'¡)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Corfucinas picture Corfucinas  Â·  5Comments

juaxix picture juaxix  Â·  4Comments

wulabs picture wulabs  Â·  3Comments

rscott7 picture rscott7  Â·  4Comments

adirta picture adirta  Â·  4Comments