Exemplo n.º 1
0
        public PLSerious CalculatePLs(OptionCombination optComb, DateTime calculationDate,
                                      decimal lowPrice, decimal highPrice, decimal interest, double volatility)
        {
            PLSerious plSerious = new PLSerious();

            plSerious.CalculationDate = calculationDate;
            plSerious.Volatility      = volatility;

            decimal interval = (highPrice - lowPrice) / 30;

            decimal equityPrice = lowPrice;

            while (equityPrice < highPrice + interval)
            {
                PLPoint plPoint = new PLPoint();
                plPoint.EquityPrice = equityPrice;

                foreach (OpenOption openOpt in optComb)
                {
                    decimal optPrice = CalcualtePrice(openOpt.Option, equityPrice, interest, calculationDate, volatility);

                    plPoint.Profit += (optPrice - openOpt.PurchasePrice) * openOpt.ContractNo * 100;
                }

                plSerious.PLPointSerious.Add(plPoint);

                equityPrice += interval;
            }

            return(plSerious);
        }
Exemplo n.º 2
0
        public PLSerious CalculatePLs(OptionCombination optComb, DateTime calculationDate, 
            decimal lowPrice, decimal highPrice, decimal interest, double volatility)
        {
            PLSerious plSerious = new PLSerious();
            plSerious.CalculationDate = calculationDate;
            plSerious.Volatility = volatility;

            decimal interval = (highPrice - lowPrice) / 30;

            decimal equityPrice = lowPrice;

            while (equityPrice < highPrice+interval)
            {
                PLPoint plPoint = new PLPoint();
                plPoint.EquityPrice = equityPrice;

                foreach (OpenOption openOpt in optComb)
                {
                    decimal optPrice = CalcualtePrice(openOpt.Option, equityPrice, interest, calculationDate, volatility);

                    plPoint.Profit += (optPrice - openOpt.PurchasePrice) * openOpt.ContractNo *100;
                }

                plSerious.PLPointSerious.Add(plPoint);

                equityPrice += interval;
            }

            return plSerious;
        }