public JamshidianSwaptionEngine(ShortRateModel model) : this(NQuantLibcPINVOKE.new_JamshidianSwaptionEngine__SWIG_1(ShortRateModel.getCPtr(model)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 2
0
 public TreeSwaptionEngine(ShortRateModel model, uint timeSteps) : this(NQuantLibcPINVOKE.new_TreeSwaptionEngine__SWIG_1(ShortRateModel.getCPtr(model), timeSteps), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 3
0
 public FdG2SwaptionEngine(ShortRateModel model, uint tGrid, uint xGrid, uint yGrid, uint dampingSteps, double invEps) : this(NQuantLibcPINVOKE.new_FdG2SwaptionEngine__SWIG_1(ShortRateModel.getCPtr(model), tGrid, xGrid, yGrid, dampingSteps, invEps), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 4
0
 public FdG2SwaptionEngine(ShortRateModel model, uint tGrid) : this(NQuantLibcPINVOKE.new_FdG2SwaptionEngine__SWIG_5(ShortRateModel.getCPtr(model), tGrid), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public G2SwaptionEngine(ShortRateModel model, double range, uint intervals) : this(NQuantLibcPINVOKE.new_G2SwaptionEngine(ShortRateModel.getCPtr(model), range, intervals), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 6
0
 public TreeSwaptionEngine(ShortRateModel model, TimeGrid grid, YieldTermStructureHandle termStructure) : this(NQuantLibcPINVOKE.new_TreeSwaptionEngine__SWIG_2(ShortRateModel.getCPtr(model), TimeGrid.getCPtr(grid), YieldTermStructureHandle.getCPtr(termStructure)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public ShortRateModelHandle(ShortRateModel arg0) : this(NQuantLibcPINVOKE.new_ShortRateModelHandle__SWIG_0(ShortRateModel.getCPtr(arg0)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 8
0
 public FdHullWhiteSwaptionEngine(ShortRateModel model, uint tGrid, uint xGrid, uint dampingSteps, double invEps, FdmSchemeDesc schemeDesc) : this(NQuantLibcPINVOKE.new_FdHullWhiteSwaptionEngine__SWIG_0(ShortRateModel.getCPtr(model), tGrid, xGrid, dampingSteps, invEps, FdmSchemeDesc.getCPtr(schemeDesc)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 9
0
        private static void calibrateModel(
            ShortRateModel model,
            CalibrationHelperVector helpers,
            double lambda)
        {
            Simplex om = new Simplex(lambda);

            model.calibrate(helpers, om,
                            new EndCriteria(1000, 250, 1e-7, 1e-7, 1e-7));

            // Output the implied Black volatilities
            for (int i = 0; i < numRows; i++)
            {
                int    j   = numCols - i - 1; // 1x5, 2x4, 3x3, 4x2, 5x1
                int    k   = i * numCols + j;
                double npv =
                    NQuantLibc.as_black_helper(helpers[i]).modelValue();
                double implied =
                    NQuantLibc.as_black_helper(helpers[i]).impliedVolatility(
                        npv,
                        1e-4,
                        1000,
                        0.05,
                        0.50);
                double diff = implied - swaptionVols[k];

                Console.WriteLine("{0}x{1}: model {2}, market {3} ({4})",
                                  i + 1, swapLengths[j], implied, swaptionVols[k], diff);
            }
        }
 public JamshidianSwaptionEngine(ShortRateModel model, YieldTermStructureHandle termStructure) : this(NQuantLibcPINVOKE.new_JamshidianSwaptionEngine__SWIG_0(ShortRateModel.getCPtr(model), YieldTermStructureHandle.getCPtr(termStructure)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 11
0
 public TreeSwaptionEngine(ShortRateModel model, TimeGrid grid) : this(NQuantLibcPINVOKE.new_TreeSwaptionEngine__SWIG_3(ShortRateModel.getCPtr(model), TimeGrid.getCPtr(grid)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 12
0
 public TreeCapFloorEngine(ShortRateModel model, uint timeSteps, YieldTermStructureHandle termStructure) : this(NQuantLibcPINVOKE.new_TreeCapFloorEngine__SWIG_0(ShortRateModel.getCPtr(model), timeSteps, YieldTermStructureHandle.getCPtr(termStructure)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 13
0
        static void CalibrateModel(ShortRateModel model,
                                   List <CalibrationHelper> helpers)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            var om = new LevenbergMarquardt();

            model.calibrate(helpers, om,
                            new EndCriteria(400, 100, 1.0e-8, 1.0e-8, 1.0e-8), new Constraint(),
                            new List <double>());

            // Output the implied Black volatilities
            for (int i = 0; i < NumRows; i++)
            {
                int    j       = NumCols - i - 1; // 1x5, 2x4, 3x3, 4x2, 5x1
                int    k       = i * NumCols + j;
                double npv     = helpers[i].modelValue();
                double implied = helpers[i].impliedVolatility(npv, 1e-4,
                                                              1000, 0.05, 0.50);
                double diff = implied - SwaptionVols[k];
                Console.WriteLine("{0}x{1}: model {2:0.00000 %}, market {3:0.00000 %}, diff {4:0.00000 %} ",
                                  i + 1, SwapLenghts[j], implied, SwaptionVols[k], diff);
            }
        }
 public AnalyticCapFloorEngine(ShortRateModel model) : this(NQuantLibcPINVOKE.new_AnalyticCapFloorEngine__SWIG_1(ShortRateModel.getCPtr(model)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public void linkTo(ShortRateModel arg0)
 {
     NQuantLibcPINVOKE.RelinkableShortRateModelHandle_linkTo(swigCPtr, ShortRateModel.getCPtr(arg0));
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
        public ShortRateModel __deref__()
        {
            ShortRateModel ret = new ShortRateModel(NQuantLibcPINVOKE.ShortRateModelHandle___deref__(swigCPtr), true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 17
0
        public ShortRateModel __deref__()
        {
            global::System.IntPtr cPtr = NQuantLibcPINVOKE.ShortRateModelHandle___deref__(swigCPtr);
            ShortRateModel        ret  = (cPtr == global::System.IntPtr.Zero) ? null : new ShortRateModel(cPtr, true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 18
0
        private static void CalibrateModel(ShortRateModel model, CalibrationHelperVector helpers, double lambda)
        {
            var om = new Simplex(lambda);

            model.calibrate(helpers, om, new EndCriteria(1000, 250, 1e-7, 1e-7, 1e-7));

            // Output the implied Black volatilities
            for (int i = 0; i < NUM_ROWS; i++)
            {
                int    j       = NUM_COLS - i - 1; // 1x5, 2x4, 3x3, 4x2, 5x1
                int    k       = i * NUM_COLS + j;
                double npv     = NQuantLibc.as_black_helper(helpers[i]).modelValue();
                double implied = NQuantLibc.as_black_helper(helpers[i]).impliedVolatility(npv, 1e-4, 1000, 0.05, 0.50);
                double diff    = implied - SWAPTION_VOLS[k];

                Console.WriteLine("{0}x{1}: model {2}, market {3} ({4})", i + 1, SWAP_LENGHTS[j], implied, SWAPTION_VOLS[k], diff);
            }
        }
Esempio n. 19
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ShortRateModel obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Esempio n. 20
0
 public TreeSwaptionEngine(ShortRateModel model, TimeGrid grid) : this(NQuantLibcPINVOKE.new_TreeSwaptionEngine__SWIG_3(ShortRateModel.getCPtr(model), TimeGrid.getCPtr(grid)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
Esempio n. 21
0
 public TreeSwaptionEngine(ShortRateModel model, TimeGrid grid, YieldTermStructureHandle termStructure) : this(NQuantLibcPINVOKE.new_TreeSwaptionEngine__SWIG_2(ShortRateModel.getCPtr(model), TimeGrid.getCPtr(grid), YieldTermStructureHandle.getCPtr(termStructure)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
Esempio n. 22
0
 public TreeSwaptionEngine(ShortRateModel model, uint timeSteps) : this(NQuantLibcPINVOKE.new_TreeSwaptionEngine__SWIG_1(ShortRateModel.getCPtr(model), timeSteps), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
Esempio n. 23
0
 public ShortRateModel __deref__() {
   ShortRateModel ret = new ShortRateModel(NQuantLibcPINVOKE.ShortRateModelHandle___deref__(swigCPtr), true);
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Esempio n. 24
0
 public G2SwaptionEngine(ShortRateModel model, double range, uint intervals) : this(NQuantLibcPINVOKE.new_G2SwaptionEngine(ShortRateModel.getCPtr(model), range, intervals), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
Esempio n. 25
0
 public ShortRateModelHandle(ShortRateModel arg0) : this(NQuantLibcPINVOKE.new_ShortRateModelHandle__SWIG_0(ShortRateModel.getCPtr(arg0)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
 public TreeCallableFixedRateBondEngine(ShortRateModel model, uint timeSteps, YieldTermStructureHandle termStructure) : this(NQuantLibcPINVOKE.new_TreeCallableFixedRateBondEngine__SWIG_0(ShortRateModel.getCPtr(model), timeSteps, YieldTermStructureHandle.getCPtr(termStructure)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
Esempio n. 27
0
 public AnalyticCapFloorEngine(ShortRateModel model, YieldTermStructureHandle termStructure) : this(NQuantLibcPINVOKE.new_AnalyticCapFloorEngine__SWIG_0(ShortRateModel.getCPtr(model), YieldTermStructureHandle.getCPtr(termStructure)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
Esempio n. 28
0
 public AnalyticCapFloorEngine(ShortRateModel model) : this(NQuantLibcPINVOKE.new_AnalyticCapFloorEngine__SWIG_1(ShortRateModel.getCPtr(model)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
Esempio n. 29
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ShortRateModel obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Esempio n. 30
0
 public JamshidianSwaptionEngine(ShortRateModel model) : this(NQuantLibcPINVOKE.new_JamshidianSwaptionEngine__SWIG_1(ShortRateModel.getCPtr(model)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }