繁体   English   中英

币安python上的开单问题

[英]Problem with opening order on binance python

我正在恢复以这种格式打开订单的信号:'SELL'、'1INCHUSDTPERP'、'0.6396'、'0.652392'、'0.588432'。 1- 边 2 - 交易品种 3 - 订单价格 4 - 止损价格 5 - 止盈价格。 比我以这种方式四舍五入所有价格:

tick = get_ticksize(symbol)
price = round_step_size(float(price), float(tick))
stopl = round_step_size(float(stopl), float(tick))
takep = round_step_size(float(takep), float(tick))

get_ticksize function:

def get_ticksize(symbol):
    info = client.futures_exchange_info()
    for item in info['symbols']:
        if(item['symbol'] == symbol):
            for f in item['filters']:
                if f['filterType'] == 'PRICE_FILTER':
                    return f['tickSize']

而不是我打开订单:

stop = client.futures_create_order(symbol=symbol, side="SELL", type="STOP_MARKET", stopPrice=stopl, closePosition="true")
take = client.futures_create_order(symbol=symbol, side="SELL", type="TAKE_PROFIT_MARKET", stopPrice=takep, closePosition="true")
buyorder = client.futures_create_order(symbol=symbol, side=side, type="LIMIT", quantity=q, price=price, timeInForce="GTC")

所以我们有输入

'卖出', '1INCHUSDTPERP', '0.6396', '0.652392', '0.588432'

和 output

卖出 1 英寸 USDT 0.6396 0.6523 0.5884

止损和止盈打开没有任何问题,但订单未打开:

binance.exceptions.BinanceAPIException: APIError(code=-1111): Precision is over the maximum defined for this asset.

请使用十进制。十进制而不是浮点数。

此外,一年前我在这里共享代码以提供我的 binance 客户端,现在它仍在运行: webtul/binancecli.py 你可以得到一个参考。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM