run binance-api-node module

1k views Asked by At

I used npm to install the Binance API node. I reach to the following step:

import Binance from 'binance-api-node'

const client = Binance()

// Authenticated client, can make signed calls
const client2 = Binance({
  apiKey: 'xxx',
  apiSecret: 'xxx',
  getTime: xxx, // time generator function, optional, defaults to () => Date.now()
})

client.time().then(time => console.log(time))

Could you please guide me on how to run this part. The node module could be found on https://github.com/Ashlar/binance-api-node

1

There are 1 answers

3
Teerapat On BEST ANSWER
  1. You'll need to create your API key following this doc

2. Once you have your API key and secret key, you store in apiKey and apiSecret respectively. 3. If you do not have an appropriate babel config, you will need to use the basic commonjs requires. const Binance = require('binance-api-node').default instead of ES6 import