通过python从Kucoin获取借币规模

问题描述 投票:0回答:1

我想获取该货币当前的借入规模。

我试过了:

client = kucoin.Client(api_key, api_secret, api_passphrase)
response = client.get_accounts()

但响应中缺少借用规模。

你有什么建议吗?

我可以发现:https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-cross-margin 但我不知道如何在 python 中实现它。

谢谢

马塞尔

我试过了:

client = kucoin.Client(api_key, api_secret, api_passphrase)
response = client.get_accounts()
python api kucoin
1个回答
0
投票

我也尝试过:

import base64, hmac, hashlib, json, time

# constants
API_KEY = '***'
API_SECRET = '***'
API_PASSPHRASE = '***'

url = "https://api/v3/margin/accounts"

str_to_sign = 'GET' + '/api/v3/margin/accounts?quoteCurrency=BTC'

signature = base64.b64encode(hmac.new(API_SECRET.encode(
    'utf-8'), str_to_sign.encode('utf-8'), hashlib.sha256).digest())

passphrase = base64.b64encode(hmac.new(API_SECRET.encode(
    'utf-8'), API_PASSPHRASE.encode('utf-8'), hashlib.sha256).digest())

headers = {
    "KC-API-SIGN": signature,
    "KC-API-TIMESTAMP": str(now),
    "KC-API-KEY": API_KEY,
    "KC-API-PASSPHRASE": passphrase,
    "KC-API-KEY-VERSION": "2",
    "Content-Type": "application/json"
}

try:
    res = requests.get(
        url, headers=headers).json()

    print(res)

except Exception as err:
    print(err)

但它不起作用。

© www.soinside.com 2019 - 2024. All rights reserved.