0

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

aRvi
  • 2,203
  • 1
  • 14
  • 30
M.J.
  • 15
  • 4

1 Answers1

0
  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

Teerapat
  • 112
  • 2
  • 7
  • Thanks for the response. However, just to clarify my question, how to run binace-api-model? is it through cmd or through html page? any keywords or guide to guide me in this matter. This is the first time for me to use node js module :) – M.J. Sep 27 '20 at 12:48
  • Could you elaborate more details about the errors you've encountered to? – Teerapat Sep 27 '20 at 14:03
  • I just learned about commonjs and ES6. Sorry this comment is outside of my posted question. I have been trying to connect to Binance user api, I am trying to use the code I post without using the node js modul which is call binance-api-node, is there way to do that? – M.J. Sep 27 '20 at 14:44