我怎样才能确认我的订单是否已满?我无法得到我真正想要的东西,我需要一个能表明订单已经完成的回复。这是我的密码
# CHECKING IF ORDER IS FILLED
now5 = int(time.time() * 1000)
urlFill = 'https://api.kucoin.com/api/v1/fills'
params5 = {"orderId": OrderID, "side": "sell", "symbol": "AFK-USDT", "type": "limit"}
data_json5 = json.dumps(params5)
sign5 = str(now5) + 'GET' + '/api/v1/fills' + data_json5
signature5 = base64.b64encode(hmac.new(api_secret.encode('utf-8'), sign5.encode('utf-8'), hashlib.sha256).digest())
passphrase5 = base64.b64encode(hmac.new(api_secret.encode('utf-8'), api_passphrase.encode('utf-8'), hashlib.sha256).digest())
headers5 = {"KC-API-SIGN": signature5, "KC-API-TIMESTAMP": str(now5), "KC-API-KEY": api_key, "KC-API-PASSPHRASE": passphrase5, "KC-API-KEY-VERSION": "2", "Content-Type": "application/json"}
response5 = requests.request('get', urlFill, headers=headers5, data=data_json5)
#print(response.status_code)
ORDFLD = (response5.json())
print(ORDFLD)
print(response5.__dict__) 答复2:
{'_content': b'{"code":"200000","data":{"currentPage":1,"pageSize":50,"totalNum":0,"totalPage":0,"items":[]}}', '_content_consumed': True, '_next': None, 'status_code': 200, 'headers': {'Date': 'Thu, 07 Jul 2022 23:51:02 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Set-Cookie': 'AWSALB=8tMVQE53aj8t24B+W51NkG0sWW21D11T/dhZ4zve5DOcSguLbzMoosUQH6/lAsQwcBCR6dhkGGOAOrVWvVfcrBnruwKPTw7rKJxPT9ynPaB6HL9/4zWNu4VWBumY; Expires=Thu, 14 Jul 2022 23:51:02 GMT; Path=/, AWSALBCORS=8tMVQE53aj8t24B+W51NkG0sWW21D11T/dhZ4zve5DOcSguLbzMoosUQH6/lAsQwcBCR6dhkGGOAOrVWvVfcrBnruwKPTw7rKJxPT9ynPaB6HL9/4zWNu4VWBumY; Expires=Thu, 14 Jul 2022 23:51:02 GMT; Path=/; SameSite=None; Secure, __cfruid=b4a23d97c7f50a8d3bcfba85a03076479ed8f439-1657237862; path=/; domain=.kucoin.com; HttpOnly; Secure; SameSite=None', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Expires': '0', 'X-Frame-Options': 'DENY', 'Strict-Transport-Security': 'max-age=9800; includeSubDomains; preload', 'CF-Cache-Status': 'DYNAMIC', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Server': 'cloudflare', 'CF-RAY': '72747c5e4aacb872-AMS', 'Content-Encoding': 'gzip'}, 'raw': <urllib3.response.HTTPResponse object at 0x000001E2CEA7A250>, 'url': 'https://api.kucoin.com/api/v1/fills', 'encoding': 'utf-8', 'history': [], 'reason': 'OK', 'cookies': <RequestsCookieJar[Cookie(version=0, name='__cfruid', value='b4a23d97c7f50a8d3bcfba85a03076479ed8f439-1657237862', port=None, port_specified=False, domain='.kucoin.com', domain_specified=True, domain_initial_dot=True, path='/', path_specified=True, secure=True, expires=None, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None, 'SameSite': 'None'}, rfc2109=False), Cookie(version=0, name='AWSALB', value='8tMVQE53aj8t24B+W51NkG0sWW21D11T/dhZ4zve5DOcSguLbzMoosUQH6/lAsQwcBCR6dhkGGOAOrVWvVfcrBnruwKPTw7rKJxPT9ynPaB6HL9/4zWNu4VWBumY', port=None, port_specified=False, domain='api.kucoin.com', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=1657842662, discard=False, comment=None, comment_url=None, rest={}, rfc2109=False), Cookie(version=0, name='AWSALBCORS', value='8tMVQE53aj8t24B+W51NkG0sWW21D11T/dhZ4zve5DOcSguLbzMoosUQH6/lAsQwcBCR6dhkGGOAOrVWvVfcrBnruwKPTw7rKJxPT9ynPaB6HL9/4zWNu4VWBumY', port=None, port_specified=False, domain='api.kucoin.com', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=True, expires=1657842662, discard=False, comment=None, comment_url=None, rest={'SameSite': 'None'}, rfc2109=False)]>, 'elapsed': datetime.timedelta(microseconds=786296), 'request': <PreparedRequest [GET]>, 'connection': <requests.adapters.HTTPAdapter object at 0x000001E2CE9E4670>}发布于 2022-07-14 08:30:11
端点fills将为订单提供所有的填充。也就是说,当订单大到要用一个交易来填充时,它就会给你一个清单,列出所有的填充物。
端点将不会返回,但您显然需要的是您的订单是否已完全填充。
为了获取这些信息,您应该使用终结点。
/api/v1/orders/{order-id}其中order-id是您感兴趣的订单的id。
它将使用一个名为isActive的字段返回一个JSON。
如果订单仍处于活动状态,则isActive为true;如果订单已被填充(或取消),则为false。
https://stackoverflow.com/questions/72905506
复制相似问题