簡體   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