I am trying to get my account info from Binance.com with the following Perl code:
#!/usr/bin/perl
use strict;
use warnings;
use Digest::SHA qw(hmac_sha256_hex);
use Time::HiRes qw(time);
my $api_key = "X";
my $api_secret = "X";
my $data = "recvWindow=2000×tamp=" . int(time() * 1000);
my $signature = uc(hmac_sha256_hex($data, $api_secret));
print `curl -s -m 3 -H 'X-MBX-APIKEY: $api_key' -d '$data&signature=$signature' -X GET 'https://api.binance.com/api/v3/account'` . "\n";
That code looks correct and should work, but I get the following error:
{"code":-1102,"msg":"Mandatory parameter 'timestamp' was not sent, was empty/null, or malformed."}
Ofcourse, the timestamp parameter is sent and not empty or null, nor malformed.
If I print the output to console, it shows the following:
curl -s -m 3 -H 'X-MBX-APIKEY: X' -d 'recvWindow=2000×tamp=1516082731909&signature=X' -X GET 'https://api.binance.com/api/v3/account'
Can someone help please? Thank you.
References:
Note: I replaced API Key/Secret and Signature with 'X'