0
votes

I have the following code and I also read the post from Bittrex. My nonce and apikey are used for HMAC calculation, but I receive the APISIGN_NOT_PROVIDED error.

For this version, we use a standard HMAC-SHA512 signing. Append apikey and nonce to your request and calculate the HMAC hash and include it under an apisign header. Note: the nonce is not respected right now but will be enforced later.

if true
  % code
url_base = 'https://bittrex.com/api/v1.1/market/getopenorders';
body = [url_base,'?apikey=',apikey,'&nonce=',nonce];
sign = hmac(secret_key, body, 'SHA-512');
json = urlread( body, 'Get', {'apisign', sign} )
end
1

1 Answers

2
votes

Since urlread is not recommended anymore (reference here), just for the sake of curiosity, try the currently recommended alternative webread:

url_base = 'https://bittrex.com/api/v1.1/market/getopenorders/';
url_full = [url_base '?apikey=' apikey '&nonce=' nonce];
sign = hmac(secret_key,url_full,'SHA-512');

opt = weboptions('ContentType','json','HeaderFields',{'apisign' sign},'RequestMethod','get');
json = webread(url_full,opt);

Also, don't forget to put a breakpoint in your code and check how sign looks like, just to be sure you are forwarding properly formatted data in your HTTPS request headers.