gateio / gateapi-python

263 stars 97 forks source link

Important - How to close a Futures order/position? #85

Closed MrCanan closed 2 years ago

MrCanan commented 2 years ago

Hi,

How can I close an order/position with the Futures API? (I mean like if I click on "Market" on the web UI) I can create without problem a Futures order with "FuturesOrder" and "create_futures_order" and get its id (and other information like size).

Screenshot 2021-12-12 12 28 04

Thank you in advance, Best regards.

revilwang commented 2 years ago

I think you are trying to close a position. To close a position, you need to create a close order. When it is filled, your position will be closed. To create a close order, set close to true and size to 0 (which is documented here)

MrCanan commented 2 years ago

Thank you, I did not see it ^^