0

I am attempting to pull my trade history from Binance (using signed endpoint security) into google sheets so that I can keep records of all my trades using google scripts. I am stuck where I can't pull the data using the api keys. The below snippit is as far as I could get from my understaning of the Binance API and UrlFetchApp API.

var data = UrlFetchApp.fetch("https://api.binance.com/api/v3/myTrades", {headers : apiKey})

I also have found this post.

Binance API Website

Kayracer
  • 169
  • 3
  • 13

1 Answers1

3

You can't add the header in the url bar.

EDIT I see you are using UrlFetchApp. In that case, the correct syntax is

var headers = {'X-MBX-APIKEY': apiKey}
UrlFetchApp.fetch("https://api.binance.com/api/v3/myTrades", {'headers': headers})
  • I am using google scripts and as far as I know, `XMLHttpRequest` isnt supported – Kayracer Jan 10 '18 at 01:28
  • That has helped, I now get an error on the signature parameter, could you also explain that portion of the api? – Kayracer Jan 10 '18 at 04:38
  • Sure, if you approve my answer and ask another question and I'll take a look. – zfj3ub94rf576hc4eegm Jan 10 '18 at 15:20
  • This is potentially also useful as its a link to a full Binance API script on a tech forum which you can download and use instead: https://stadivm.com/threads/how-to-get-all-historic-data-from-binances-api-using-this-script-and-build-macd-rsi-etc.153/ – DanielSon May 13 '19 at 18:14