使用CCXT计算OKX批量大小
几天前,我才刚刚开始使用CCXT。只是想知道是否有任何简单或直接的方法可以计算OKX上的未来批量,还是我必须手动计算它?
例如, 是否有任何可以将可用USDT作为输入的API并给出最大批量的回报?
目前,我正在做这样的事情,
def fetch_order_qty(symbol):
leverage = 10
balance_req = okx.fetchBalance()
balance = balance_req['free']['USDT']
ticker_req = okx.fetchTicker(symbol)
ticker_cost = ticker_req['bid']
# risking 10% of the available capital
trade_capital = 10/100*balance
ticker_qty = (trade_capital / ticker_cost) * leverage * lot_multiplier
return ticker_qty
print(fetch_order_qty('BTC-USDT-SWAP'))
但是每个符号都有不同的很多。因此,有什么方法可以计算它。还是有一种方法可以直接使用USDT保证金金额直接购买订单,而无需使用CCXT(OKX)提及任何数量?
I just started using CCXT few days ago. Just wondering if there's any easy or direct way to calculate future lot size on OKX or do I have to calculate it manually?
For example,
Is there any API which can take the available USDT as an input and give the max lot size in return?
Currently I'm doing something like this,
def fetch_order_qty(symbol):
leverage = 10
balance_req = okx.fetchBalance()
balance = balance_req['free']['USDT']
ticker_req = okx.fetchTicker(symbol)
ticker_cost = ticker_req['bid']
# risking 10% of the available capital
trade_capital = 10/100*balance
ticker_qty = (trade_capital / ticker_cost) * leverage * lot_multiplier
return ticker_qty
print(fetch_order_qty('BTC-USDT-SWAP'))
But every symbol got different kind of lots. So is there any ways to calculate it. Or is there a way to just directly buy the order using USDT margin amount without mentioning any LOT quantity using CCXT (OKX) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
还有
Exchange.market('BTC-USDT-SWAP')['Contractsize']
,听起来可能是您想要的东西there's also
exchange.market('BTC-USDT-SWAP')['contractSize']
which sounds like it might be something you want