Binance API Keys

前端 未结 6 1540
名媛妹妹
名媛妹妹 2021-02-16 00:20

I have set up a read-only API key on Binance to access account information like currency balances but I can\'t see the JSON data. The string query I put into the URL returns th

6条回答
  •  滥情空心
    2021-02-16 00:51

    This worked for me:

    base_url="https://api.binance.com"
    account_info="/api/v3/account"
    
    url="${base_url}${account_info}"
    
    apikey="your_apikey"
    secret="your_secret"
    
    queryString="timestamp=$(date +%s)" #$(python3 binance_time.py) must sync
    requestBody=""
    
    signature="$(echo -n "${queryString}${requestBody}" | openssl dgst -sha256 -hmac $secret)"
    signature="$(echo $signature | cut -f2 -d" ")"
    
    req=$(curl -H "X-MBX-APIKEY: $apikey" -X GET "$url?$queryString&signature=$signature")
    echo $req
    

提交回复
热议问题