gateio / gateapi-python

247 stars 92 forks source link

How do you sell 100% of the long position? #77

Closed vldmarton closed 2 years ago

vldmarton commented 2 years ago

If I understand correctly, when creating an order, I can only specify volume in pairing coin (f.e. USDT). What about the main coin? Let's say I have 0.21251 ETH and I want to sell it all. Can I send a request with volume in ETH, not USDT?

revilwang commented 2 years ago

amount in Order means the main coin you mentioned. Use Order(currency_pair='ETH_USDT', side='sell', amount='0.21251', price='xxx') to sell ETH.

vldmarton commented 2 years ago

Sorry, my bad, I can see that now. Thank you

castiellll commented 2 years ago

Hi

So for ETH_USDT if we buy, amount = USDT and if we sell amount = ETH ?

I ask because in the example here a buy order is created with amount = order_amount, based on min_amount which in turn is based on min_quote_amount so USDT. While in this Issue you say that the amount is the base amount = ETH ?

Thanks :)

revilwang commented 2 years ago

Yes, you're right. The example indeed leads some confusion. I'll update the demo application later.

castiellll commented 2 years ago

Ok thank you So you confirm that the amount is the base amount and not the quote amount ? plus if I wanna buy/sell in quote, which in my case would be USDT, I will need to compute the corresponding amount of base ?

revilwang commented 2 years ago

Yes, if USDT is the quote, you need to calculate the base amount using the price you set