9.1 Heath–Jarrow–Morton Model (1992)The Heath–Jarrow–Morton (HJM) FrameworkKey Concepts of the HJM FrameworkForward Rate as the Core VariableNo-Arbitrage ConditionZero-Coupon Bond PricingFlexibility in Volatility StructureSteps in Using the HJM FrameworkAdvantages of the HJM FrameworkLimitationsPractical ApplicationsMain Advantages of the HJM FrameworkSummaryBasic ImplementationCode AnalysisLibraries and SetupHJM Simulation FunctionRandom Number GenerationTime Steps and StorageForward Rate SimulationMain FunctionForward Rate RepresentationOutputOutput AnalysisVisualizationSummary9.2 Heath–Jarrow–Morton Model with No-Arbitrage Drift and Zero-Coupon Bond Pricing Using Multiple MaturitiesBasic ImplementationCode AnalysisKey Components and FunctionalitycomputeDriftpriceZeroCouponBondsimulateHJMmainSummaryKey OutputsLimitationsFinal ObservationsOutputOutput AnalysisVisualization9.3 Heath–Jarrow–Morton Model with No-Arbitrage Drift and Zero-Coupon Bond Pricing, Swaption Valuation, and Caplet and Floorlet PricingImplementationCode AnalysiscomputeDriftpriceZeroCouponBondcomputeDiscountFactorpriceSwaptionpriceCap and priceFloorsimulateHJMOutputAnalysis of the OutputForward Rates TableZero-Coupon Bond PricesPayer Swaption PricesCap PricesFloor PricesSummaryVisualization9.4 Brace, Gatarek, and Musiela (BGM, 1997) Model for Cap Pricing (with the Boost Library)Implementation Using the Boost LibraryCode AnalysisMain Function: cap_bgmCompute LIBOR Forward Rates (LFRs)Compute Integrated Volatility (BGM)Compute d1 for Caplet Pricing (BGM)Compute Caplet Prices (BGM)Total Cap Price (BGM)Black's Model for ComparisonTotal Cap Price (Black)Return ValueMain FunctionKey Differences Between BGM and Black ModelsOutputAnalysis of the OutputWhat Is a Cap?Interpretation of the PricesWhy Are the Prices Different?Volatility StructureModel AssumptionsNumerical DifferenceFinancial SignificanceSummary9.5 Brace, Gatarek, and Musiela (BGM, 1997) Model for Caps and Floors Using Multi-strike Prices and the Boost LibraryOverview of Caps and Floors, the BGM Model, and the Black ModelImplementation Using the Boost LibraryCode AnalysisHeaders and Utility FunctionsPricingResult StructureMain Pricing Function: cap_floor_bgmCompute LIBOR Forward RatesCompute Integrated Volatility (BGM)ProcessDebug Output (Forward Rates and Volatilities)Compute d1 for BGM PricingCompute Caplet and Floorlet Prices (BGM)Total Cap and Floor Prices (BGM)Black Model for ComparisonTotal Cap and Floor Prices (Black)Return ResultsMain FunctionSummaryOutputAnalysis of the OutputTable StructureUnderstanding Caps and FloorsBGM vs. BlackTrends and InsightsCap Prices Decrease with StrikeFloor Prices Increase with StrikeBGM vs. Black ModelForward Rates and VolatilityPractical ImplicationsSummaryVisualization9.6 Brace, Gatarek, and Musiela (BGM, 1997) Model for Caps, Floors, and Swaptions Using Multi-strike Prices and the Boost LibraryCode StructureImplementation Using the Boost LibraryCode Analysisnorm_cdfvector_norm_squaredPricingResult StructureMain Pricing Function: cap_floor_swaption_bgmCompute Integrated VolatilityDebug OutputCompute d1 for Caplets/FloorletsPrice Caplets and Floorlets (BGM)Total Cap and Floor Prices (BGM)Black Model for Caps and FloorsSwaption PricingSwap RateSwaption VolatilityBlack Swaption PriceReturn ResultsMain FunctionExecutionFinancial ConceptSwaptionsBGM vs. BlackVolatility CalibrationConclusionOutputAnalysis of the OutputOutput StructureAnalysis of ResultsForward Rates and Swap RateVolatilityModel ComparisonFinancial InterpretationSummaryVisualization9.7 Conclusion