CryptoGnome / Bybit-Lick-Hunter-v4

Lick Hunter is a free trading bot for Bybit built in Node.
118 stars 54 forks source link

added error handling in getBalance() #31

Closed rush0815 closed 1 year ago

rush0815 commented 1 year ago

Returncode will be checked; bot will shut down if an error occures

CryptoGnome commented 1 year ago

Great on the error handling, but have we found out why this is happening? image @Bennch mentioned his happens with new API keys?? I asked is this because no order history exists on the api key it will return no data because it does not have an entry in their DB yet? maybe we need to look for this order and open and close a min position on BTC to create the entry for them on new accounts?

rush0815 commented 1 year ago

I never had any problems by changing the API key. From your statement I gather that the orders are referenced to the API key. I don't know but that sound strange. The keys have relations to the useraccount. So it should not matter if you use a new one or not. The error @Bennch get looks like a timing issue (recv_windows=5000)? Bybit API says error 10003 = invaid API key. Thats not the case here. 10004 = signing error = API key is correct. So there must be another reason. Timout sound plausible for me.

My intention was to integrate the error handling so that the user out there can tell the correct error code for better debugging. The modification prints the API errorcode and ret_msg to console.