Reputation: 522
I'm trying to get my account information using Binance api.
curl request :
curl -H "X-MBX-APIKEY: " -X POST 'https://api.binance.com/api/v3/account' -d 'recvWindow=5000×tamp=12345643&signature=8KhePoYVPdnw2T4Y38Yvurvr3U5Q59MYqvtg6kepFoMn9m3PvEnGeVjpV0Lmc5ab'
I get this
Not Found
Probably I am not creating HMAC signature properly.
Upvotes: 1
Views: 3811
Reputation: 118
Tested example in bash:
#!/bin/bash
####API
APIKEY="XXXXXXXXXXXXXXXXyour api key here""
APISECRET="XXXXXXXXXXXXyour api secret here"
RECVWINDOW=5000 # 5 seconds
####GET ACCOUNT BALACE
TM=$(( $(date -u +%s) *1000))
GET_BALANCE_QUERY="recvWindow=$RECVWINDOW×tamp=$TM"
GET_BALANCE_SIG=$(echo -n "$GET_BALANCE_QUERY" | openssl dgst -sha256 -hmac $APISECRET)
echo $GET_BALANCE_SIG
GET_BALANCE_SIG="$(echo $GET_BALANCE_SIG | cut -f2 -d" ")"
echo $GET_BALANCE_SIG
curl -H "X-MBX-APIKEY: $APIKEY" -X GET "https://api.binance.com/api/v3/account?recvWindow=$RECVWINDOW×tamp=$TM&signature=$GET_BALANCE_SIG" | jq
=
Upvotes: 3