Closed busyuqboy closed 2 years ago
I've been learning that time_in_force="ioc"
means that the order will be put into an automatic status of cancelled if it doesn't get filled (as opposed to open that will remain until closed). However, I've learned that in this scenario, you can also get partially filled cancelled orders.
I still believe, in terms of iterating and looking for prices, the ioc
flag is the best way to go. But there still needs to be additions to handle a second buy order to try to achieve the remaing balance of volume specified in the config settings.
I've been learning that
time_in_force="ioc"
means that the order will be put into an automatic status of cancelled if it doesn't get filled (as opposed to open that will remain until closed). However, I've learned that in this scenario, you can also get partially filled cancelled orders.I still believe, in terms of iterating and looking for prices, the
ioc
flag is the best way to go. But there still needs to be additions to handle a second buy order to try to achieve the remaing balance of volume specified in the config settings.
@busyuqboy You can use list_spot_accounts with currency specified to check if the balance is enough. WalletApi.get_trade_fee(which is more recommended but requires wallet read-only access)
PR will be coming soon for fixing:
NOT_ENOUGH_BALANCE
error on sellsession
object summing amounts
and fees
across multiple orders)ioc
to fill orders (or cancel immediately)
https://github.com/CyberPunkMetalHead/gateio-crypto-trading-bot-binance-announcements-new-coins/blob/master/main.py#L223
At line 223, we assume that the order has been filled. We write to the order.json file the full amount in this assumption. At this point, the order may be in a status of
open
,cancelled
,filled
orclosed
One change I have made is: 1) to change the order create to use the
time_in_force=ioc
flag. Immediate or cancel. This makes my order automatically cancel if any or none is filled. The status is 'cancelled'. I don't ever want to leave an 'open' status order.Here is my definition of my place_order method. Notice the
ioc
provision.The second and important change I made is to:
2) Update the buy amount in the order.json file to be accurate to what your order came back with.
At line 223, I have changed the code to this
You must deflate the order by the fee amount too to make sure you get a successful sell order filled.