Open KindSpidey opened 2 years ago
CCXT Pro Version 1.1.33
I am also having problem sending a limit order with 5X leverage cross for symbol LTC/USDT.
leverage = await okx.setLeverage(5, 'LTC/USDT', {'mgnMode': 'cross'})
print(leverage)
gives me
{'code': '0', 'data': [{'instId': 'LTC-USDT', 'lever': '5', 'mgnMode': 'cross', 'posSide': ''}], 'msg': ''}.
So I guess the leverage is correctly set. but I could not send the limit order using it.
await okx.create_order('LTC/USDT', 'limit', 'buy', 0.5, 50)
await okx.create_order('LTC/USDT', 'limit', 'buy', 0.5, 50, {'tdMode': 'cash'})
await okx.create_order('LTC/USDT' 'limit', 'buy', 0.5, 50, {'mgnMode': 'cross'})
await okx.create_order('LTC/USDT' 'limit', 'buy', 0.5, 50, {'mgnMode': 'cross', 'ccy': 'USDT'})
they all let me send the order with no leverage
await okx.create_order('LTC/USDT', 'limit', 'buy', 0.5, 50, {'tdMode': 'cross'}) # this should be the right one according to okx documents... well.. they are not very clear..
raises the follow name 'symbol' is not defined
can you please help?
tx
Fixed it. You needed to add 2 things: ":USDT" to symbol and parametr "posSide" Now try this
okx.setLeverage(5, 'LTC/USDT:USDT', {'mgnMode': 'isolated', "posSide":"long"})
Second help. I used this for market order:
exchange.create_market_buy_order(coin + self.usdt + ':USDT', amount, {'mgnMode': 'cross', "posSide": "long"})
So in your case i guess it will be something like:
await okx.create_order('LTC/USDT:USDT', 'limit', 'buy', 0.5, 50, {'mgnMode': 'cross', "posSide": "long"})
Write me back in any case, work it or not
@KindSpidey , Thank you for your help butLTC/USDT:USDT
is the perpetual future. I want to trade LTC/USDT
spot using 'mgnMode': 'cross'
as I do from web.
@ShieldTrade well. are you sure spot allows to buy in cross mode? Cross/isolation is only for futures, because futures allow you to trade using leverages, while spot is only for using your money. You can't trade isolated or crossed on Spot
As you can see from this screen shot I can buy 17.31 contracts at the price of 50 USDT having only 86.59 USDT on my account using leverage 10.
@KindSpidey I was thinking margin trading for spot could not be allowed in all countries. Can you trade LTC/USDT with margin on OKX?
I've already asked for this in the issue #13789 , but havent received the answer. We found some errors, but havent figured out how to solve them. So how to make an order on OKX futures and place market order to buy GMT with 10x leverage isolated?