Skip to content

Commit

Permalink
fixes in emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
AlgoTrader committed Sep 12, 2012
1 parent 95977c6 commit a036a4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/emulator_bet.js
Expand Up @@ -89,6 +89,8 @@ EmulatorBet.prototype.matchWhole = function(price) {
// for lays, price<=betPrice
EmulatorBet.prototype.matchPortion = function(price, size) {
var self = this;
if( 1*self.size <0.001 )
return false;
if (1 * size > 1 * self.size)
return false;
if (self.betType == 'L' && 1 * price > 1 * self.price)
Expand Down
2 changes: 2 additions & 0 deletions lib/emulator_market.js
Expand Up @@ -568,6 +568,8 @@ function matchBetsUsingPrices(self, betlist) {
console.log("EMU: betId=%d selId=%s type=%s", bet.betId, bet.selectionId,
bet.betType);
console.log('EMU: best back=%j lay=%j', player.bestBack, player.bestLay);
if(bet.isMatched())
continue; // skip already matched bets
if (bet.betType === 'B') {
var bestBackPrice = player.bestBack.price;
var bestBackSize = player.bestBack.amount;
Expand Down

0 comments on commit a036a4b

Please sign in to comment.