· 6 years ago · Sep 18, 2019, 01:48 AM
1const api = require('binance');
2const binanceRest = new api.BinanceRest({
3 key: 'BvrJWAYFrR7UCsNHWyW7hmnUB8vfgIeW07H75xiMeCoBOdFu2k955kRTqrHfzBsX',
4 secret: 'oYnqXHkj6fNEk9ARTab3QFXmI96eW9jW3Ozd7LRJowOKeUVzbECCfKhWHnP4izZA',
5 timeout: 15000,
6 recvWindow: 10000,
7 disableBeautification: false,
8 handleDrift: false
9});
10
11
12
13const binanceWS = new api.BinanceWS(true);
14
15binanceRest.account(function(error, data) {
16
17 for(var i in data.balances) {
18
19 if(data.balances[i].locked > 0 || data.balances[i].free > 0) {
20 console.log(data.balances[i].locked);
21 }
22 }
23});
24
25binanceRest.depositHistory({asset:'BTC'}, function(error, data) {
26 var total = 0.0;
27 for(var i in data.depositList) {
28 total += data.depositList[i].amount;
29 }
30 console.log('Total depositos BTC ' , total);
31});
32
33binanceRest.withdrawHistory({asset:'BTC'}, function(error, data) {
34 var total = 0.0;
35 for(var i in data.withdrawList) {
36 total += data.withdrawList[i].amount;
37 }
38 console.log('Total retiradas BTC ' , total);
39});