# What are some factually incorrect quantitative finance answers generated by AI?

One question and AI-generated response per answer. Community wiki flag and an explanation of why the AI response is wrong are encouraged. The AI program can optionally be identified. Including the date that the answer was provided by the AI will be useful as well, as AI models typically improve over time

This is likely to be useful and educational - not just entertaining.

• Pretty cool question! Commented Sep 26, 2023 at 18:10
• I see that all of the answers that specify a model mention ChatGPT version 3.5. I understand the desire not to give money to the so-called OpenAI, but since they claim that version 4.0 has better "creativity and advanced reasoning," and there seems to be some degree of truth to that hyperbolic assertion, perhaps it would be good to have some from that model as well. Surely only one person needs to pay to test whether the answers change between models, right? Commented Sep 27, 2023 at 10:48
• Can ChatGPT Pass The CFA Exam? AI Researchers Tried To Find Out Commented Nov 5, 2023 at 15:22

Question: "How do you convert annual yield quote to semi-annual?"

To convert an annual yield quote to semi-annual, you simply divide the annual yield by two. This is because semi-annual yields are calculated based on two compounding periods per year.

For example, if a bond has an annual yield of 5%, then its semi-annual yield would be 2.5%:

Semi-annual yield = Annual yield / 2

Semi-annual yield = 5% / 2

Semi-annual yield = 2.5%

It is important to note that converting annual yield quotes to semi-annual does not change the underlying yield of the bond. It simply makes it easier to compare yields on bonds with different coupon frequencies and to other fixed-income securities.

In general, if $$f_1$$ and $$f_2$$ are frequencies (1 - annual, 2 - semiannual, 4 - quarterly, 12 - monthly...), and $$y_{f_1}$$ and $$y_{f_2}$$ denote the yields corresponding to these frequencies, then $${\left(1+\frac{y_{f_1}}{f_1}\right)}^{f_1}={\left(1+\frac{y_{f_2}}{f_2}\right)}^{f_2}$$, so $$y_{f_2} = \left(\left(1+\frac{y_{f_1}}{f_1} \right)^{\frac{f_1}{f_2}} -1 \right)\times {f_2}$$.

In this concrete case, $$f_1=1$$, $$f_2=2$$, $$y_2 = \left(\left(1+y_1 \right)^{\frac{1}{2}} -1 \right)\times {2}.$$

• i think it will give you the correct answer if you add "assuming compounding" at the end of your original question Commented Sep 26, 2023 at 8:09
• Although the question, as currently written, doesn't require it, I think specifying the AI engine that was used to generate the answer (and on what date) will greatly increase the answer's usefulness and longevity. Commented Sep 26, 2023 at 8:59
• thanks. It's clear to a human reader, but apparently not to the AI, that semi-annual refers to the compounding frequency. Commented Sep 26, 2023 at 15:54

A classic:

Does Modern Portfolio Theory as proposed by Markowitz assume normality of returns?

ChatGPT:

Yes, Modern Portfolio Theory (MPT) as proposed by Markowitz does assume normality of returns. It assumes that the returns of individual assets are normally distributed, which means that they follow a bell-shaped curve. This assumption allows for the calculation of expected returns and risk measures such as variance and standard deviation, which are central to MPT's optimization process of constructing efficient portfolios. However, it is important to note that in practice, asset returns often do not strictly follow a normal distribution, and this assumption is one of the limitations of MPT.

The foundational 1952 paper does not mention "normality" or "gaussianity" anywhere and indeed the whole theory remains valid as long as second moment ($$\Sigma$$) exists.

• This one makes "sense" since I've heard so many humans (and likely writing humans) erroneously mention it when discussing MPT Commented Sep 27, 2023 at 4:57

Question:

Can a portfolio that is efficient (meaning that it lies on the Capital Market Line) be undervalued (i.e. having a positive alpha)?

ChatGPT

Yes, it is possible for a portfolio that lies on the Capital Market Line (CML), also known as the efficient frontier, to be undervalued, meaning it has a positive alpha. Let's break down how this can occur:

Efficient Portfolio on the CML: An efficient portfolio on the CML is constructed using a combination of risky assets (typically stocks)


and a risk-free asset (such as government bonds). This portfolio represents the optimal trade-off between risk and return given the available set of assets. In other words, it has the highest expected return for a given level of risk (standard deviation).

Alpha: Alpha measures the excess return of a portfolio or investment compared to its expected return, given its level of risk. A


positive alpha indicates that the portfolio has outperformed its expected return, while a negative alpha suggests underperformance.

Now, here's how a portfolio on the CML can have a positive alpha:

The CML is constructed based on historical data, expected returns, and risk measurements. It represents a theoretical benchmark that


assumes markets are perfectly efficient and asset prices reflect all available information.

Real-world conditions often deviate from the idealized assumptions of market efficiency. Factors such as market sentiment, behavioral


biases, or temporary mispricing of assets can lead to opportunities for skilled investors to generate returns that exceed what the CML would predict.

Skilled portfolio managers, through active management or exploiting market inefficiencies, can construct portfolios that


perform better than the CML's predictions. This outperformance, if sustained, results in a positive alpha.

However, it's important to note that generating a positive alpha is not easy and typically requires expertise, research, and the


ability to identify mispriced assets or market inefficiencies.

In summary, while the Capital Market Line represents the efficient frontier of portfolios based on market data and expectations, real-world conditions and investor skill can lead to portfolios that outperform this benchmark, resulting in a positive alpha. Positive alpha suggests that the portfolio has added value beyond what would be expected based on its risk and the theoretical CML.

This is definitely not correct. An efficient portfolio that lies on the Capital Market Line must have zero alpha (and be in equilibrium). The opposite is not true.

True or false. A mean-variance investor, when deciding between multiple portfolios to add to an already well diversified portfolio, should pick the portfolio with the highest sharpe ratio.

This is false. It should be the one with the highest appraisal ratio. AI always says it's true.

Edit: @Dimitri just tried, answer below:

"Should a mean-variance investor deciding between multiple portfolios to add to an already well diversified portfolio pick the portfolio with the highest Sharpe ratio or the highest appraisal ratio?" and the AI said: " A mean-variance investor should pick the portfolio with the highest Sharpe ratio when deciding between multiple portfolios to add to an already well-diversified portfolio. The Sharpe ratio is a measure of risk-adjusted return, and it is calculated by dividing the excess return of an investment by its standard deviation. Excess return is is the return of an investment in excess of the risk-free rate, such as the yield on Treasury bills. The appraisal ratio is a measure of absolute return, and it is calculated by dividing the return of an investment by the risk-free rate. It does not take into account the riskiness of the investment. A mean-variance investor is interested in maximizing their expected return for a given level of risk, or minimizing their risk for a given level of expected return. The Sharpe ratio is a better measure of risk-adjusted return than the appraisal ratio because it takes into account the riskiness of the investment. In the example you provided, portfolio 2 has a higher Sharpe ratio than portfolio 1. This means that portfolio 2 offers a higher expected return per unit of risk than portfolio 1. Therefore, a mean-variance investor should pick portfolio 2 to add to their already well-diversified portfolio. However, it is important to note that the Sharpe ratio is a historical measure, and it does not guarantee future performance"

• Yes, I just tried: "Should a mean-variance investor deciding between multiple portfolios to add to an already well diversified portfolio pick the portfolio with the highest Sharpe ratio or the highest appraisal ratio?" and the AI said: " A mean-variance investor should pick the portfolio with the highest Sharpe ratio when deciding between multiple portfolios to add to an already well-diversified portfolio. The Sharpe ratio is a measure of risk-adjusted return, and it is calculated by dividing the excess return of an investment by its standard deviation. Excess return is (cont) Commented Sep 26, 2023 at 14:31
• (cont) is the return of an investment in excess of the risk-free rate, such as the yield on Treasury bills. The appraisal ratio is a measure of absolute return, and it is calculated by dividing the return of an investment by the risk-free rate. It does not take into account the riskiness of the investment. A mean-variance investor is interested in maximizing their expected return for a given level of risk, or minimizing their risk for a given level of expected return. The Sharpe ratio is a better measure of risk-adjusted return than the appraisal ratio (cont) Commented Sep 26, 2023 at 14:32
• (cont) , because it takes into account the riskiness of the investment. In the example you provided, portfolio 2 has a higher Sharpe ratio than portfolio 1. This means that portfolio 2 offers a higher expected return per unit of risk than portfolio 1. Therefore, a mean-variance investor should pick portfolio 2 to add to their already well-diversified portfolio. However, it is important to note that the Sharpe ratio is a historical measure, and it does not guarantee future performance..." Commented Sep 26, 2023 at 14:33

How is the CBOE VIX calculated?

The CBOE Volatility Index, often referred to as the VIX, is calculated using a formula that involves the prices of a specific set of options on the S&P 500 index. The VIX is a measure of implied volatility, or expected market volatility, over a certain period of time. It is commonly known as the "fear gauge" because it tends to rise when there is uncertainty or fear in the financial markets.

Here is a simplified explanation of how the VIX is calculated:

1. Selection of Options: The CBOE selects a range of call and put options on the S&P 500 index with various expiration dates. These options are typically short-term options with expiration dates ranging from 23 to 37 days.

2. Calculation of Implied Volatility: The CBOE calculates the implied volatility for each of the selected options using the prices at which these options are trading in the market. Implied volatility represents the market's expectations for future volatility.

3. Weighting: The implied volatilities calculated in step 2 are then weighted to give more weight to options that are closer to the current market price of the S&P 500 index. This is done to reflect the sensitivity of options prices to changes in the underlying index.

4. Aggregation: The weighted implied volatilities are aggregated to calculate the VIX. The VIX is essentially the square root of the weighted average of the squared implied volatilities. The formula looks like this:

VIX = 100 * √(T * Σ[Weight * (Implied Volatility^2)])

Where:

• T is the time to expiration of the options, expressed as a fraction of a year.
• Σ represents the summation over all the selected options.
• Weight is the weight assigned to each option based on its proximity to the current S&P 500 index level.
• Implied Volatility is the calculated implied volatility of each option.
5. Annualization: Finally, the VIX is annualized by multiplying it by the square root of 12, as options prices are typically quoted on an annualized basis.

The resulting VIX value represents the expected annualized volatility of the S&P 500 index over the specified time frame, usually around one month. It provides insight into market sentiment and is widely used by traders and investors to gauge market risk and make informed decisions.

Please note that the actual calculation involves more intricate details, including interpolation and extrapolation of option prices, to ensure a continuous time series. The CBOE regularly updates the methodology for calculating the VIX to maintain its accuracy and relevance.

Correct answer The VIX methodology is neither computing implied vols from options, nor is it giving more weight to options closer to the current market price. The current formula uses weights that are being inversely proportional to squared strikes (1/K2) and option prices directly (not IV). See here for a simple (graphical) explanation.

how is the CBOE VIX currently calculated

As of my last knowledge update in September 2021, the CBOE VIX (Volatility Index), also known as the "fear gauge," was calculated using the methodology I described earlier.

However, the current VIX methodology was introduced in 2003 (ignoring weekly options that were added in 2014).

## Question

How do I calculate the OAS spread of a bond?

The Option-Adjusted Spread (OAS) of a bond is a measure that takes into account the embedded options, such as call options or put options, in a bond's structure. It represents the additional yield over the risk-free benchmark (typically a Treasury bond) that compensates investors for the bond's credit risk and any embedded option risk. Calculating the OAS spread involves several steps:

1. Determine the Bond's Clean Price: Start by determining the bond's clean price in the market. The clean price is the bond's market price without including any accrued interest. It is the price at which the bond is traded, excluding any interest that has accumulated since the last coupon payment.

2. Calculate the Present Value of Cash Flows: Calculate the present value of all expected future cash flows from the bond, including both coupon payments and the face value of the bond at maturity. Use the bond's YTM (Yield to Maturity) as the discount rate for these cash flows. The YTM is the market yield that equates the present value of the bond's cash flows to its clean price.

3. Calculate the Present Value of Cash Flows Assuming No Options: Recalculate the present value of the bond's cash flows, but this time assume that the bond has no embedded options. This means you treat the bond as if it were a plain vanilla bond with no call or put options. Use the same YTM as in step 2 as the discount rate.

4. Calculate the OAS: The OAS spread is the difference between the YTM and the spread you calculated in step 3. Mathematically, it can be expressed as:

Where:

YTM is the yield to maturity of the bond, which you calculated in step 2. Spread assuming no options is the spread you calculated in step 3. The OAS spread represents the compensation investors receive for taking on the risk associated with the embedded options in the bond. A positive OAS indicates that investors are receiving additional yield for this risk, while a negative OAS would suggest that investors are accepting a lower yield compared to a plain vanilla bond with similar credit risk.

The intuition is not necessarily wrong but if I read this answer for the first time without any knowledge about OAS I wouldn't know what to do with it. A better description is offered on the Wikipedia page. In short: you need a tree or some sort of grid. The YTM is not directly used (other than to get the price of the bond). Step 2 and 3 appear to be the same thing to me as well since YTM assumes no optionality.

The last sentence about positive and negative OAS is also confusing and not really relevant. Corporate bonds generally have a positive spread.

Question for ChatGPT 3.5:

Is 50 delta ATM?

Yes, a 50 delta option is considered "at-the-money" (ATM). Delta is a Greek letter used in options trading to measure the sensitivity of an option's price to changes in the underlying asset's price. It represents the probability that the option will expire in-the-money (ITM).

• A delta of 0 indicates that the option is far out-of-the-money (OTM), meaning the probability of it expiring ITM is very low.

• A delta of 0.5 or 50% indicates that the option is ATM. At this point, the option has an equal probability of expiring ITM or out-of-the-money (OTM).

• A delta of 1 indicates that the option is in-the-money (ITM), meaning it has a high probability of expiring ITM.

So, when you have a 50 delta option, you have an option that is right at the money, meaning the strike price is very close to the current market price of the underlying asset. It's important to note that delta can change as the underlying asset's price moves, so an option that starts as ATM may become ITM or OTM as the underlying price changes.

You can see how far 50D can be from ATM in this answer. Delta is an increasing function of time and IV. Moreover, the delta also does not represent the probability that the option will expire ITM (it proxies it at best).

Using Julia for pricing an ATM option with 1y to expiry, zero interest rates and dividends shows, for a somewhat unrealistic IV of 300% that delta is ~93% whereas the probability that the option will expire ITM is about 6%:

function BSM(S,K,t,rf,d,σ)

d1 = ( log(S/K) + (rf - d + 1/2*σ^2)*t ) / (σ*sqrt(t))
d2 = d1 - σ*sqrt(t)
delta = exp(-d*t)*N(d1)
return delta, N(d2)
end

Call = BSM(100,100,1,0,0,3)
DataFrame("Delta" => Call[2], "Prob. ITM" => Call[3])


I hesitated to post this because ultimately ChatGPT is an AI-powered language model, capable of generating human-like text based on context and past conversations. I do not expect an english major to answer this question either. On the other hand, the AI pretends to know the answer (although it does not actually compute the price unless you specify that you want the USD value).

As found on ChatGPT Experts

Question for ChatGPT 3.5:

An investor wants to buy a call option with a strike of 110 for a stock trading for USD 100 per share that expires in 6 months. the risk free rate is 5% and the stock's volatility is 30%. What is the exact USD price of the option using Black Scholes.

To calculate the exact price of the call option in USD using the Black-Scholes model, we'll use the formula:

$$C = S_0N(d_1) - Xe^{-rt}N(d_2)$$

Where:

• C = Price of the call option in USD
• $$S_0$$ = Current stock price = \$100 per share • X = Strike price of the option = \$110 per share
• r = Risk-free interest rate = 5% or 0.05
• t = Time to expiration = 6 months = 0.5 years
• $$\sigma$$ = Volatility of the stock = 30% or 0.30

First, we need to calculate $$(d_1)$$ and $$(d_2)$$ using the Black-Scholes formulas:

$$d_1 = \frac{\ln(S_0/X) + (r + (\sigma^2)/2)t}{\sigma\sqrt(t)}$$

$$d_2 = d_1 - \sigma\sqrt{t}$$

Now, let's calculate $$(d_1)$$:

$$d_1 = \frac{\ln(100/110) + (0.05 + (0.30^2)/2) * 0.5}{0.30 * \sqrt(0.5)}$$

First, calculate the values inside the parentheses:

$$\ln(100/110) = \ln(0.9091) \approx -0.0953$$

$$(0.05 + (0.30^2)/2) * 0.5 = (0.05 + 0.045) * 0.5 = 0.0475$$

Now, calculate $$(d_1)$$:

$$d_1 = \frac{-0.0953 + 0.0475}{0.30 * \sqrt{0.5}}$$ $$d_1 = \frac{-0.0478}{0.2121} \approx -0.2253$$

Next, calculate $$(d_2)$$:

$$d_2 = -0.2253 - 0.30 * \sqrt{0.5} \approx -0.5706$$

Now, use a standard normal distribution table or calculator to find $$N(d_1)$$ and $$N(d_2)$$.

• $$N(d_1) \approx 0.4107$$
• $$N(d_2) \approx 0.2857$$

Finally, plug the values into the Black-Scholes formula to calculate the exact price of the call option in USD:

$$C = 100 * 0.4107 - 110 * e^{-0.05 * 0.5} * 0.2857$$

Now, calculate the values inside the formula:

$$C = 41.07 - 110 * 0.9751 * 0.2857$$

$$C = 41.07 - 31.60$$

Now, calculate the final price of the call option in USD:

$$C \approx 9.47$$

So, the exact price of the call option using the Black-Scholes model is approximately \$9.47 in USD per share.

Correct answer The generated answer is actually quite impressive. Yet, if you compute the values, you realize d2 is wrong, and the actual option value is 5.58, not 9.47.

In Julia:

# generic put call pricer
function BSM(S,K,t,rf,σ)
d1 = ( log(S/K) + (rf + 1/2*σ^2)*t ) / (σ*sqrt(t))
d2 = d1 - σ*sqrt(t)
c = exp(-d*t)S*N(d1) - exp(-rf*t)*K*N(d2)
return c, d1, d2, N(d1), N(d2)
end
s,k,r,t,σ = 100, 110, 0.05, 0.5, 0.3
call = BSM(s,k,t,r,σ)
DataFrame("option value" => call[1], "d1" => call[2] , "d2" => call[3] , "N(d1)" => call[4] , "N(d2)" => call[5] )


Result

Interestingly, asking ChatGPT what the result of $$d_2 = -0.2253 - 0.30 * \sqrt{0.5}$$ is provides the correct answer.

To calculate the expression: -0.2253 - 0.30 * sqrt(0.5) First, calculate the square root of 0.5: sqrt(0.5) ≈ 0.7071 (rounded to four decimal places) Now, substitute this value back into the original expression: -0.2253 - 0.30 * 0.7071 Next, multiply 0.30 by 0.7071: 0.30 * 0.7071 ≈ 0.21213 (rounded to five decimal places) Now, subtract 0.21213 from -0.2253: -0.2253 - 0.21213 ≈ -0.43743 So, the result is approximately -0.43743.

Google bard claims its 8.49 and shows as the final step:

0.6827 * 100 - 0.6179 * 110 * exp(-0.05 * 0.5) = 68.27 - 67.99 = 8.49

It does seem to learn on the go though, because after asking what 68.27 - 67.99 is, bard responses that

68.27 - 67.99 = 0.28.

I apologize for my previous mistake. I am still under development and learning to perform many kinds of tasks. I will try my best to avoid making similar mistakes in the future.

• At least version 3.5 is quite capable of getting things wrong that English majors should likely know, too. For instance, "In Dracula, why can he not go out in the sun?" Correct answer: he can, he just cannot use his powers. GPT 3.5 answer: "In Bram Stoker's novel 'Dracula,' the character Count Dracula is depicted as a vampire, and like many vampire legends, he is said to be vulnerable to sunlight. Sunlight is often portrayed as harmful to vampires, causing them to burn or disintegrate." Commented Sep 27, 2023 at 11:03
• "Who is the murderer in Curtain by Agatha Christie?" gives "The murderer in Agatha Christie's novel 'Curtain' is revealed to be Hercule Poirot himself. The novel was written by Christie as her final Poirot mystery, and it was published posthumously in 1975." Most people would say that the murderer was Norton, who kills six people and is the main antagonist, even if Poirot technically did commit a murder. Commented Sep 27, 2023 at 11:03
• @Obie 2.0, I believe you are right, the quality of responses is a very general problem. I added a question where Google Bard even makes up its own guidelines. Commented Dec 18, 2023 at 21:25

Not exactly quantitative finance but it shows how extremely misleading AI can be. Not only does it get facts wrong, it even makes up its own EBA guidelines.

Initially I asked how to measure CSRBB (credit spread risk in the banking book). I received this response from Google Bard (excerpt):

The "credit spread per basis point" delta (CS01) is a measure of the sensitivity of an asset or liability to a change in credit spreads...

Regulators in the European Union require banks to measure and manage their CSRBB exposure. The European Banking Authority (EBA) has issued guidelines on how to do this.

I'll include screenshots to show what followed:

To the best of my knowledge, this is not the case. Therefore, I asked where to find this in the guidelines.

The problem here is that EBA/GL/2022/05 is not about CSRBB, so I asked can you show this specific section to me.

Now, I specifically mentioned that EBA/GL/2022/05 is about Compliance Management not CSRBB. Bard wrote that I am correct and apoligized with the following:

I apologize for the error I made in my previous response. I am still under development, and I am always learning new things. I will try to be more careful in the future.

However,

and it keeps getting worse with every response:

I tried replicating a day later but the response was different. However, asking Does CSRBB (Credit Spread Risk in the Banking Book) in the EBA guidelines suggest to use CS01 it responded the following (excerpt):

Yes, the EBA guidelines for credit spread risk arising from non-trading book activities (CSRBB) recommend using CS01 to calculate CSRBB for the standardized approach (STA). CS01 stands for credit spread duration, and it is a measure of the sensitivity of an asset or liability to a parallel shift in credit spreads...

The EBA guidelines recommend using CS01 because it is a relatively simple and easy-to-understand measure of credit spread risk. It is also relatively easy to calculate, which makes it a good choice for banks that are not using the internal models approach (IMA).

However, the EBA guidelines also note that CS01 may not be the most accurate measure of credit spread risk for all banks. This is because CS01 assumes that all credit spreads will shift by the same percentage, which may not be the case in reality. In some cases, credit spreads for different credit quality categories may move by different percentages...

The EBA guidelines recommend that banks use a 5% parallel shift in credit spreads when calculating CS01 for the STA. This is because 5% is a reasonable assumption for the most likely type of change in credit spreads.

To Summarize:

Not only does Google bard mix up Guidelines, it also provides fake text that makes you believe it is actually directly from the guidelines. The responses also change frequently, although they were at least consistently wrong...

The silly 5+7 example at the end shows that that the current state of AI is all about artificial, and nothing about intelligence really.

Asking ChatGPT 3.5: "Can you summarize the SABR model"

Mr SABR was such a key figure that they chose his name, despite having decided to use the first initials of the model's creators.

Asking who creaed the SABR model did not make it any better.

However, asking what the name stands for results in a similar response:

The original paper states on P.8 that the authors chose the name

"stochastic-αβρ model", which has become known as the SABR model

because they make α (the volatility) a stochastic process and β and ρ are other parameters of the model.

How to best estimate dv01 when perturbing interest rates by 1 basis point admits arbitrage?

Estimating dv01 (duration contribution to the value of a security) when perturbing interest rates by 1 basis point admits arbitrage can be challenging due to the unpredictable price movements caused by arbitrage activity. However, there are a few approaches that can be used to obtain a reasonable estimate.

1. Historical Analysis: Examining historical data can provide insights into the relationship between interest rate changes and price movements for similar securities. By analyzing past instances of arbitrage and the subsequent price adjustments, it may be possible to identify patterns and develop a model to predict the impact of arbitrage on dv01 calculations.

2. Arbitrage-Free Pricing Models: Employing arbitrage-free pricing models can help estimate dv01 values by considering the theoretical relationships between various interest rate derivatives and their underlying assets. These models incorporate the risk-free interest rate and the expected future path of interest rates to determine the fair prices of derivatives.

3. Scenario Analysis: Conducting scenario analysis involves simulating the impact of different interest rate scenarios on the prices of relevant securities. By simulating a range of interest rate changes, it is possible to observe the price movements and identify arbitrage opportunities. This information can then be used to adjust dv01 estimates accordingly.

4. Real-Time Market Monitoring: Continuously monitoring market data can provide valuable insights into arbitrage activity and its impact on security prices. By observing real-time price movements, it is possible to identify arbitrage opportunities and adjust dv01 estimates accordingly.

5. Combination of Approaches: Combining multiple approaches can provide a more comprehensive and accurate estimation of dv01 when arbitrage is present. For instance, historical analysis can provide a baseline estimation, while arbitrage-free pricing models can refine the estimates. Scenario analysis and real-time market monitoring can further refine the estimates by considering the impact of arbitrage opportunities.

It is important to note that estimating dv01 under arbitrage conditions is inherently uncertain, and the accuracy of the estimates will depend on the specific market conditions and the availability of relevant data. However, by employing a combination of the aforementioned approaches, it is possible to obtain a reasonable approximation of dv01 values even in the presence of arbitrage.

This is not completely wrong, but the suggestion that I was hoping for was to use a smaller bump so as not to admit arbitrage, and rescale the impact to 1bp.

I tried the following prompt:

Write Python program to create a schedule in QuantLib having London, UK, holiday calendar, issue date on December 1, 2023, long first coupon paid on April 1, 2024, followed by quarterly coupon periods, until the maturity date January 1, 2025.

This was the response from Google Bard:

import QuantLib as ql

# Create the London holiday calendar
london_calendar = ql.UnitedKingdom()

# Define the schedule parameters
issue_date = ql.Date(1, 12, 2023)
maturity_date = ql.Date(1, 1, 2025)
tenor = ql.Period(ql.Quarterly)  # Quarterly coupons
calendar = london_calendar
date_generation = ql.DateGeneration.Forward
end_of_month = False  # Coupon payments not necessarily on end of month

# Create the schedule with a long first period
schedule = ql.Schedule(issue_date, maturity_date, tenor, calendar,
date_generation, end_of_month)

# Set the first coupon date explicitly to April 1, 2024
schedule.firstDate = ql.Date(1, 4, 2024)

# Print the schedule
print(schedule)


Problem 1: print(schedule) outputs:

<QuantLib.QuantLib.Schedule; proxy of <Swig Object of type 'Schedule *' at 0x0000017A3DA20720> >

Replacing print with

for i, date in enumerate(schedule):
print(f"#{i} {date.ISO()}")


outputs:

#0 2023-12-01
#1 2024-03-01
#2 2024-06-03
#3 2024-09-02
#4 2024-12-02
#5 2025-01-02


Problem 2: these are not the dates that we're looking for. Changing schedule.firstDate did not have the desired effect.

Problem 3: Sidetracking, my pet peeve: "London" holidays are not the same as "Scotland" holidays and there is no such thing as UnitedKingdom() holidays, except in EU programmers' imagination.

Clicking "Regenerate draft" caused Bard to change the Schedule call to:

schedule = ql.Schedule(issue_date, maturity_date, tenor, calendar,
date_generation, end_of_month, firstDate=ql.Date(1, 4, 2024))


Problem 4: Between SWIG, Quantlib and Python, we can't pass named keywords like firstDate - Python throws TypeError: Schedule.__init__() got an unexpected keyword argument.... This date should have been passed as a positional argument instead. A cleaned-up version is at the end of this answer.

ChatGPT 3.5 generated the following more convoluted code:

from QuantLib import *

def create_schedule_with_custom_dates():
issue_date = Date(1, 12, 2023)
long_first_coupon_date = Date(1, 4, 2024)
maturity_date = Date(1, 1, 2025)
tenor = Period(3, Months)  # Quarterly coupons
calendar = UnitedKingdom()
convention = ModifiedFollowing

# Create schedule with custom dates
schedule = Schedule(issue_date, maturity_date, tenor, calendar,
convention, convention,
DateGeneration.Backward, False)

# Set custom long first coupon date
schedule[0] = long_first_coupon_date

return schedule

def main():
schedule = create_schedule_with_custom_dates()

for date in schedule:
print(date)

if __name__ == "__main__":
main()


Problem 5:

    schedule[0] = long_first_coupon_date
~~~~~~~~^^^
TypeError: 'Schedule' object does not support item assignment


ChatGPT 4.0 in Microsoft CoPilot generated this code:

# Import QuantLib library
import QuantLib as ql

# Define the parameters
issue_date = ql.Date(1, 12, 2023) # December 1, 2023
maturity_date = ql.Date(1, 1, 2025) # January 1, 2025
coupon_frequency = ql.Period(ql.Quarterly) # Quarterly coupons
calendar = ql.UnitedKingdom() # London, UK, holiday calendar
convention = ql.ModifiedFollowing # Business day convention
end_of_month = False # Do not adjust to end of month
first_coupon_date = ql.Date(1, 4, 2024) # April 1, 2024
first_coupon_period = ql.Period(ql.Semiannual) # Long first coupon

# Create the schedule
schedule = ql.Schedule(issue_date, maturity_date, coupon_frequency,
calendar, convention, convention, ql.DateGeneration.Forward, end_of_month,
first_coupon_date, first_coupon_period)

# Print the schedule
print("The schedule is:")
for date in schedule:
print(date)


Problem 6: Semiannual is AI's hallucination. The odd first coupon is meant to be 4 months long.

Problem 7: Passing the hallucinatory first_coupon_period in the position where the constructor expects nextToLastDate causes Python to throw:

TypeError: Wrong number or type of arguments for overloaded function 'new_Schedule'.
Possible C/C++ prototypes are:
...


Conclusion: none of the generative AI programs wrote a program that ran correctly, but Bard came close.

For reference, here is a cleaned up version of Bard's code:

import QuantLib as ql

# Define the schedule parameters
issue_date = ql.Date(1, 12, 2023)
maturity_date = ql.Date(1, 1, 2025) # bumped to January 2 because of New year's Day
tenor = ql.Period(ql.Quarterly)  # Quarterly coupons
calendar = ql.UnitedKingdom() # London, UK, holiday calendar... NOT!
date_generation = ql.DateGeneration.Forward
end_of_month = False  # Coupon payments not necessarily on end of month
first_coupon_date = ql.Date(1, 4, 2024) # bumped to April 2 because of Easter Monday

# Create the schedule with a long first period
schedule = ql.Schedule(issue_date, maturity_date, tenor, calendar,
date_generation, end_of_month, first_coupon_date)

# Print the schedule
for i, date in enumerate(schedule):
print(f"#{i} {date.ISO()}")


which produces the desired output:

#0 2023-12-01
#1 2024-04-02
#2 2024-07-01
#3 2024-10-01
#4 2025-01-02