Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Adding order completion messages to notifications (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsrikanth authored and DeviaVir committed Oct 24, 2017
1 parent d2b2312 commit 8a9a8b4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,11 @@ module.exports = function container (get, set, clear) {
}
s.my_trades.push(my_trade)
if (so.stats) {
console.log(('\nbuy order completed at ' + moment(trade.time).format('YYYY-MM-DD HH:mm:ss') + ':\n\n' + fa(my_trade.size) + ' at ' + fc(my_trade.price) + '\ntotal ' + fc(my_trade.size * my_trade.price) + '\n' + n(my_trade.slippage).format('0.0000%') + ' slippage (orig. price ' + fc(s.buy_order.orig_price) + ')\nexecution: ' + moment.duration(my_trade.execution_time).humanize() + '\n').cyan)
order_complete = '\nbuy order completed at ' + moment(trade.time).format('YYYY-MM-DD HH:mm:ss') + ':\n\n' + fa(my_trade.size) + ' at ' + fc(my_trade.price) + '\ntotal ' + fc(my_trade.size * my_trade.price) + '\n' + n(my_trade.slippage).format('0.0000%') + ' slippage (orig. price ' + fc(s.buy_order.orig_price) + ')\nexecution: ' + moment.duration(my_trade.execution_time).humanize() + '\n'
console.log((order_complete).cyan)
if (so.mode === 'live' || so.mode === 'paper') {
notify.pushMessage('Buy', order_complete)
}
}
s.last_buy_price = my_trade.price
delete s.buy_order
Expand Down Expand Up @@ -617,7 +621,11 @@ module.exports = function container (get, set, clear) {
}
s.my_trades.push(my_trade)
if (so.stats) {
console.log(('\nsell order completed at ' + moment(trade.time).format('YYYY-MM-DD HH:mm:ss') + ':\n\n' + fa(my_trade.size) + ' at ' + fc(my_trade.price) + '\ntotal ' + fc(my_trade.size * my_trade.price) + '\n' + n(my_trade.slippage).format('0.0000%') + ' slippage (orig. price ' + fc(s.sell_order.orig_price) + ')\nexecution: ' + moment.duration(my_trade.execution_time).humanize() + '\n').cyan)
order_complete = '\nsell order completed at ' + moment(trade.time).format('YYYY-MM-DD HH:mm:ss') + ':\n\n' + fa(my_trade.size) + ' at ' + fc(my_trade.price) + '\ntotal ' + fc(my_trade.size * my_trade.price) + '\n' + n(my_trade.slippage).format('0.0000%') + ' slippage (orig. price ' + fc(s.sell_order.orig_price) + ')\nexecution: ' + moment.duration(my_trade.execution_time).humanize() + '\n'
console.log((order_complete).cyan)
if (so.mode === 'live' || so.mode === 'paper') {
notify.pushMessage('Sell', order_complete)
}
}
s.last_sell_price = my_trade.price
delete s.sell_order
Expand Down

0 comments on commit 8a9a8b4

Please sign in to comment.