コード例 #1
0
ファイル: Collar.cs プロジェクト: zhangz/Highlander.Net
        /// <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);
        }
コード例 #2
0
 /// <summary>
 /// Sets the strike.
 /// </summary>
 /// <param name="strike">The strike.</param>
 public void SetStrike(Strike strike)
 {
     Strike = strike;
 }
コード例 #3
0
 /// <summary>
 /// Sets the strike.
 /// </summary>
 /// <param name="style">The style.</param>
 /// <param name="strikePrice">The strike price.</param>
 public void SetStrike(OptionType style, Double strikePrice)
 {
     Strike = new Strike(style, strikePrice);
 }