ctubio / tribeca

Self-hosted crypto trading bot (automated high frequency market making) in node.js, angular, typescript and c++
https://127.0.0.1:3000
Other
95 stars 26 forks source link

Improvement/ Bug fixe Cancel all open orders #64

Closed Camille92 closed 7 years ago

Camille92 commented 7 years ago

Hello Carles and everyone,

Given #59 #60 (I think) and the numerous "ghost orders issues" we had in the past.

And given that Tribeca has a built-in cancel all open orders on boot function.

Why not proposing as an option to cancel all orders every 5 minutes all the time. I was thinking about the pros and cons of it and I came to this conclusion:

Cons: You might miss a trade during the milliseconds orders are canceled. Harder to see bugs if they happen

Pros: It's a durable and radical solution. It seems inevitable to have small issues with orders from time to time. Given that one tribeca can send up to 2000 orders a minute, it is logical that at some point some are not handled correclty (can be tribeca's or server's fault). It solves the past, present, and future issues before they can have a negative impact on trading.

Well anyway I think it's a useful small feature that can really help and should not be hard to do as everything is already in tribeca :)

ctubio commented 7 years ago

morning Camille'¡ another little consequence of this is that then you can't have orders manually created in the exchange using the exchange website, because all they will be canceled every 5 min.

So maybe we can add a small checkbox? so ppl can choose to disable it in case they need to place manualy orders in the exchange too? ima go for that solution with the en/disable checkbox unless you disagree :P

Camille92 commented 7 years ago

It's perfect! Thank you for that :)

Camille92 commented 7 years ago

Hello and good morning,

After letting this version running for the night, the cancel orders has been working perfectly on all market but ETH/BTC where one order stayed for over 5h.

Any idea what can cause that issue ?

Cheers!

ctubio commented 7 years ago

donno, didnt experienced it; for me the 5min timeout always worked as far as i saw

it was open in tribeca and in the exchange? or only in one platform?

thanks'¡

Camille92 commented 7 years ago

Yes exactly.

I updated the Tribeca yesterday night and set them up with the 5mn timeout. Then in the morning, I came to check on the exchanges if there are not "weird" orders. And I found a 5h old order on ETH/BTC on Coinbase. A part from that everything seemed to get canceled properly :)

ctubio commented 7 years ago

i will carefully look for this, but let me keep the issue closed since seems working aaaaalmost always (always if you ask to me) ty'¡

Camille92 commented 7 years ago

For sure!

Maybe I'm doing something wrong from my side !

ctubio commented 7 years ago

nah, what it does in all gateways is to connect to the exchange to get a list of current open orders and later cancel them all one by one using http calls, in case there are more than 20 orders, maybe only the first 20 open orders found are only closed, but the rest if any should be closed in the next 5min timeout

i belive we cannot do it better xD (the 20 limit is because calls/seconds limit in the http APIs)