Skip to content

Commit

Permalink
Added if exists with nonzero length check to last price lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
tinybike committed Oct 23, 2017
1 parent 6d2d93d commit e33e7ba
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/blockchain/log-processors/order-filled.ts
Expand Up @@ -75,6 +75,7 @@ export function calculateProfitLossInOutcome(augur: Augur, trx: Knex.Transaction
if (err) return callback(err);
trx.select("price").from("outcomes").where({ marketID, outcome }).asCallback((err: Error|null, outcomesRows?: Array<OutcomesRow>): void => {
if (err) return callback(err);
if (!outcomesRows || !outcomesRows.length) return callback(null);
const { price } = outcomesRows![0];
callback(null, augur.trading.calculateProfitLoss({ trades: userTradingHistory, lastPrice: price }));
});
Expand Down

0 comments on commit e33e7ba

Please sign in to comment.