node-binance-api icon indicating copy to clipboard operation
node-binance-api copied to clipboard

Support of Binance test network

Open pdwinkel opened this issue 5 years ago • 7 comments

Is it possible to use/set the Binance test network https://testnet.binance.vision ?

pdwinkel avatar Nov 23 '20 18:11 pdwinkel

I think it's possible by using 'test' parametter on options.

    const default_options = {
        recvWindow: 5000,
        useServerTime: false,
        reconnect: true,
        keepAlive: true,
        verbose: false,
        test: false,
        hedgeMode: false,
        localAddress: false,
        family: false,
        log: function ( ...args ) {
            console.log( Array.prototype.slice.call( args ) );
        }
    };

Like this :

const binance = new Binance().options({
  APIKEY: '<key>',
  APISECRET: '<secret>',
  test: true
});

But it seem make error when a request is maked.

dawadam avatar Nov 30 '20 17:11 dawadam

Try setting base: 'https://testnet.binance.vision' in the options should do this automatically if test mode is on, this feature was finally released

jaggedsoft avatar Dec 20 '20 07:12 jaggedsoft

I'm using the following options, which seem to work for testing spot trading:

      {
         verbose: true,
         urls: {
            base: 'https://testnet.binance.vision/api/',
            combineStream: 'wss://testnet.binance.vision/stream?streams=',
            stream: 'wss://testnet.binance.vision/ws/'
         }
      }

watch the / and = at the end of the strings!

pdwinkel avatar Dec 21 '20 13:12 pdwinkel

thank you, this is very helpful. it should be easy enough for us to enable this automatically if test mode is true and the other options are set to the defaults.

jaggedsoft avatar Dec 21 '20 14:12 jaggedsoft

Hello team,

This is my Options:

const binance = new Binance().options({ APIKEY: testnet_APIKEY, APISECRET: testnet_APISECRET, test: true, base: "https://testnet.binance.vision/api" })

But I get: code: -2015, msg: 'Invalid API-key, IP, or permissions for action, request ip: 80.235.34.109'

Can Somebody help me to understand what is going on? I checked the API key and secret as well but they are correct. Thanks

sinamhbb avatar Feb 07 '21 17:02 sinamhbb

Same issue. I have tried tweaking too the principal script, to no avail.

iyenal avatar Feb 11 '21 18:02 iyenal

Nevermind, @sinamhbb use @pdwinkel options without test: true, in your case, as it overwrites the custom URLs configuration.

iyenal avatar Feb 12 '21 14:02 iyenal