All Questions
Tagged with python or programming
1,851 questions
-2
votes
1
answer
53
views
QuantLib issue with creating a FixedRateBond
When trying to construct a simple bond object using QuantLib using the example from the docs, I get the following error:
...
0
votes
1
answer
93
views
How to design an effective reward function for RL-based FX hedging strategy?
I'm working on an Reinforcement learning (RL) algorithm for optimizing a foreign exchange (FX) hedging strategy, specifically for the USD/AZN (Azerbaijani manat ₼) pair in the context of Azerbaijan's ...
2
votes
1
answer
144
views
BusinessDayConvention failing to obtain correct accured or correct coupons in ql.FixedRateBond()
I am trying to price a fixed rate bond with Quantlib (BFCM 4 3/8 01/11/34 Corp or FR001400N3I5)
Coupon 4.375%
Freq : Annual
Day Cnt (Bloom) : ACT/ACT
Issue date 11-Jan-24
First CPn Date 11-Jan-25
Mty ...
1
vote
2
answers
365
views
Girsanov Theorem: how to implement it with code?
I'm trying to visualize the path transformations coming from the application of the Girsanov Theorem in a Monte Carlo Simulation.
Below the (Python) code where I'm trying to "adjust" the ...
3
votes
1
answer
132
views
QuantLib Bootstrapped Curve Tallies With Bloomberg Only Up to 1Y Tenor
I'm trying to reconstruct Bloomberg's SORA curve and have noticed that the bootstrapped curve for some reason is only accurate up to the 1Y tenor (out of 30Y), and have no idea what could be causing ...
3
votes
1
answer
101
views
QuantLib `RangeAccrualFloatersCoupon` instanciation fails
Instanciation of RangeAccrualFloatersCoupon in Python fails with the following error, even though the 12th argument is a QuantLib schedule.
...
2
votes
1
answer
120
views
rateslib curves: Why does changing day count convention affect discount factors?
I'm using the rateslib Python package to build a yield curve from Brazilian DI1 futures using piecewise/spline interpolation. My expectation was that changing the day count convention of the curve ...
2
votes
1
answer
107
views
rateslib STIRFuture throws “RFRs could not be calculated” if SOFR weekend fixings are missing — shouldn’t weekends be skipped?
I’m using rateslib 2.0.0 to calibrate a SOFR curve with a stack of STIRFuture contracts (“usd_stir” & “usd_stir1” specs). When my evaluation date is 2025-06-08 or later, the solver fails with:
...
0
votes
0
answers
66
views
Trouble Calibrating Heston Model via Maximum Likelihood in Python
I'm trying to calibrate the Heston stochastic volatility model using maximum likelihood estimation (MLE) on high-frequency financial data, inspired by the methodology in this study (Hybrid machine ...
1
vote
0
answers
41
views
Help implementing numerical pricing model for Summer Day Options (Kanamura & Ōhashi 2009) [closed]
I'm trying to implement the pricing model from the paper:
Kanamura & Ōhashi (2009), "Pricing Summer Day Options by Good-Deal Bounds" (Energy Economics, Vol. 31, pp. 289–297)
The model is ...
0
votes
0
answers
88
views
OU Mean-Reverting Lognormal Process Simulation
I want to make sure that the following reasoning and simulation technique is reliable (also valid) due I'm trying to model a mean-reverting lognormal process.
The idea is to define a process
$S_t$
...
1
vote
1
answer
203
views
How can I represent a Brazilian DI1 future in rateslib (python)?
I am currently looking to use rateslib to explore Brazil's rates market, of which the DI1 futures are a big component. I have limited experience with both these futures and with rateslib, so pardon if ...
1
vote
1
answer
181
views
QuantLib Python: generating forward rates from Hull White simulated short rates
I am generating interest rate paths through Hull White (1M SOFR for 50 years, monthly) and would also like to generate multiple forward zeros for each point on the path, e.g. 10y1m forward starting ...
4
votes
1
answer
234
views
The raw SVI parametrization numerical optimization
Recall that a raw SVI parametrization of a total variance for a fixed maturity looks like
$$w(k, \xi) = a + b\cdot(\rho\cdot(k-m)+\sqrt{(k-m)^2+\sigma^2})$$
where $\xi=\{a,b,m,\rho,\sigma\}$ is the ...
1
vote
0
answers
199
views
Why is it called "Mathematical Finance", not "Statistical Finance"?
About the idea of "Quantitative Finance" in general:
Everywhere I look on the Internet, people seem to be saying that Statistics is more relevant to Quant Finance than Mathematics. The ...
0
votes
0
answers
55
views
Earnings calendar with direct link to live earnings feed/report?
I was wondering if there was a service that provides earnings calls calendars with direct access to the URL used to publish the earnings call. Alternatively if there exists a database with the ...
0
votes
0
answers
132
views
Generation of two correlated Brownian Motions using two different approaches in numpy Python
Consider two correlated Brownian Motions $W_{1,t}$ and $W_{2,t}$ for which it holds:
$$dW_{1,t}\sim N(0, \sqrt{dt})$$
$$dW_{2,t}\sim N(0, \sqrt{dt})$$
$$Cov(dW_{1,t},dW_{2,t}) = E[dW_{1,t}dW_{2,t}] = \...
1
vote
0
answers
73
views
Comparing optimal strategies in Black-Scholes model with python
Consider the 1-dimensional Black-Scholes model
$$dS_t = S_t(\mu dt + \sigma dW_t)$$
$$dB_t = rB_t dt$$
Given a maturity time $T$, by martingale method the optimal discounted portfolio at the maturity ...
0
votes
0
answers
82
views
Estimate Convexity bias for Interest Rate Futures in QuantLib Python
I couldn't find find QuantLib Python example function or script to estimate convexity adjustments on Interest Rate Futures. I can see there is HullWhite class with convexityBias but I struggle with ...
0
votes
1
answer
700
views
Worst-of Rainbow Option - Relationship with Correlation and price
I'm trying to build a worst-of and best-of option pricer, however, I am getting unexpected result while also trying to interpret the relationship between correlation and option price for these rainbow ...
0
votes
0
answers
108
views
Clarification for volSpreads in Quantlib's swaption vol cube classes
Pulled from https://github.com/lballabio/QuantLib-SWIG/blob/a397e5397f94e30ac74a37ce1e676f050466d1b0/Python/test/test_cms.py#L144
...
0
votes
1
answer
162
views
Quantlib : bonds with fixed cashflows
Using QuantLib, I want to model bonds with fixed cashflows. Specifically, at each payment date, the cashflow is a constant amount $ A_0 $. I can model this manually (especially with an annual ...
1
vote
1
answer
100
views
Question on QuantLib Python DatedOISRateHelper fairRate
I'm wondering if this is intended in DatedOISRateHelper. Referring to executable code below, 1Y OIS maturity date is 22nd Dec 2025 (21st and 22nd Dec fall on weekend). However when I try to price OIS ...
2
votes
2
answers
447
views
Mean-variance optimisation with and without constraints
I wrote the following code for a portfolio project but I have an issue.
The first function calculates the mean-variance optimisation based on the lambda (risk propensity), the vector of expected ...
0
votes
0
answers
65
views
Calculation of upper bound for Bermudan Call options
I'm having trouble calculating the upper bound for a Bermudan call option and plotting both the option price and the upper bound. The issue lies specifically in the calculation of the upper bound in ...