CyberPunkMetalHead / gateio-crypto-trading-bot-binance-announcements-new-coins

This is a crypto trading bot that scans the Binance Annoucements page for new coins, and places trades on Gateio
MIT License
1.21k stars 303 forks source link

order_status='cancelled' #79

Open ghost opened 2 years ago

ghost commented 2 years ago

I'm using the last version of place_order (trade_client.py) with the parameter time_in_force='ioc'. I would like to understand why it always fails before than buy or sell, getting a order_status='cancelled'. Could I avoid this?

powr

DominicFrei commented 2 years ago

IOC means instant or cancelled. So, I'd assume, it was not executed instantly and therefore cancelled and set up with a more recent price to get that fill.

ghost commented 2 years ago

Is there any way to avoid cancellations? Sometimes I get to buy or sell at a very different price. I don't know if it could be more interesting to use Good till cancelled (GTC) or Fill or Kill (FOK) or any other option. I don't know which one is the option by default, but in the previous version, without time_in_force, the order is placed instantly.

busyuqboy commented 2 years ago

The problem is the price is changing dramatically. The previous method used the default of open until cancelled mode.
You are correct that the order would immediately succeed. The problem is, you most likely didn't purchase anything. You just have an open order. And since the price is moving dramatically, you missed your opportunity.

Now, you have to issue issue a cancel order request and issue a new one. That extra step of issuing a cancel to your open order (that didn't get filled), is a waste of time compared to the option of fill or cancel immediately (ioc mode).

I can't weigh in on the GTC or FOK options. I've never tried those.