}
int signedTradeAmount = orderInfo.order.getSide() == OrderSide.BUY ? tradeAmount : -tradeAmount;
double tradeCommissionAmount = commissionCalculator.calculateCommission(orderInfo.order, tradeAmount, executionPrice);
double tradeCashFlow = -(signedTradeAmount * multiplier * executionPrice) - tradeCommissionAmount;
double tradeAveragePrice = Math.abs(tradeCashFlow / multiplier / tradeAmount);
TradeBean trade = new TradeBean(orderInfo.order, "Simulated", getLastPriceTimestamp(contract), tradeAmount, executionPrice, tradeAveragePrice);
trades.add(trade);
positionCalculator.onTrade(trade);
for (IOrderStatusListener listener : orderStatusListeners) {
listener.onOrderFilled(Integer.toString(orderInfo.internalId), tradeAmount, orderInfo.order.getAmount() == tradeAmount, executionPrice);
}