Signing API Endpoints

I'm having trouble working out how to get information from the signed binance API. I'm able to call the public endpoints (for example, the server time below) but the signed endpoint is causing me a headache and I don't know where to go from here.

The binance signed API documentation mentions




  • SIGNED endpoints require an additional parameter, signature, to be sent in the query string or request body.
  • Endpoints use HMAC SHA256 signatures. The HMAC SHA256 signature is a keyed HMAC SHA256 operation. Use your secretKey as the key and totalParams as the value for the HMAC operation.
  • The signature is not case sensitive.
  • totalParams is defined as the query string concatenated with the request body.

I don't really know precisely what this means, but I am passing my API key and secret, and a timestamp as below but I'm not getting the account status returned, although I am getting the servertime.

ih =InternetOpenURL("");
printf(" Server Time " );
if( ih )
     while( ( str = InternetReadString( ih ) ) != "" )
         printf( "%s", str );
     InternetClose( ih );

	string_holding_json = 
		GET " ",  
		&timestamp= ih,
		&signature= "7j0gW9J**************************I4MhPancY", 
		&apiKey= "ubupZKb******************************1MgM",
 obj = JSON.parse( string_holding_json );
 getall = obj.GET;

scr = GetScriptObject(); 

msg = scr.getall;
printf("%s", msg);

Does anyone here have any ideas how I can make this work? Thanks in advance.

See this post 16,17 and the rest on how to properly use Quotes in the string. Either mix of single and double quotes or properly escaping double quotes within the outer double quotes.

Also your JSON format is very wrong, read about JSON format.

Will InternetPostRequest accepts raw json data? - AFL Programming - AmiBroker Community Forum

1 Like

Thanks for that. I’ll work through its

Solution here as provided by @nsm51 :pray:

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.