Skip to content
Browse files

fixes in emulator

  • Loading branch information...
1 parent 95977c6 commit a036a4b30c3684c5014c16d8fe5d26fa8da9d43f @AlgoTrader committed Sep 12, 2012
Showing with 4 additions and 0 deletions.
  1. +2 −0 lib/emulator_bet.js
  2. +2 −0 lib/emulator_market.js
View
2 lib/emulator_bet.js
@@ -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)
View
2 lib/emulator_market.js
@@ -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;

0 comments on commit a036a4b

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