-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwallet.js
33 lines (27 loc) · 798 Bytes
/
wallet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require('dotenv').config();
const ccxt = require('ccxt');
const axios = require('axios');
const fs = require("fs-extra");
const walletAccount = async(binanceClient) => {
const wallet = await binanceClient.fetchBalance();
let obj = {};
Object.entries(wallet.free).forEach(([key, value]) => {
if(value > 0 && key != '1INCH'){
var objC = {};
objC = {free: value};
obj[key] = objC;
}
})
fs.writeJSON('portfolio.json',obj, function (err) {
if (err) return console.log(err);
console.log('Data write with success in portfolio.json');
});
}
const run = () => {
const binanceClient = new ccxt.binance({
apiKey: process.env.API_KEY,
secret: process.env.API_SECRET
});
walletAccount(binanceClient);
}
run();