-1

I have JavaScript to communicate with the Binance API - it only downloads two data - I can't finish it because I get the message: {"code": - 1003, "msg": "Way too much request weight used; IP banned until 1663675430913. Please use the websocket for live updates to avoid bans. "} Please help me how to create a Websocket at the beginning of the script.

function response() {
var depthSocketBuffer;
//fetch(url) Metoda 
var url = "https://api.binance.com/api/v3/ticker/bookTicker?symbol=XLMUSDT";
//getContentText() formula
var response = UrlFetchApp.fetch(url);
Logger.log(response);

//JSON.parse() formula 

//highestBid
var json1 = response
var data = JSON.parse(response);
var bidPrice = data.ticker.bidPrice;
Logger.log(bidPrice)
SpreadsheetApp.getActiveSheet().getRange("B2").setValue(bidPrice);

//lowestAsk
var json2 = response
var data = JSON.parse(response);
var askPrice = data.ticker.askPrice;
Logger.log(lowestAsk)
SpreadsheetApp.getActiveSheet().getRange("C2").setValue(askPrice);
}
elbingerr
  • 19
  • 5

1 Answers1

0

The error message you received happens because IP Limits weren't respected on REST API, you can consult the conditions on the API Documentation (LIMITS section).

As for the websocket, there's actually a Node.js API connector available for public use (with the websocket integrated). The repository is at https://github.com/binance/binance-connector-node, where you can find the README.md file that details its usage.

Binance
  • 69
  • 6