Tag: Quantitative Finance

Coding towards CFA (23) – Parallel Monte Carlo Simulations with DolphinDB

Coding towards CFA (23) – Parallel Monte Carlo Simulations with DolphinDB

The Monte Carlo simulation method for pricing fixed-income instruments is introduced in CFA Level 2, Fixed Income, Module 2, Section 7. In this blog post, I will walk through the coding of the steps outlined in the CFA curriculum. The Monte Carlo approach can be computationally intensive, especially due to the need for simulating a … Continue reading Coding towards CFA (23) – Parallel Monte Carlo Simulations with DolphinDB

Coding towards CFA (22) – Simulating Future Interest Rates Path

Coding towards CFA (22) – Simulating Future Interest Rates Path

The interest rate term structure models are discussed in the CFA curriculum, Fixed Income, Module 2, Section 8. This section focuses on understanding how interest rates evolve over time, with models used to explain and predict the term structure of interest rates. Modeling the future path of interest rates is critical for a wide range … Continue reading Coding towards CFA (22) – Simulating Future Interest Rates Path

Coding towards CFA (21) – Calculate Z-Spread with QuantLib

Coding towards CFA (21) – Calculate Z-Spread with QuantLib

The Z-spread is an important metric for analysing the yield premium on a bond. It measures the constant spread over the benchmark yield curve, typically a risk-free curve, representing the additional credit or liquidity risks associated with the bond. Key features of Z-spread Risk-free benchmark - the Z-spread is measured with a risk-free curve as … Continue reading Coding towards CFA (21) – Calculate Z-Spread with QuantLib

Coding towards CFA (20) – Riding the Yield Curve with QuantLib

Coding towards CFA (20) – Riding the Yield Curve with QuantLib

"Riding the Yield Curve" is the topic covered in the CFA Fixed Income, Module 1, Section 3, "Active Bond Portfolio Management". In this blog post, I will simulate the approach discussed in the CFA curriculum with the support of the QuantLib library. "Riding the Yield Curve", also known as "Rolling Down the Yield Curve", is … Continue reading Coding towards CFA (20) – Riding the Yield Curve with QuantLib

Coding towards CFA (19) – Curve Fitting with QuantLib

Coding towards CFA (19) – Curve Fitting with QuantLib

In the previous blog post, I implemented the bootstrapping spot curve in both Python and DolphinDB. However, to boost productivity and improve reusability, it's more efficient to leverage an established quantitative library. QuantLib is a widely-used open-source library for fixed income and derivatives pricing, offering a variety of curve fitting methods and built-in bootstrapping functionality. … Continue reading Coding towards CFA (19) – Curve Fitting with QuantLib

Coding towards CFA (18) – Bootstrapping Spot Rate Curves

Coding towards CFA (18) – Bootstrapping Spot Rate Curves

The spot curve forms the foundation for pricing fixed income securities and interest rate-related instruments. It represents the yields on zero-coupon bonds across various maturities under current market conditions. By using the spot curve to discount the cash flows generated by these securities, we can derive their prices. The other rate, such as forward rates, … Continue reading Coding towards CFA (18) – Bootstrapping Spot Rate Curves

Coding towards CFA (17) – Implied Volatility Calculation

Coding towards CFA (17) – Implied Volatility Calculation

Implied volatility (IV) is a key metric in options trading and risk management. It is derived from the market price of an option and reflects the market's consensus view on the expected future volatility of the underlying asset. There is a lot of information that can be interpreted from IV. For example, high IV often … Continue reading Coding towards CFA (17) – Implied Volatility Calculation

Coding towards CFA (16) – Dynamic Delta Hedging with DolphinDB

Coding towards CFA (16) – Dynamic Delta Hedging with DolphinDB

Delta hedging is an options trading strategy used to maintain a delta neutral position by ensuring that the overall delta of a portfolio is zero, so that the price fluctuations of the underlying asset do not significantly impact the position’s value. Dynamic delta hedging involves continuously adjusting the hedging position to account for changes in … Continue reading Coding towards CFA (16) – Dynamic Delta Hedging with DolphinDB

Coding towards CFA (15) – Real-Time Option Greeks Calculation with DolphinDB

Coding towards CFA (15) – Real-Time Option Greeks Calculation with DolphinDB

In the previous blog post, we explored option Greeks calculations using the BSM model. In this post, I’ll have some coding fun by implementing real-time Greeks calculations with the formulas from the last post, but this time using the DolphinDB stream processing framework. Here, I plan to mimic a portfolio consisting of option contracts with … Continue reading Coding towards CFA (15) – Real-Time Option Greeks Calculation with DolphinDB

Coding towards CFA (14) – Options Greeks

Coding towards CFA (14) – Options Greeks

Options Greeks are key metrics used in options trading and risk management to measure how sensitive an option's price is a series of factors, including: Delta - measures the sensitivity of an option's price to the changes in the underlying asset's price. Gamma - measures the change rate of an option's Delta in respect to … Continue reading Coding towards CFA (14) – Options Greeks