Kayracer
Kayracer

Reputation: 169

Binance API with Google Script

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

Upvotes: 0

Views: 4300

Answers (1)

zfj3ub94rf576hc4eegm
zfj3ub94rf576hc4eegm

Reputation: 1273

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})

Upvotes: 3

Related Questions