Skip to content

Commit 3f04413

Browse files
committed
stop updated
1 parent 9d9361f commit 3f04413

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

app.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,26 @@ eventEmitter.on('sell', () => {
7070
}
7171

7272
else {
73-
let btcBalance = balances.BTC.available;
74-
binance.marketSell(symbol, btcBalance);
73+
74+
binance.marketSell(symbol, balances.BTC.available);
7575
}
76+
console.log(balances.BTC.available);
7677
}) // binance.balance
7778
}) // end eventemitter.on('sell')
7879

7980
// S T O P
8081
eventEmitter.on('stop', () => {
81-
82+
8283
binance.balance((error, balances) => {
83-
8484
if ( error ) return console.error(error);
8585

86-
let btcBalance = balances.BTC.available;
87-
binance.marketSell(symbol, btcBalance);
86+
if( balances.BTC.available > 0) {
87+
btcBalance = parseFloat(balances.BTC.available);
88+
console.log(btcBalance);
89+
binance.marketSell(symbol, btcBalance);
90+
}
8891
}) // binance.balance
92+
8993
}) // end eventemitter.on('stop')
9094

9195
const server = http.createServer((req, res) => {

0 commit comments

Comments
 (0)