public double CalculatePositionCurPnL() { double tempPnL = 0.0; if (Futures == null && Options.Count == 0) { return(tempPnL); } if (Futures == null) { tempPnL += (FixedPnL / Options[0].PriceStep * Options[0].PriceStepValue); } else { tempPnL += Futures.Position.CalcCurrentPnLInCurrency(Futures.GetTradeBlotter(), Futures.PriceStep, Futures.PriceStepValue); tempPnL += (FixedPnL / Futures.PriceStep * Futures.PriceStepValue); } foreach (Option opt in Options) { tempPnL += opt.Position.CalcCurrentPnLInCurrency(opt.GetTradeBlotter(), opt.PriceStep, opt.PriceStepValue); } return(tempPnL); }
public double CalculatePositionPnL() { double tempPnL = 0.0; tempPnL += Futures == null ? 0.0 : Futures.Position.CalcCurrentPnL(Futures.GetTradeBlotter()); tempPnL += FixedPnL; foreach (Option opt in Options) { tempPnL += opt.Position.CalcCurrentPnL(opt.GetTradeBlotter()); } return(tempPnL); }
public double GetCurrentPrice() { double price = 0.0; if (Options.Count > 0) { price = Options[0].Futures.GetTradeBlotter().AskPrice; } else if (Futures != null) { price = Futures.GetTradeBlotter().AskPrice; } return(price); }
public bool GetCurrentPriceIfPossible(out double price) { price = 0.0; bool result = false; if (Options.Count > 0) { price = Options[0].Futures.GetTradeBlotter().AskPrice; result = true; } else if (Futures != null) { price = Futures.GetTradeBlotter().AskPrice; result = true; } return(result); }