Skip to content

Commit

Permalink
Improved time source
Browse files Browse the repository at this point in the history
  • Loading branch information
GryphonR authored and askmike committed Sep 27, 2018
1 parent 0b634b1 commit 3756f6c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions plugins/pushbullet.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ Pushbullet.prototype.setup = function(done) {
exchange +
".";

if(config.trader.enabled){
if (config.trader.enabled) {
body += "\nLive Trading is enabled"
}
if(config.paperTrader.enabled){
if (config.paperTrader.enabled) {
body += "\nPaper Trading is enabled"
}
this.mail(title, body);
Expand All @@ -91,7 +91,7 @@ Pushbullet.prototype.processAdvice = function(advice) {
if (advice.recommendation == "soft" && pushbulletConfig.muteSoft) return;

this.advicePrice = this.price;
this.adviceTime = moment();
this.adviceTime = advice.date;

if (pushbulletConfig.sendOnAdvice) {

Expand Down Expand Up @@ -126,7 +126,7 @@ Pushbullet.prototype.processTradeCompleted = function(trade) {
slip = '1234';
}

let tradeTime = moment();
let tradeTime = trade.date;
let diff = tradeTime.diff(this.adviceTime);
let timeToComplete = moment.utc(diff).format("mm:ss");

Expand All @@ -148,10 +148,8 @@ Pushbullet.prototype.processTradeCompleted = function(trade) {
slip.toFixed(2), '%',
'\nAdvice Time: ',
this.adviceTime.format("h:mm:ss"),
'UTC',
'\nTrade Time: ',
tradeTime.format("h:mm:ss"),
'UTC',
'\nTime to Fill: ',
timeToComplete

Expand Down Expand Up @@ -185,4 +183,4 @@ Pushbullet.prototype.checkResults = function(err) {
log.info('Send advice via pushbullet message.');
};

module.exports = Pushbullet;
module.exports = Pushbullet;

0 comments on commit 3756f6c

Please sign in to comment.