Open proyectindar opened 2 years ago
Works fine to me
const Binance = require('node-binance-api');
const getClient = (apiKey, apiSecret) => {
return new Binance().options({
APIKEY: apiKey,
APISECRET: apiSecret
});
}
const binance = getClient(APIKEY, APISECRET);
Hello, Im getting this error:
Uncaught (in promise) TypeError: Binance is not a constructor
Im using docs constructor:
const Binance = require[('node-binance-api')]; const binance = new Binance().options({ APIKEY: 'XXXXX', APISECRET: 'YYYYY' });
I also tried the approach in example.js file on module folder:
const binance = require('node_modules/node-binance-api/node-binance-api.js'); binance.options({ 'APIKEY':'XXXXX', 'APISECRET':'YYYYY' });
But I get the next error:
Error: Cannot read properties of undefined (reading 'options')
At some posts I read that we need to import module adding .default option:
const Binance = require[('node-binance-api').default];
But is not working for me it drops same error with example approach.
Tried several ways like requiring directly node-binance-api.js file as example.js , but no way to put this toguether.
Any advice?
Thanks