Skip to content
This repository
Browse code

fixes in emulator

  • Loading branch information...
commit a036a4b30c3684c5014c16d8fe5d26fa8da9d43f 1 parent 95977c6
AlgoTrader authored

Showing 2 changed files with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. +2 0  lib/emulator_bet.js
  2. +2 0  lib/emulator_market.js
2  lib/emulator_bet.js
@@ -89,6 +89,8 @@ EmulatorBet.prototype.matchWhole = function(price) {
89 89 // for lays, price<=betPrice
90 90 EmulatorBet.prototype.matchPortion = function(price, size) {
91 91 var self = this;
  92 + if( 1*self.size <0.001 )
  93 + return false;
92 94 if (1 * size > 1 * self.size)
93 95 return false;
94 96 if (self.betType == 'L' && 1 * price > 1 * self.price)
2  lib/emulator_market.js
@@ -568,6 +568,8 @@ function matchBetsUsingPrices(self, betlist) {
568 568 console.log("EMU: betId=%d selId=%s type=%s", bet.betId, bet.selectionId,
569 569 bet.betType);
570 570 console.log('EMU: best back=%j lay=%j', player.bestBack, player.bestLay);
  571 + if(bet.isMatched())
  572 + continue; // skip already matched bets
571 573 if (bet.betType === 'B') {
572 574 var bestBackPrice = player.bestBack.price;
573 575 var bestBackSize = player.bestBack.amount;

0 comments on commit a036a4b

Please sign in to comment.
Something went wrong with that request. Please try again.