yasinkuyu / binance-trader

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

round QTY error... after partial fill and profit cancel. ( FIXED) #146

Closed nealgentry closed 6 years ago

nealgentry commented 6 years ago

binance side 01-22 05:28:11 | LTC/USDT | Limit | Buy | 190.70000000 | 190.7 | 0.30000000 | 1.00000000 | 57.21000000 | -- | Part FIll

bot side

price:190.47000000 buyp:190.70000000 sellp:191.42235000-bid:190.47000000 ask:191.60000000 Buy order created id:4804329, q:1.00000000, p:190.70000000 Buy order partially filled... Try sell... Cancel remaining buy... Profit loss, called order, 4804329 Traceback (most recent call last): File "trader.py", line 46, in t.run() File "./app/Trading.py", line 469, in run self.action(symbol) File "./app/Trading.py", line 361, in action self.sell(symbol, quantity, self.order_id, profitableSellingPrice, lastPrice) File "./app/Trading.py", line 120, in sell quantity = round(quantity, self.step_size) TypeError: a float is required

round QTY error... after partial fill?

BOT ran successfully for 7 hours before this event.

nealgentry commented 6 years ago

Guessing the integer should be a float? on line 120 Trader.py

if self.step_size == 1:
           quantity = int(round(quantity))
             else:
                 quantity = round(quantity, self.step_size)
WeSpeakCrypto commented 6 years ago

Pull update. It is fixed on the last commit.

nealgentry commented 6 years ago

ok thanks!