JeeZues / TradeBot

GNU General Public License v3.0
4 stars 4 forks source link

TradeBot crashes after some/all futures accounts liquidate #16

Open derrey opened 3 years ago

derrey commented 3 years ago

Well I was not hoping to test this.. but with this latest dump.. the future accounts got liquidated. But while it was on its way down all the TradeBots crashed and could not get any current info. I think that you need to put some catch for this hopefully rare condition. It just seems to stick on the first one.


Using Binance Dave_Sub01 Futures USDT-M from exchange Binance Futures USDT-M

float division by zero Traceback (most recent call last): File "run.py", line 564, in ret = run_account(sub_account, bots) File "/mnt/TradeBot/timeout.py", line 18, in wrapper result = func(*args, *kwargs) File "run.py", line 257, in run_account margin_ratio = get_margin_ratio(account) File "/mnt/TradeBot/utils.py", line 142, in get_margin_ratio return float(a_data['totalMaintMargin']) / float(a_data['totalMarginBalance']) 100 ZeroDivisionError: float division by zero 00:01 - 2021-05-19 13:40:16

JeeZues commented 3 years ago

Yes, noticed that when my accounts started liquidating too and pushed a fix for it... not that it makes any difference now since I lost all my 4 accounts and have nothing left to test with :) Sadly I had everything in Futures... Was a fun ride though and hope what I have here helps you and other. I'll still be able to make changes to code but won't be able to test them much. Maybe I can create a branch that you can pull before I commit the changes to main branch

Hopefully the damage on your end wasn't that bad and u were actually diversified enough...

grumpydolphin commented 3 years ago

Yes, noticed that when my accounts started liquidating too and pushed a fix for it... not that it makes any difference now since I lost all my 4 accounts and have nothing left to test with :) Sadly I had everything in Futures... Was a fun ride though and hope what I have here helps you and other. I'll still be able to make changes to code but won't be able to test them much. Maybe I can create a branch that you can pull before I commit the changes to main branch

Hopefully the damage on your end wasn't that bad and u were actually diversified enough...

I just wanted to add my thanks for the script. It worked well for me, but unfortunately all my funds are also gone.

derrey commented 3 years ago

Yes, noticed that when my accounts started liquidating too and pushed a fix for it... not that it makes any difference now since I lost all my 4 accounts and have nothing left to test with :) Sadly I had everything in Futures... Was a fun ride though and hope what I have here helps you and other. I'll still be able to make changes to code but won't be able to test them much. Maybe I can create a branch that you can pull before I commit the changes to main branch

Hopefully the damage on your end wasn't that bad and u were actually diversified enough...

So sorry to hear that you lost it all. I did lose about 14 x 5K+ accounts in the process. But will live to fight another day. I will get the futures bots back up and running soon after 3C and Binance get things fixed back up. I really want to thank you for all your hard work and hope we can keep working together on this and maybe other projects. DM me on Telegram if you can... Please branch if you think that will help keep things intact.

Thanks Dave

JeeZues commented 3 years ago

Sorry to hear about your loss. I guess I will have to get on Telegram at some point lol I'm not planning to stop tinkering with this so for sure, keep any ideas coming. But with little testing I will be able to do I will count on you and the community to do a bit more in this regard. feel free to email me at my username and g....com :) Issac tells me you are 519, are you by any chance from KW?

derrey commented 3 years ago

Sorry to hear about your loss.

I guess I will have to get on Telegram at some point lol

I'm not planning to stop tinkering with this so for sure, keep any ideas coming. But with little testing I will be able to do I will count on you and the community to do a bit more in this regard.

feel free to email me at my username and g....com :)

Issac tells me you are 519, are you by any chance from KW?

Ya. My number was from KW, but now in Milton. :)

JeeZues commented 3 years ago

At least technically you are not in the GTA :)

vssnake commented 3 years ago

Sorry to hear about your loss. I guess I will have to get on Telegram at some point lol I'm not planning to stop tinkering with this so for sure, keep any ideas coming. But with little testing I will be able to do I will count on you and the community to do a bit more in this regard. feel free to email me at my username and g....com :) Issac tells me you are 519, are you by any chance from KW?

Count with my testing I was able to save half of my two accounts.

JeeZues commented 3 years ago

Sounds good. We at least have 3 testers now :) Glad you were able to salvage something :) I created this branch https://github.com/JeeZues/TradeBot/tree/development that I will push to once I make changes before I merge them into main branch for others to consume.

Thank you

herveyy commented 3 years ago

Hi All - also same as yourselves had 3 accounts liquidated with the recent dump. So I have been looking at using your fantastic script moving forward. Spoke to Isaac who mentioned you may have had this option before but couldn't find it, can you market close all positions and disable all bots at a preferred margin size. Or anything along those lines in terms of risk management. Apologies not a github guy so not sure if I am supposed to open new issue or something.

Also happy to join you guys with supporting the testing :-)

JeeZues commented 3 years ago

Hi @herveyy, Sorry to hear you too got liquidated. I think anyone who was active during the dump got liquidated. I would prefer each new feature/issue has its own thread. I have a standalone script that stops all bots. That said, once you reach the --stop_at limit, all bots will be stopped. Regarding panic closing positions. I had code that does that when a deal has an error and was in the +ve profit, that code is now commented out though. It will be hard to come up with logic on when to panic close positions. Feel free to start a new thread with conditions you think would be appropriate to do that in. Wouldn't be much work to add such an option...