0

Following the source code, I could access the asset in the Binance wallet but I could show the only in the console log. how could I export the asset value from the blog scope?

Source Code

const { Spot } = require("@binance/connector");

const apiKey =
  "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const apiSecret =
  "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const client = new Spot(apiKey, apiSecret);

client.account().then((response) => {
  const cryptoData = response.data;
  const { balances } = cryptoData;
    for (i = 0; i < balances.length; i++) {
      console.log(balances[i].asset, balances[i].free);
    }
});

Response

BTC 0.00000000
LTC 0.00000000
ETH 0.00000000
NEO 0.00000000
BNB 0.03147714
QTUM 0.00000000
EOS 0.00000000
SNT 0.00000000
470 more items
Sovann Sun
  • 21
  • 3
  • Are you trying to write the data to a file? If so you can use [`fs.writeFile`](https://stackoverflow.com/a/2497040/426858) – Lupina Nov 08 '22 at 11:47

0 Answers0