jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.58k stars 768 forks source link

🙋‍♂️ Question - testnet (https://testnet.binancefuture.com/) and balance #599

Closed olenderhub closed 3 years ago

olenderhub commented 3 years ago

Hello I tried to get balance for test https://testnet.binancefuture.com/

What I did:

const Binance = require('node-binance-api');
const binance = new Binance().options({
  APIKEY: 'myapikey',
  APISECRET: 'myapisecret',
  useServerTime: true,
  recvWindow: 60000
});
  binance.useServerTime(function() {
    binance.balance((error, balances) => {
      if ( error ) return console.error(error);
      console.log("balances()", balances);
      console.log("BNB balance: ", balances.BNB.available);
    });
  });

I got: body: '{"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}',

Can you explain me what I am doing wrong? Should I enable something somewhere on testnet? If yes, where?

Best regards Hubert

olenderhub commented 3 years ago

I just noticed that probably I used wrong test url and I probably should use https://testnet.binance.vision/

but still not sure how to configure it to play with testnet

olenderhub commented 3 years ago

https://github.com/jaggedsoft/node-binance-api/issues/527#issuecomment-748971850

that helped me. Now it works! :) I am closing this issue