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