Example #1
0
 /// <summary>
 /// Transactions the complete.
 /// </summary>
 /// <param name="transaction">The transaction.</param>
 internal static void TransactionComplete(TransactionDetail transaction)
 {
     InputValidator.NotZero("Spot Price", transaction.CurrentSpot, true);
     InputValidator.NotNull("Trade Date", transaction.TradeDate, true);
     InputValidator.NotNull("Expiry Date", transaction.ExpiryDate, true);
     InputValidator.EnumTypeNotSpecified("Pay Style", transaction.PayStyle, true);
     if (transaction.ExpiryDate <= transaction.TradeDate)
     {
         throw new InvalidValueException(
                   $"Expiry date {transaction.ExpiryDate} must fall after the Trade Darte {transaction.TradeDate}");
     }
 }
Example #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);
        }