-
Notifications
You must be signed in to change notification settings - Fork 2k
buy fails when buy_pct = 100 #1315
Comments
This is correct and has been reported before. Unless an order has been partially filled a re-order will always use the same size, which inevitable causes a insufficient funds error if the price moved up. Looking at the code one possible solution would be to remove the size attribute during a price adjust if the order has not been partially filled, this way executeSignal recalculates the size according to the new price. |
PR ready. Test it and report back @Burnie09 |
It seems to be working (added some more debug to check); 2018-02-10 20:16:18 - placing buy order... 2018-02-10 20:16:17 6862.32 BTC-EUR +0.20% 1 - 49.64 0.0347 0.0196 buying 0.00000 BTC 596.29 EUR 2018-02-10 20:16:22 - 6867.33 vs our 6866.91 2018-02-10 20:16:34 - 6867.34 vs our 6867.33 buy order completed at 2018-02-10 20:17:34: 2018-02-10 20:18:00 6867.75 BTC-EUR -0.28% 2 50.74 + 0.0354 0.0376 bought 0.08654 BTC 0.00 EUR Seems the size in the completion text is the original size (0.08683668), but it works. - 100% bought. |
👍 I wonder why we are tracking |
nvm. If this was a partial order we of course would wont the original size duh We could change it in |
Thats actually a silly hack as it doesn't account for timed out partial orders. I'll switch one of my bots to 100% and think of a proper solution once i have the time. |
Just to let you know. I can confirm your findings. Partial orders just stops. |
System information
Describe the problem
( GDAX.BTC-EUR / maker )
When zenbot is adjusting a (maker) buy, it adjusts price, but doesn't seem to adjust size to buy.
Having c.buy_pct = 100 will result in not enough funds.
Workaround is using c.buy_pct = 99 (will not work if slippage > ~1.01%)
example below:
Source code / logs
2018-02-10 16:23:31 6938.79 BTC-EUR +0.11% 2 --- 28.15 -0.0643 0.0243 0.00000 BTC 609.93 EUR +0.00% +1.99%
manual limit BUY command executed
2018-02-10 16:23:42 - placing buy order...
2018-02-10 16:23:42 - buy order placed at 6938.53 EUR
2018-02-10 16:23:44 - order status: open
2018-02-10 16:23:46 - order status: open
2018-02-10 16:23:48 - order status: open
2018-02-10 16:23:50 - order status: open
2018-02-10 16:23:50 - 6938.54 vs our 6938.53
2018-02-10 16:23:50 - cancelling order
2018-02-10 16:23:51 - buy order timed out, adjusting price
2018-02-10 16:23:51 - placing buy order...
2018-02-10 16:23:51 - not enough balance for buy, aborting - 0.08790594 @ 6938.69
2018-02-10 16:23:51 - not enough balance, or signal switched, cancel buy
2018-02-10 16:23:52 6938.79 BTC-EUR +0.11% 2 --- 28.15 -0.0643 0.0243 0.00000 BTC 609.93 EUR +0.00% +1.99%
The text was updated successfully, but these errors were encountered: