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

Commit

Permalink
[GB] on global error log the action that received it
Browse files Browse the repository at this point in the history
  • Loading branch information
askmike committed Oct 25, 2018
1 parent 997c3a0 commit 6ac4719
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions exchange/orders/sticky.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class StickyOrder extends BaseOrder {
}

if(this.handleError(err)) {
console.log(new Date, 'handleCreate error');
return;
}

Expand Down Expand Up @@ -263,6 +264,7 @@ class StickyOrder extends BaseOrder {

this.api.checkOrder(this.id, (err, result) => {
if(this.handleError(err)) {
console.log(new Date, 'checkOrder error');
return;
}

Expand Down Expand Up @@ -299,9 +301,12 @@ class StickyOrder extends BaseOrder {
return;
}

// it's not open right now
// meaning we are done
this.sticking = false;

if(!result.executed) {
// not open and not executed means it never hit the book
this.sticking = false;
this.status = states.REJECTED;
this.emitStatus();
this.finish();
Expand All @@ -310,10 +315,8 @@ class StickyOrder extends BaseOrder {

// order got filled!
this.orders[this.id].filled = this.amount;
this.sticking = false;
this.emit('fill', this.amount);
this.filled(this.price);

});
}

Expand Down Expand Up @@ -375,6 +378,7 @@ class StickyOrder extends BaseOrder {

this.api.cancelOrder(this.id, (err, filled, data) => {
if(this.handleError(err)) {
console.log(new Date, 'error move');
return;
}

Expand Down Expand Up @@ -425,7 +429,7 @@ class StickyOrder extends BaseOrder {
) {
this.moveLimitTo = limit;
this.movingLimit = true;
return;
return true;
}

this.limit = this.roundPrice(limit);
Expand Down Expand Up @@ -527,6 +531,7 @@ class StickyOrder extends BaseOrder {

this.api.cancelOrder(this.id, (err, filled, data) => {
if(this.handleError(err)) {
console.log(new Date, 'error cancel');
return;
}

Expand Down Expand Up @@ -565,6 +570,7 @@ class StickyOrder extends BaseOrder {
// note this is a standalone function after the order is
// completed, as such we do not use the handleError flow.
if(err) {
console.log(new Date, 'error createSummary (checkOrder)')
return next(err);
}

Expand Down

0 comments on commit 6ac4719

Please sign in to comment.