yasinkuyu / binance-trader

💰 Cryptocurrency Trading Bot for Binance (Experimental)
2.51k stars 828 forks source link

Insufficient balance & panic selling #124

Open tapir1 opened 6 years ago

tapir1 commented 6 years ago

Using devx branch, latest commit (Import Tools.py Error fix).

Parameters: CND/BTC for 0.5% profit, quantity 260, using BNB for fees.

Firstly, I really like the feature that cancels buy orders if they fail to be filled instantly, but could you make it a parameter we toggle? I'm also getting "UNKNOWN_ORDER"

Secondly, I've been encountering random "insufficient balance" errors that don't seem valid because the bot continues to trade.

price:0.00001937 buyp:0.00001924 sellp:0.00001934-bid:0.00001924 ask:0.00001940 Buy order created id:3539674, q:265.00000000, p:0.00001924 Buy order failed... Cancel order... Buy order failed... Cancel order... Profit loss, called order, 3539674 price:0.00001936 buyp:0.00001925 sellp:0.00001935-bid:0.00001925 ask:0.00001935 Buy order failed... Cancel order... m: UNKNOWN_ORDER Buy order created id:3539694, q:265.00000000, p:0.00001925 m: UNKNOWN_ORDERBuy order failed... Cancel order... m: UNKNOWN_ORDER Buy order filled... Try sell... Sell order create id: 3539709 Buy order filled... Try sell... m: Account has insufficient balance for requested action. Buy order filled... Try sell... m: Account has insufficient balance for requested action. Buy order filled... Try sell... m: Account has insufficient balance for requested action. Buy order filled... Try sell... m: Account has insufficient balance for requested action. Buy order filled... Try sell... m: Account has insufficient balance for requested action. Buy order filled... Try sell... m: Account has insufficient balance for requested action. Buy order filled... Try sell... m: Account has insufficient balance for requested action. Buy order filled... Try sell... m: Account has insufficient balance for requested action. Profit loss, called order, 3539709 price:0.00001932 buyp:0.00001924 sellp:0.00001934-bid:0.00001924 ask:0.00001930 Stop-loss, sell market, 1.923e-05

For whatever reason, the bot decided to sell at a loss. Binance screenshot: https://gyazo.com/402ce7613d8d3a911393520e4d64d4f4

Shortly after, the bot proceeded to make a trade where the sell order wasn't filled instantly, causing it sell for the exact same amount as it bought at (wasting my BNB on fees). If this is supposed to be a feature, please at least let me toggle it off so it doesn't waste my BNB.

Binance screenshot: https://gyazo.com/9d1ec5ba7f3acf182f50f8c8b0e0bd6c

And yes, I have enough BNB to cover the fees of the aforementioned trades.

Finally, please update the readme file! I've seen a few other parameters and features mentioned on other issue tickets that aren't mentioned in it.

Thank you for all the time everyone's been investing into testing and developing this thing, it's a neat little community. Keep up the great work! :heart:

yasinkuyu commented 6 years ago

Thanks for the details and screenshots. Unfortunately, I can not test it often because there is no balance on my account. I will fix it as soon as possible.

tapir1 commented 6 years ago

I appreciate your quick response man! Will definitely consider donating to you and WeSpeakCrypto soon so you guys can continue testing locally.

EDIT: I thought --stoploss 0 fixed it, but it still ended up selling at market price for a loss.

dmuzizian commented 6 years ago

1

WeSpeakCrypto commented 6 years ago

1: Buy order hold: You can make it wait longer by changing the WAIT_TIME_CHECK_BUY variable inside Trading.py I don't think this should be toggled though. But this is an error for range mode. Didn't thought about that.

2: Stoploss 0: This is already considered. I'll add it and prevent from selling market price. But this will mean bot will wait till it is sold. Other wise. It will just be checking the status of that order.

3: About the flood and UNKOWN_ORDER. Still trying to find the leak there. My thread stopper is not working. :( I didn't yet know what change made it not work.

@elCapitanoh

WeSpeakCrypto commented 6 years ago

You can try it under my forked repo now. Remember to use small amounts first. :)

nealgentry commented 6 years ago

python trader.py --quantity 20 --symbol BNBETH --profit .2 --stop_loss 0 @yasinkuyu, 2018 Auto Trading for Binance.com. --symbol: BNBETH

...

Started... --quantity: 20.00000000

0.2% profit scanning for BNBETH

Between Ask and Bid 0.2% profit hunting buyp : BuyPrice (Bid+ --increasing 0.00000100) sellp: SellPrice (Bid- --decreasing 0.00000100) ...

price:0.01412600 buyp:0.01411200 sellp:0.01413922-bid:0.01411100 ask:0.01417900 price:0.01412600 buyp:0.01411200 sellp:0.01413922-bid:0.01411100 ask:0.01417900 Buy order created id:12657347, q:20.00000000, p:0.01411200 m: Account has insufficient balance for requested action. Profit loss, called order, 12657347 Buy order fail (Not filled) Cancel order... price:0.01412600 buyp:0.01411200 sellp:0.01413922-bid:0.01411100 ask:0.01417900 m: UNKNOWN_ORDER price:0.01412600 buyp:0.01411200 sellp:0.01413922-bid:0.01411100 ask:0.01417900 Buy order created id:12657349, q:20.00000000, p:0.01411200 m: UNKNOWN_ORDER m: Account has insufficient balance for requested action. m: UNKNOWN_ORDER Profit loss, called order, 12657349 Buy order fail (Not filled) Cancel order... price:0.01412600 buyp:0.01411100 sellp:0.01413822-bid:0.01411000 ask:0.01417900 m: UNKNOWN_ORDER price:0.01412600 buyp:0.01412700 sellp:0.01415425-bid:0.01412600 ask:0.01417900 Buy order created id:12657355, q:20.00000000, p:0.01411100 m: UNKNOWN_ORDER m: UNKNOWN_ORDER m: Account has insufficient balance for requested action. Profit loss, called order, 12657355 Buy order fail (Not filled) Cancel order... price:0.01412600 buyp:0.01412700 sellp:0.01415425-bid:0.01412600 ask:0.01417900 m: UNKNOWN_ORDER Buy order created id:12657360, q:20.00000000, p:0.01412700 m: UNKNOWN_ORDER m: UNKNOWN_ORDER ^CTraceback (most recent call last): File "trader.py", line 45, in t.run() File "./app/Trading.py", line 519, in run time.sleep(self.wait_time - (endTime - startTime)) KeyboardInterrupt Profit loss, called order, 12657360 Buy order fail (Not filled) Cancel order... m: UNKNOWN_ORDER price:0.01412600 buyp:0.01412800 sellp:0.01415525-bid:0.01412700 ask:0.01417800 m: UNKNOWN_ORDER Buy order created id:12657367, q:20.00000000, p:0.01412800 Buy order partially filled... Try sell... Cancel remaining buy... Profit loss, called order, 12657367 m: Filter failure: PRICE_FILTER

even with stoplosss at 0