43 var closedPosition =
false;
55 var feeInAccountCurrency = 0m;
92 var lastTradeProfitInAccountCurrency = lastTradeProfit.InAccountCurrency;
95 var transactionProfitLoss = lastTradeProfitInAccountCurrency - 2 * feeInAccountCurrency;
98 transactionProfitLoss,
99 fill.IsWin(security, transactionProfitLoss));
104 if (quantityHoldings == 0)
124 if (quantityHoldings < 0)
129 else if (quantityHoldings == 0)
131 averageHoldingsPrice = 0;
144 if (quantityHoldings > 0)
149 else if (quantityHoldings == 0)
151 averageHoldingsPrice = 0;
165 catch (Exception err)
171 security.Holdings.SetHoldings(averageHoldingsPrice, quantityHoldings);
185 var quantityClosed = Math.Sign(-fill.
FillQuantity) * absoluteQuantityClosed;
189 var lastTradeProfit =
new ConvertibleCashAmount(closedSaleValueInQuoteCurrency.Amount - closedCost.Amount, closedSaleValueInQuoteCurrency.Cash);
197 return lastTradeProfit;