/// <summary> /// Finds the zero cost put strike. /// </summary> /// <param name="stock">The stock.</param> /// <param name="zeroRateCurve">The zero rate curve.</param> /// <returns></returns> public Double FindZeroCostPutStrike(Stock stock, ZeroAUDCurve zeroRateCurve) { // Unpack objects ZeroCurve myZero = Wrapper.UnpackZeroRateCurve(zeroRateCurve); DivList myDiv = Wrapper.UnpackDividends(stock, zeroRateCurve); var myORC = Wrapper.UnpackOrcWingParameters(stock); // TimeSpan ts = stock.Transaction.ExpiryDate - stock.Transaction.TradeDate; double t = ts.Days / 365.0; string payFlag = stock.Transaction.PayStyle.ToString().Substring(0, 1).ToUpper(); string style = stock.Transaction.Strike.Style.ToString().Substring(0, 1).ToUpper(); double price = Analytics.Equities.Collar.FindZeroCostPut(myZero, myDiv, myORC, t, stock.Transaction.Strike.StrikePrice, stock.Transaction.CurrentSpot, payFlag, style, 100.0); return(price); }
/// <summary> /// Finds the zero cost strike. /// </summary> /// <param name="optionType">Type of the option.</param> /// <param name="stock">The stock.</param> /// <param name="zeroRateCurve">The zero rate curve.</param> /// <returns></returns> public Double FindZeroCostStrike(OptionType optionType, Stock stock, ZeroAUDCurve zeroRateCurve) { Double price; switch (optionType) { case OptionType.Call: price = FindZeroCostCallStrike(stock, zeroRateCurve); break; case OptionType.Put: price = FindZeroCostPutStrike(stock, zeroRateCurve); break; default: throw new ArgumentException("Option Type must be specified"); } return(price); }
/// <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); }