Skip to content

Instantly share code, notes, and snippets.

@rc1021
Created January 20, 2021 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rc1021/de57dbe61d65012b4a175402d1331308 to your computer and use it in GitHub Desktop.
Save rc1021/de57dbe61d65012b4a175402d1331308 to your computer and use it in GitHub Desktop.
获取所有币信息 (USER_DATA)
#!/usr/bin/env bash
# Set up authentication:
# apiUrl="https://testnet.binance.vision"
apiUrl="https://api.binance.com"
apiKey=""
secretKey=""
# Set up the request:
apiMethod="GET"
apiPath="/sapi/v1/capital/config/getall"
ts=$(date +%s000)
paramsWithTs="recvWindow=5000&timestamp=$ts"
signature=$(echo -n "$paramsWithTs" \
| openssl dgst -sha256 -hmac "$secretKey" \
| awk '{print $2}' \
| tr -d '\n')
curl -H "X-MBX-APIKEY: $apiKey" \
-X $apiMethod "$apiUrl$apiPath?$paramsWithTs&signature=$signature"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment