Skip to content

Commit

Permalink
Library of functions for check of duplicate orders
Browse files Browse the repository at this point in the history
There is currently a bug in the engine that allows for a buy to occur when a buy is already active or a sell to occur when  a sell is already active these functions check for this condition and return true or false if this condition exists.  see DeviaVir#1629
  • Loading branch information
station384 committed Jun 22, 2018
1 parent 6a167ef commit 34539eb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/duporderworkaround.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
checkForPriorSell: function (s) {
return !s.api_order || (s.api_order && s.api_order.tradetype != 'sell' && s.api_order.status != 'open') || (s.api_order && s.api_order.tradetype == 'sell' && s.api_order.status == 'done')
},
checkForPriorBuy: function (s) {
return !s.api_order || (s.api_order && s.api_order.tradetype != 'buy' && s.api_order.status != 'open') || (s.api_order && s.api_order.tradetype == 'buy' && s.api_order.status == 'done')
}
}

0 comments on commit 34539eb

Please sign in to comment.