示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Stock"/> class.
 /// </summary>
 /// <param name="stockId">The stock id.</param>
 /// <param name="name">The name.</param>
 /// <param name="dividends">The dividends.</param>
 /// <param name="wingCurvature">The wing curvature.</param>
 public Stock(string stockId, string name, DividendList dividends, WingCurvature[] wingCurvature)
 {
     ValidateInput(stockId, name, dividends, wingCurvature);
     Id            = stockId;
     Name          = name;
     Dividends     = dividends;
     WingCurvature = wingCurvature;
 }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="underlying"></param>
        /// <param name="spot"></param>
        /// <param name="putStrike"></param>
        /// <param name="style"></param>
        /// <param name="tradeDate"></param>
        /// <param name="expiryDate"></param>
        /// <param name="zeroArray"></param>
        /// <param name="divArray"></param>
        /// <param name="orcParams"></param>
        /// <returns></returns>
        public static double CallCollarPricer(String underlying, double spot, double putStrike,
                                              string style, DateTime tradeDate, DateTime expiryDate, List <ZeroCurveRange> zeroArray,
                                              List <DividendRange> divArray, WingParamsRange orcParams)
        {
            // Skew;
            WingCurvature[] wingCurve = Wrapper.UnpackWing(orcParams, tradeDate);
            // Dividends;
            DividendList dList = Wrapper.UnpackDiv(divArray);
            // ZeroCurve;
            ZeroAUDCurve zeroCurve = Wrapper.UnpackZero(zeroArray, tradeDate);
            var          ist       = new Stock(underlying, underlying, dList, wingCurve);
            //test the price
            var col = new Collar();
            var tr  = new TransactionDetail(underlying)
            {
                CurrentSpot = spot
            };

            if (style == "A")
            {
                tr.PayStyle = PayStyleType.American;
            }
            else if (style == "E")
            {
                tr.PayStyle = PayStyleType.European;
            }
            else
            {
                tr.PayStyle = PayStyleType.NotSpecified;
            }
            tr.TradeDate    = tradeDate;
            tr.ExpiryDate   = expiryDate;
            ist.Transaction = tr;
            //test collar
            var testSt = new Strike(OptionType.Put, putStrike);

            ist.Transaction.SetStrike(testSt);
            double callStrike = col.FindZeroCostCallStrike(ist, zeroCurve);

            return(callStrike);
        }