You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(60) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(18) |
Feb
(4) |
Mar
(6) |
Apr
(2) |
May
|
Jun
(12) |
Jul
(48) |
Aug
(6) |
Sep
(3) |
Oct
(24) |
Nov
(15) |
Dec
(18) |
| 2002 |
Jan
(39) |
Feb
(12) |
Mar
(80) |
Apr
(72) |
May
(46) |
Jun
(27) |
Jul
(23) |
Aug
(34) |
Sep
(65) |
Oct
(71) |
Nov
(19) |
Dec
(14) |
| 2003 |
Jan
(44) |
Feb
(59) |
Mar
(18) |
Apr
(62) |
May
(54) |
Jun
(27) |
Jul
(46) |
Aug
(15) |
Sep
(44) |
Oct
(36) |
Nov
(19) |
Dec
(12) |
| 2004 |
Jan
(26) |
Feb
(33) |
Mar
(47) |
Apr
(63) |
May
(36) |
Jun
(65) |
Jul
(80) |
Aug
(163) |
Sep
(65) |
Oct
(39) |
Nov
(36) |
Dec
(39) |
| 2005 |
Jan
(97) |
Feb
(78) |
Mar
(64) |
Apr
(64) |
May
(48) |
Jun
(55) |
Jul
(89) |
Aug
(57) |
Sep
(51) |
Oct
(111) |
Nov
(86) |
Dec
(76) |
| 2006 |
Jan
(84) |
Feb
(103) |
Mar
(143) |
Apr
(92) |
May
(55) |
Jun
(58) |
Jul
(71) |
Aug
(57) |
Sep
(74) |
Oct
(59) |
Nov
(8) |
Dec
(32) |
| 2007 |
Jan
(60) |
Feb
(40) |
Mar
(50) |
Apr
(26) |
May
(61) |
Jun
(120) |
Jul
(119) |
Aug
(48) |
Sep
(121) |
Oct
(66) |
Nov
(103) |
Dec
(43) |
| 2008 |
Jan
(60) |
Feb
(109) |
Mar
(92) |
Apr
(106) |
May
(82) |
Jun
(59) |
Jul
(67) |
Aug
(118) |
Sep
(131) |
Oct
(56) |
Nov
(37) |
Dec
(69) |
| 2009 |
Jan
(75) |
Feb
(76) |
Mar
(103) |
Apr
(78) |
May
(61) |
Jun
(35) |
Jul
(66) |
Aug
(69) |
Sep
(166) |
Oct
(46) |
Nov
(72) |
Dec
(65) |
| 2010 |
Jan
(48) |
Feb
(57) |
Mar
(93) |
Apr
(85) |
May
(123) |
Jun
(82) |
Jul
(98) |
Aug
(121) |
Sep
(146) |
Oct
(86) |
Nov
(72) |
Dec
(34) |
| 2011 |
Jan
(96) |
Feb
(55) |
Mar
(73) |
Apr
(57) |
May
(33) |
Jun
(74) |
Jul
(89) |
Aug
(71) |
Sep
(103) |
Oct
(76) |
Nov
(52) |
Dec
(61) |
| 2012 |
Jan
(48) |
Feb
(54) |
Mar
(78) |
Apr
(60) |
May
(75) |
Jun
(59) |
Jul
(33) |
Aug
(66) |
Sep
(43) |
Oct
(46) |
Nov
(75) |
Dec
(51) |
| 2013 |
Jan
(112) |
Feb
(72) |
Mar
(49) |
Apr
(48) |
May
(42) |
Jun
(44) |
Jul
(80) |
Aug
(19) |
Sep
(33) |
Oct
(37) |
Nov
(38) |
Dec
(98) |
| 2014 |
Jan
(113) |
Feb
(93) |
Mar
(49) |
Apr
(106) |
May
(97) |
Jun
(155) |
Jul
(87) |
Aug
(127) |
Sep
(85) |
Oct
(48) |
Nov
(41) |
Dec
(37) |
| 2015 |
Jan
(34) |
Feb
(50) |
Mar
(104) |
Apr
(80) |
May
(82) |
Jun
(66) |
Jul
(41) |
Aug
(84) |
Sep
(37) |
Oct
(65) |
Nov
(83) |
Dec
(52) |
| 2016 |
Jan
(68) |
Feb
(35) |
Mar
(42) |
Apr
(35) |
May
(54) |
Jun
(75) |
Jul
(45) |
Aug
(52) |
Sep
(60) |
Oct
(52) |
Nov
(36) |
Dec
(64) |
| 2017 |
Jan
(92) |
Feb
(59) |
Mar
(35) |
Apr
(53) |
May
(83) |
Jun
(43) |
Jul
(65) |
Aug
(68) |
Sep
(46) |
Oct
(75) |
Nov
(40) |
Dec
(49) |
| 2018 |
Jan
(68) |
Feb
(54) |
Mar
(48) |
Apr
(58) |
May
(51) |
Jun
(44) |
Jul
(40) |
Aug
(68) |
Sep
(35) |
Oct
(15) |
Nov
(7) |
Dec
(37) |
| 2019 |
Jan
(43) |
Feb
(7) |
Mar
(22) |
Apr
(21) |
May
(31) |
Jun
(39) |
Jul
(73) |
Aug
(45) |
Sep
(47) |
Oct
(89) |
Nov
(19) |
Dec
(69) |
| 2020 |
Jan
(52) |
Feb
(63) |
Mar
(45) |
Apr
(59) |
May
(42) |
Jun
(57) |
Jul
(30) |
Aug
(29) |
Sep
(75) |
Oct
(64) |
Nov
(96) |
Dec
(22) |
| 2021 |
Jan
(14) |
Feb
(24) |
Mar
(35) |
Apr
(58) |
May
(36) |
Jun
(15) |
Jul
(18) |
Aug
(31) |
Sep
(30) |
Oct
(33) |
Nov
(27) |
Dec
(16) |
| 2022 |
Jan
(35) |
Feb
(22) |
Mar
(14) |
Apr
(20) |
May
(44) |
Jun
(53) |
Jul
(25) |
Aug
(56) |
Sep
(11) |
Oct
(47) |
Nov
(22) |
Dec
(36) |
| 2023 |
Jan
(30) |
Feb
(17) |
Mar
(31) |
Apr
(48) |
May
(31) |
Jun
(7) |
Jul
(25) |
Aug
(26) |
Sep
(61) |
Oct
(66) |
Nov
(19) |
Dec
(21) |
| 2024 |
Jan
(37) |
Feb
(29) |
Mar
(26) |
Apr
(26) |
May
(34) |
Jun
(9) |
Jul
(27) |
Aug
(13) |
Sep
(15) |
Oct
(25) |
Nov
(13) |
Dec
(8) |
| 2025 |
Jan
(13) |
Feb
(1) |
Mar
(16) |
Apr
(17) |
May
(8) |
Jun
(6) |
Jul
(9) |
Aug
|
Sep
(6) |
Oct
(15) |
Nov
(6) |
Dec
|
| 2026 |
Jan
(6) |
Feb
(4) |
Mar
(20) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: jian Xu <jia...@gm...> - 2022-03-02 06:08:02
|
Hi,
I'm confused by the "endOfMonth" setting. The document says:
```
endOfMonth : If the start date is at the end of the month, whether
other dates are required to be scheduled at the end of the month
(except the last date).
```
So my understanding is that if the start date is NOT the end of the
month, then this setting doesn't matter. (is this correct?)
However, it does matter in the following example. As the input
suggests, I expect the first date in the schedule should be 2018-03-29
(Thursday, NOT end of the month). However, I only get this result
when I set endOfMonth=False. If I set it to true, the first date in
the schedule will be 2018-03-31 (Saturday). Why?
Thanks a lot.
import QuantLib as ql
calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond)
schedule = ql.MakeSchedule(effectiveDate=ql.Date(29,3,2018),
terminationDate=ql.Date(29, 3, 2021),
tenor=ql.Period("3M"),
calendar=calendar,
convention=ql.Unadjusted,
terminalDateConvention=ql.Unadjusted,
rule=ql.DateGeneration.Forward,
endOfMonth=True,
firstDate=ql.Date(29, 6, 2018),
nextToLastDate=ql.Date())
print(schedule[0])
|
|
From: Jonathan S. <sw...@gm...> - 2022-02-26 05:11:50
|
Hi Mohammad, There's a test suite for pricing various kinds of averaging (Asian) options under different engines that you can use as a reference. https://github.com/lballabio/QuantLib/blob/master/test-suite/asianoptions.cpp Not sure whether the available payoff types can fully capture the expression that you require. If not, then you may have to extend one of the payoff types and pass it into the instrument constructor instead of what you see in the test suite. Jonathan On Sat, Feb 26, 2022 at 1:09 AM Mohammad Shoja-talab <msh...@gm...> wrote: > Hi All, > > I'd like to price a payoff which looks like this: max( S - C * S/Avg(S), 0) > Where S is the spot price, Avg(S) is average of spot price in specified > (future) fixing dates and C is a constant. How best can I do that using > quantlib? > > Thanks > > -- > Mo Shoja > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Mohammad Shoja-t. <msh...@gm...> - 2022-02-25 16:06:09
|
Hi All, I'd like to price a payoff which looks like this: max( S - C * S/Avg(S), 0) Where S is the spot price, Avg(S) is average of spot price in specified (future) fixing dates and C is a constant. How best can I do that using quantlib? Thanks -- Mo Shoja |
|
From: Peter C. <pca...@gm...> - 2022-02-17 18:37:17
|
In addition, you might take a look at https://github.com/OpenSourceRisk/Engine/blob/master/QuantExt/qle/termstructures/blackvolsurfacebfrr.cpp which is not QuantLib, but uses Dimitri's DeltaVolQuote and BlackDeltaCalcuator at its heart to construct a vol smile from 10 and 25 BF / RR quotes, so there might be some inspiration there for you. Best Regards Peter On Wed, 16 Feb 2022 at 14:41, Luigi Ballabio <lui...@gm...> wrote: > Hello Goutham, > I'm not very familiar with that part of the code, but I think you can > do something similar to what's done in the vanna-volga barrier engine: > > > https://github.com/lballabio/QuantLib/blob/master/ql/experimental/barrieroption/vannavolgabarrierengine.cpp#L97-L130 > > First, it uses the BlackDeltaCalculator class to calculate the strike > corresponding to the quotes (lines 97-113); then it creates an > interpolation between them (117-127; it uses vanna-volga interpolation, but > I guess you can choose another one if you want); then it extracts from the > interpolation the volatility corresponding to the option strike. > > Hope this helps, > Luigi > > > > On Wed, Feb 16, 2022 at 10:28 AM Goutham Mahesh < > gou...@gm...> wrote: > >> Hi all, >> >> I am pricing FX options and was going through the Quantlib Python Guide >> to assist me. >> I came to this section on DeltaVolQuotes: >> >> deltaType = ql.DeltaVolQuote.Fwd # Also supports: Spot, PaSpot, PaFwd >> atmType = ql.DeltaVolQuote.AtmFwd # Also supports: AtmSpot, >> AtmDeltaNeutral, AtmVegaMax, AtmGammaMax,␣ >> ˓→AtmPutCall50 >> maturity = 1.0 >> volAtm, vol25DeltaCall, vol25DeltaPut = 0.08, 0.075, 0.095 >> atmDeltaQuote = ql.DeltaVolQuote(ql.QuoteHandle(ql.SimpleQuote(volAtm)), >> deltaType, maturity, atmType) >> vol25DeltaPutQuote = ql.DeltaVolQuote(-0.25, >> ql.QuoteHandle(ql.SimpleQuote(vol25DeltaPut)), maturity,␣ >> ˓→deltaType) >> vol25DeltaCallQuote = ql.DeltaVolQuote(0.25, >> ql.QuoteHandle(ql.SimpleQuote(vol25DeltaCall)), maturity,␣ >> ˓→deltaType) >> >> I have the ATMf and 25DRR and 25D Fly quotes for various tenors as >> attached in the table below. My doubt is using the code above, is there any >> way I can construct the volatility smile curve using QuantLib to derive the >> implied volatility of an option. >> >> Vol Table: >> ATMF Vol 25D RR 25D Std 10D RR 10 Std >> Bid Ask >> 1m 6.1 6.45 0.25 0.5 0.05 0.15 0.45 0.9 0.16 0.48 >> 2m 6.05 6.4 0.3 0.55 0.1 0.25 0.54 0.99 0.32 0.8 >> 3m 6.05 6.3 0.35 0.6 0.15 0.35 0.63 1.08 0.48 1.12 >> 6m 5.9 6.1 0.45 0.65 0.2 0.35 0.81 1.17 0.64 1.12 >> 9m 5.9 6.1 0.45 0.7 0.2 0.35 0.81 1.26 0.64 1.12 >> 1y 5.9 6.1 0.5 0.7 0.2 0.4 0.9 1.26 0.64 1.28 >> 2y 5.5 6 0.3 0.7 0.25 0.55 0.54 1.26 0.8 1.76 >> 3y 5.2 5.7 0.3 0.7 0.3 0.7 0.54 1.26 0.96 2.24 >> 4y 5.1 5.6 0.1 0.7 0.35 0.85 0.18 1.26 1.12 2.72 >> 5y 5 5.5 -0.1 0.4 0.5 0.9 -0.18 0.72 1.6 2.88 >> >> Thank You, >> Best, >> Goutham >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Yevgeniy G. <yev...@la...> - 2022-02-16 22:35:14
|
Hi,
we're trying to use QuantLib PDE solver to calculate option prices (calls and puts). Our final code will include vol adjustment based on time, but for the first version we're trying to implement a call option price with a constant vol.
The results I'm getting don't match the expected: the red line shows intrinsic value of the option (y) depending on percent strike (x). The blue line is calculated by PDE.
[cid:image001.png@01D82358.969B6450]
Can you help finding the error?
Here's the code:
from typing import List
import QuantLib as ql
import numpy as np
import pylab as pl
class DiffusionOperator:
def __init__(self, t_max: float, x_values: List[float], cur_vals_t: List[float]):
self.__mesher = ql.FdmMesherComposite( ql.Predefined1dMesher(x_values))
self.__t_max = t_max
self.__n = len(x_values)
self.__x_values = ql.Array(x_values)
self.__cur_vals_t = ql.Array(cur_vals_t)
self.__dx = ql.FirstDerivativeOp(0, self.__mesher)
self.__ddx = ql.SecondDerivativeOp(0, self.__mesher)
self.__map = ql.TripleBandLinearOp(0, self.__mesher)
def size(self) -> int:
return 1
def setTime(self, t1: float, t2: float):
self.__map.axpyb( ql.Array(1, 1.0), self.__dx, self.__ddx.mult(self.__cur_vals_t), ql.Array())
def apply(self, r: ql.Array) -> ql.Array:
return self.__map.apply(r)
def solve_splitting(self, direction: int, r: ql.Array, dt: float) -> ql.Array:
return self.__map.solve_splitting(r, dt, 1.0)
if __name__ == "__main__":
n_points = 500; n_time_steps = 800; x_min = 0.1; x_max = 4; t_max = 0.2; bs_vol = 0.1;
x_values = np.arange(x_min, x_max + 1e-8, (x_max - x_min) / (n_points - 1))
cur_values_t = 0.5 * bs_vol**2 * x_values*x_values
y0 = np.maximum(0, 1 - x_values)
y_values = ql.Array( list(y0.copy()) )
op = DiffusionOperator(t_max, list(x_values), list(cur_values_t))
mesher = ql.FdmMesherComposite(ql.Predefined1dMesher(x_values))
solver = ql.FdmBackwardSolver(
ql.FdmLinearOpCompositeProxy(op),
ql.FdmBoundaryConditionSet(
[ql.FdmDirichletBoundary(mesher, 1, 0, ql.FdmBoundaryCondition.Lower),
ql.FdmDirichletBoundary(mesher, 0, 0, ql.FdmBoundaryCondition.Upper)] ),
ql.FdmStepConditionComposite(ql.DoubleVector(), ql.FdmStepConditionVector()),
ql.FdmSchemeDesc.CrankNicolson()
)
solver.rollback(y_values, t_max, 0.0, n_time_steps, 0)
pl.plot(x_values, y_values, '.')
pl.plot(x_values, y0, 'r-')
pl.show()
________________________________
NOTICE TO RECIPIENTS: The information in this message, including any attachments, is confidential and intended for use solely by the designated recipient(s) named above. It is the property of Laurion Capital Management LP and its affiliates ("Laurion"). If you are not the intended recipient, please return the message to the sender and delete all copies of it, including attachments, from your computer. Unauthorized use, disclosure, dissemination or copying of this message or any part hereof is strictly prohibited. No confidentiality or privilege is waived or lost by any misdirected transmission. This message is for informational purposes only. The information expressed herein may be changed at any time without notice or obligation to update. No warranty is made as to the completeness or accuracy of the information contained in this communication. Any statements or opinions made in this message do not necessarily reflect those of Laurion. This communication should not be regarded as an offer, solicitation or recommendation to sell or purchase any security or other financial product.
Email transmission cannot be guaranteed to be secure, virus-free or error-free. Therefore, we do not represent that this message is virus-free, complete or accurate and it should not be relied upon as such. Laurion accepts no liability for any damage sustained in connection with the content or transmission of this message.
All emails to and from Laurion are subject to review by certain Laurion personnel. Such communications are retained in accordance with Laurion's policies and may be produced to regulatory authorities upon request. LAURION and LAURION CAPITAL MANAGEMENT LP are registered service marks of Laurion Capital Management LP.
|
|
From: Luigi B. <lui...@gm...> - 2022-02-16 13:39:49
|
Hello Goutham,
I'm not very familiar with that part of the code, but I think you can
do something similar to what's done in the vanna-volga barrier engine:
https://github.com/lballabio/QuantLib/blob/master/ql/experimental/barrieroption/vannavolgabarrierengine.cpp#L97-L130
First, it uses the BlackDeltaCalculator class to calculate the strike
corresponding to the quotes (lines 97-113); then it creates an
interpolation between them (117-127; it uses vanna-volga interpolation, but
I guess you can choose another one if you want); then it extracts from the
interpolation the volatility corresponding to the option strike.
Hope this helps,
Luigi
On Wed, Feb 16, 2022 at 10:28 AM Goutham Mahesh <gou...@gm...>
wrote:
> Hi all,
>
> I am pricing FX options and was going through the Quantlib Python Guide to
> assist me.
> I came to this section on DeltaVolQuotes:
>
> deltaType = ql.DeltaVolQuote.Fwd # Also supports: Spot, PaSpot, PaFwd
> atmType = ql.DeltaVolQuote.AtmFwd # Also supports: AtmSpot,
> AtmDeltaNeutral, AtmVegaMax, AtmGammaMax,␣
> ˓→AtmPutCall50
> maturity = 1.0
> volAtm, vol25DeltaCall, vol25DeltaPut = 0.08, 0.075, 0.095
> atmDeltaQuote = ql.DeltaVolQuote(ql.QuoteHandle(ql.SimpleQuote(volAtm)),
> deltaType, maturity, atmType)
> vol25DeltaPutQuote = ql.DeltaVolQuote(-0.25,
> ql.QuoteHandle(ql.SimpleQuote(vol25DeltaPut)), maturity,␣
> ˓→deltaType)
> vol25DeltaCallQuote = ql.DeltaVolQuote(0.25,
> ql.QuoteHandle(ql.SimpleQuote(vol25DeltaCall)), maturity,␣
> ˓→deltaType)
>
> I have the ATMf and 25DRR and 25D Fly quotes for various tenors as
> attached in the table below. My doubt is using the code above, is there any
> way I can construct the volatility smile curve using QuantLib to derive the
> implied volatility of an option.
>
> Vol Table:
> ATMF Vol 25D RR 25D Std 10D RR 10 Std
> Bid Ask
> 1m 6.1 6.45 0.25 0.5 0.05 0.15 0.45 0.9 0.16 0.48
> 2m 6.05 6.4 0.3 0.55 0.1 0.25 0.54 0.99 0.32 0.8
> 3m 6.05 6.3 0.35 0.6 0.15 0.35 0.63 1.08 0.48 1.12
> 6m 5.9 6.1 0.45 0.65 0.2 0.35 0.81 1.17 0.64 1.12
> 9m 5.9 6.1 0.45 0.7 0.2 0.35 0.81 1.26 0.64 1.12
> 1y 5.9 6.1 0.5 0.7 0.2 0.4 0.9 1.26 0.64 1.28
> 2y 5.5 6 0.3 0.7 0.25 0.55 0.54 1.26 0.8 1.76
> 3y 5.2 5.7 0.3 0.7 0.3 0.7 0.54 1.26 0.96 2.24
> 4y 5.1 5.6 0.1 0.7 0.35 0.85 0.18 1.26 1.12 2.72
> 5y 5 5.5 -0.1 0.4 0.5 0.9 -0.18 0.72 1.6 2.88
>
> Thank You,
> Best,
> Goutham
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Goutham M. <gou...@gm...> - 2022-02-16 09:25:00
|
Hi all, I am pricing FX options and was going through the Quantlib Python Guide to assist me. I came to this section on DeltaVolQuotes: deltaType = ql.DeltaVolQuote.Fwd # Also supports: Spot, PaSpot, PaFwd atmType = ql.DeltaVolQuote.AtmFwd # Also supports: AtmSpot, AtmDeltaNeutral, AtmVegaMax, AtmGammaMax,␣ ˓→AtmPutCall50 maturity = 1.0 volAtm, vol25DeltaCall, vol25DeltaPut = 0.08, 0.075, 0.095 atmDeltaQuote = ql.DeltaVolQuote(ql.QuoteHandle(ql.SimpleQuote(volAtm)), deltaType, maturity, atmType) vol25DeltaPutQuote = ql.DeltaVolQuote(-0.25, ql.QuoteHandle(ql.SimpleQuote(vol25DeltaPut)), maturity,␣ ˓→deltaType) vol25DeltaCallQuote = ql.DeltaVolQuote(0.25, ql.QuoteHandle(ql.SimpleQuote(vol25DeltaCall)), maturity,␣ ˓→deltaType) I have the ATMf and 25DRR and 25D Fly quotes for various tenors as attached in the table below. My doubt is using the code above, is there any way I can construct the volatility smile curve using QuantLib to derive the implied volatility of an option. Vol Table: ATMF Vol 25D RR 25D Std 10D RR 10 Std Bid Ask 1m 6.1 6.45 0.25 0.5 0.05 0.15 0.45 0.9 0.16 0.48 2m 6.05 6.4 0.3 0.55 0.1 0.25 0.54 0.99 0.32 0.8 3m 6.05 6.3 0.35 0.6 0.15 0.35 0.63 1.08 0.48 1.12 6m 5.9 6.1 0.45 0.65 0.2 0.35 0.81 1.17 0.64 1.12 9m 5.9 6.1 0.45 0.7 0.2 0.35 0.81 1.26 0.64 1.12 1y 5.9 6.1 0.5 0.7 0.2 0.4 0.9 1.26 0.64 1.28 2y 5.5 6 0.3 0.7 0.25 0.55 0.54 1.26 0.8 1.76 3y 5.2 5.7 0.3 0.7 0.3 0.7 0.54 1.26 0.96 2.24 4y 5.1 5.6 0.1 0.7 0.35 0.85 0.18 1.26 1.12 2.72 5y 5 5.5 -0.1 0.4 0.5 0.9 -0.18 0.72 1.6 2.88 Thank You, Best, Goutham |
|
From: jian Xu <jia...@gm...> - 2022-02-16 03:02:35
|
Hi, The makewhole call features are very common for bonds in the US. Is there a way to calculate bond price to yield given a makewhole feature (ie, makewhole date, spread, price)? Thanks. Jian |
|
From: Klaus S. <kl...@sp...> - 2022-02-08 20:08:29
|
Hi
you can define a set of boundary conditions like this
bcSet = ql.FdmBoundaryConditionSet(
[ql.FdmDirichletBoundary(mesher, 100, 0, ql.FdmBoundaryCondition.Lower),
ql.FdmDirichletBoundary(mesher, 200, 0, ql.FdmBoundaryCondition.Upper)]
)
Second parameter of the Dirichlet boundary condition is the value of the underlying, third parameter the direction of the boundary condition. For one dimensional problems this is always zero.
regards
Klaus
On Montag, 7. Februar 2022 17:24:32 CET Yev via QuantLib-users wrote:
Hi,
I have this Python code:
solver = ql.FdmBackwardSolver(
ql.FdmLinearOpCompositeProxy(op),
ql.FdmBoundaryConditionSet(),
ql.FdmStepConditionComposite(ql.DoubleVector(), ql.FdmStepConditionVector()),
ql.FdmSchemeDesc.CrankNicolson()
)
How can I specify left/write boundary conditions, let's say left=1, right = 2?
It's probably in this argument: ql.FdmBoundaryConditionSet(), but I cannot figure it out.
|
|
From: Yev <ye...@ya...> - 2022-02-07 16:24:42
|
Hi, I have this Python code: solver = ql.FdmBackwardSolver( ql.FdmLinearOpCompositeProxy(op), ql.FdmBoundaryConditionSet(), ql.FdmStepConditionComposite(ql.DoubleVector(), ql.FdmStepConditionVector()), ql.FdmSchemeDesc.CrankNicolson() ) How can I specify left/write boundary conditions, let's say left=1, right = 2? It's probably in this argument: ql.FdmBoundaryConditionSet(), but I cannot figure it out. |
|
From: Anders J. <and...@ti...> - 2022-02-04 08:11:43
|
Hi, Great, thanks, I'll give the FdHestonVanillaEngine a try. BR, //A On Thu, Feb 3, 2022 at 5:21 PM Luigi Ballabio <lui...@gm...> wrote: > Hello, > the calibration implemented in QuantLib (as in the > `HestonModel::calibrate` method) can only use European prices. However, > the engine pointed out by Jonathan can be used if you have some external > calibration machinery; you would write an objective function that takes the > Heston parameters as input, creates the model and the engine, prices the > quoted options, and returns the difference between calculated and quoted > price. You can read something like this in < > http://gouthamanbalaraman.com/blog/heston-calibration-scipy-optimize-quantlib-python.html> > (except you'd have to use VanillaOption and FdHestonVanillaEngine instead > of HestonModelHelper). > > Hope this helps, > Luigi > > > > On Thu, Feb 3, 2022 at 11:58 AM Jonathan Sweemer <sw...@gm...> > wrote: > >> Hi Anders, >> >> Looks like there is some code in the QuantLib test suite for >> American-style vanilla Heston pricing using FD [1]. You might be able to >> reuse some of this code for calibration purposes as well. >> >> [1] >> https://github.com/lballabio/QuantLib/blob/master/test-suite/hestonmodel.cpp#L665 >> >> On Wed, Feb 2, 2022 at 4:33 AM Anders Johansson < >> and...@ti...> wrote: >> >>> Hi, >>> >>> Is there a way to calibrate a heston model to american options using QL? >>> Which variety is the fastest? >>> >>> Thank you very much. >>> >>> //A >>> >>> _______________________________________________ >>> QuantLib-users mailing list >>> Qua...@li... >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |
|
From: Luigi B. <lui...@gm...> - 2022-02-03 16:22:02
|
Hello,
the calibration implemented in QuantLib (as in the
`HestonModel::calibrate` method) can only use European prices. However,
the engine pointed out by Jonathan can be used if you have some external
calibration machinery; you would write an objective function that takes the
Heston parameters as input, creates the model and the engine, prices the
quoted options, and returns the difference between calculated and quoted
price. You can read something like this in <
http://gouthamanbalaraman.com/blog/heston-calibration-scipy-optimize-quantlib-python.html>
(except you'd have to use VanillaOption and FdHestonVanillaEngine instead
of HestonModelHelper).
Hope this helps,
Luigi
On Thu, Feb 3, 2022 at 11:58 AM Jonathan Sweemer <sw...@gm...> wrote:
> Hi Anders,
>
> Looks like there is some code in the QuantLib test suite for
> American-style vanilla Heston pricing using FD [1]. You might be able to
> reuse some of this code for calibration purposes as well.
>
> [1]
> https://github.com/lballabio/QuantLib/blob/master/test-suite/hestonmodel.cpp#L665
>
> On Wed, Feb 2, 2022 at 4:33 AM Anders Johansson <
> and...@ti...> wrote:
>
>> Hi,
>>
>> Is there a way to calibrate a heston model to american options using QL?
>> Which variety is the fastest?
>>
>> Thank you very much.
>>
>> //A
>>
>> _______________________________________________
>> QuantLib-users mailing list
>> Qua...@li...
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Jonathan S. <sw...@gm...> - 2022-02-03 10:55:01
|
Hi Anders, Looks like there is some code in the QuantLib test suite for American-style vanilla Heston pricing using FD [1]. You might be able to reuse some of this code for calibration purposes as well. [1] https://github.com/lballabio/QuantLib/blob/master/test-suite/hestonmodel.cpp#L665 On Wed, Feb 2, 2022 at 4:33 AM Anders Johansson <and...@ti...> wrote: > Hi, > > Is there a way to calibrate a heston model to american options using QL? > Which variety is the fastest? > > Thank you very much. > > //A > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Sumit S. <su...@mo...> - 2022-02-02 23:47:26
|
Sorry please ignore my previous email Thanks On Wed, 2 Feb 2022 at 20:15, Sumit Sengupta <su...@mo...> wrote: > Hi, > Just wondering what’s the difference in the 2 functions from a callable > bond perspective. > > Thanks > Sumit > -- > Mosaic Smart Data > > mobile +44 (0)7961839363 > su...@mo... > 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom > www.mosaicsmartdata.com > -- Mosaic Smart Data mobile +44 (0)7961839363 su...@mo... 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom www.mosaicsmartdata.com |
|
From: Sumit S. <su...@mo...> - 2022-02-02 21:26:55
|
Hi, Just wondering what’s the difference in the 2 functions from a callable bond perspective. Thanks Sumit -- Mosaic Smart Data mobile +44 (0)7961839363 su...@mo... 25 Finsbury Circus ▫ EC2M 7EE ▫ London ▫ United Kingdom www.mosaicsmartdata.com |
|
From: Paul B. <p.b...@gm...> - 2022-02-02 10:31:11
|
Hi Ben & Luigi Many thanks for your hints. I will try this. Kind regards Paul On 02.02.22 11:24, Luigi Ballabio wrote: > Hello, > the `OvernightLeg` class now has a `withPaymentLag` method that > allows to specify a number of payment days after the end date of the > coupon, and the `OvernightIndexedSwap` class takes a similar parameter > at its constructor, so swaps on RFR should be covered. > > There's still no such parameter for `VanillaSwap`, but `IborLeg` has > `withPaymentLag`, so a workaround for floating-rate swaps (or bonds) > would be to build the fixed and floating leg explicitly and pass them > to the `Swap` class constructor. > > Hope this helps, > Luigi > > > On Wed, Feb 2, 2022 at 9:46 AM Paul Buettiker <p.b...@gm...> > wrote: > > Dear all > > With the advent of swaps on RFR, the terms of payment for some > currencies changed: the two legs now may have delayed payment > dates, i.e. the pay date is n days after the accrual end date (see > e.g. > https://www.snb.ch/n/mmr/reference/template_20191202/source/template_20191202.n.pdf > ). BTW, the same also holds for some floating rate notes. > > According to an older statement of Luigi ( > https://stackoverflow.com/questions/39789483/c-quantlib-swap-payment-dates), > there was no (easy) way to account for such delayed payment. > > Are there plans to account for such delays? Is there a workaround > (sorry, I'm not yet very experienced with QuantLib)? > > Kind regards, > Paul. > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Luigi B. <lui...@gm...> - 2022-02-02 10:24:58
|
Hello,
the `OvernightLeg` class now has a `withPaymentLag` method that allows
to specify a number of payment days after the end date of the coupon, and
the `OvernightIndexedSwap` class takes a similar parameter at its
constructor, so swaps on RFR should be covered.
There's still no such parameter for `VanillaSwap`, but `IborLeg` has
`withPaymentLag`, so a workaround for floating-rate swaps (or bonds) would
be to build the fixed and floating leg explicitly and pass them to the
`Swap` class constructor.
Hope this helps,
Luigi
On Wed, Feb 2, 2022 at 9:46 AM Paul Buettiker <p.b...@gm...> wrote:
> Dear all
>
> With the advent of swaps on RFR, the terms of payment for some currencies
> changed: the two legs now may have delayed payment dates, i.e. the pay date
> is n days after the accrual end date (see e.g.
> https://www.snb.ch/n/mmr/reference/template_20191202/source/template_20191202.n.pdf
> ). BTW, the same also holds for some floating rate notes.
>
> According to an older statement of Luigi (
> https://stackoverflow.com/questions/39789483/c-quantlib-swap-payment-dates),
> there was no (easy) way to account for such delayed payment.
>
> Are there plans to account for such delays? Is there a workaround (sorry,
> I'm not yet very experienced with QuantLib)?
>
> Kind regards,
> Paul.
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Ben W. <ben...@ma...> - 2022-02-02 09:24:01
|
Thanks Luigi, I was afraid this might be the case. By the looks of things we might be able to get the server upgraded to Python 3.7 which would save building my own.
Regards
Bne
From: Luigi Ballabio <lui...@gm...>
Sent: Wednesday, 2 February 2022 7:47 PM
To: Ben Watson <ben...@ma...>
Cc: QuantLib users <qua...@li...>
Subject: Re: [Quantlib-users] Latest version of Quantlib for Python 3.5.2
Hello Ben,
I'm not aware of other binary repositories.
Luigi
On Wed, Feb 2, 2022 at 5:22 AM Ben Watson <ben...@ma... <mailto:ben...@ma...> > wrote:
Hi,
I am executing Quantlib python scripts from an SQL server. I have a working
script running in a local UI running Python 3.8 with out issue. However on
the SQL server I get the error module 'QuantLib' has no attribute
'OvernightLeg'.
Looking at the installed version it is telling me quantlib version 1.16.1
which I am guessing predates a number of features like OvernightLeg's. Are
there any later versions of pre-complied Quantlib that are Python 3.5.2
compliant floating around the web, or am I in the world of compiling up a
version?
Regards
Ben
_______________________________________________
QuantLib-users mailing list
Qua...@li... <mailto:Qua...@li...>
https://lists.sourceforge.net/lists/listinfo/quantlib-users
|
|
From: Ben W. <ben...@ma...> - 2022-02-02 09:06:21
|
I have been looking at similar issues with XCCY ASW swaps and RFR rates. Manually built custom swap legs made with SimpleCashFlow to offset coupon amounts and manually calculate stub accruals etc. Regards Ben From: Paul Buettiker <p.b...@gm...> Sent: Wednesday, 2 February 2022 7:43 PM To: qua...@li... Subject: [Quantlib-users] Delayed payment dates for swaps and FRN Dear all With the advent of swaps on RFR, the terms of payment for some currencies changed: the two legs now may have delayed payment dates, i.e. the pay date is n days after the accrual end date (see e.g. https://www.snb.ch/n/mmr/reference/template_20191202/source/template_20191202.n.pdf ). BTW, the same also holds for some floating rate notes. According to an older statement of Luigi ( https://stackoverflow.com/questions/39789483/c-quantlib-swap-payment-dates), there was no (easy) way to account for such delayed payment. Are there plans to account for such delays? Is there a workaround (sorry, I'm not yet very experienced with QuantLib)? Kind regards, Paul. |
|
From: Luigi B. <lui...@gm...> - 2022-02-02 08:47:45
|
Hello Ben,
I'm not aware of other binary repositories.
Luigi
On Wed, Feb 2, 2022 at 5:22 AM Ben Watson <ben...@ma...>
wrote:
> Hi,
>
> I am executing Quantlib python scripts from an SQL server. I have a working
> script running in a local UI running Python 3.8 with out issue. However on
> the SQL server I get the error module 'QuantLib' has no attribute
> 'OvernightLeg'.
>
> Looking at the installed version it is telling me quantlib version 1.16.1
> which I am guessing predates a number of features like OvernightLeg's. Are
> there any later versions of pre-complied Quantlib that are Python 3.5.2
> compliant floating around the web, or am I in the world of compiling up a
> version?
>
> Regards
>
> Ben
>
>
>
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Paul B. <p.b...@gm...> - 2022-02-02 08:43:33
|
Dear all With the advent of swaps on RFR, the terms of payment for some currencies changed: the two legs now may have delayed payment dates, i.e. the pay date is n days after the accrual end date (see e.g. https://www.snb.ch/n/mmr/reference/template_20191202/source/template_20191202.n.pdf ). BTW, the same also holds for some floating rate notes. According to an older statement of Luigi ( https://stackoverflow.com/questions/39789483/c-quantlib-swap-payment-dates), there was no (easy) way to account for such delayed payment. Are there plans to account for such delays? Is there a workaround (sorry, I'm not yet very experienced with QuantLib)? Kind regards, Paul. |
|
From: Ben W. <ben...@ma...> - 2022-02-02 04:19:26
|
Hi, I am executing Quantlib python scripts from an SQL server. I have a working script running in a local UI running Python 3.8 with out issue. However on the SQL server I get the error module 'QuantLib' has no attribute 'OvernightLeg'. Looking at the installed version it is telling me quantlib version 1.16.1 which I am guessing predates a number of features like OvernightLeg's. Are there any later versions of pre-complied Quantlib that are Python 3.5.2 compliant floating around the web, or am I in the world of compiling up a version? Regards Ben |
|
From: Anders J. <and...@ti...> - 2022-02-01 19:29:52
|
Hi, Is there a way to calibrate a heston model to american options using QL? Which variety is the fastest? Thank you very much. //A |
|
From: Will S. <Wil...@as...> - 2022-01-28 15:25:27
|
Hi there, does anyone know if there is a function in Quantlib Excel that would allow me to aggregate a series of Bond handles and see their aggregate deltas split out by separate tenor buckets? (Presumably if there was it would be the tenor buckets as defined by a specific discount curve that I would have to build) Thanks in advance for any thoughts & have a good weekend, Will |
|
From: Klaus S. <kl...@sp...> - 2022-01-27 22:30:04
|
Hi Yevgeniy don't know if QuantLib would be my first choise to solve general PDEs but this script below does the job. Defintion of D(x,t) and the heat diffusion equation is taken e.g. from https://www.uni-muenster.de/imperia/md/content/physik_tp/lectures/ws2016-2017/num_methods_i/heat.pdf from typing import List import QuantLib as ql import matplotlib.pyplot as plt import numpy as np class HeatDiffusionOperator: def __init__(self, t_max: float, x_values: List[float]): self.__mesher = ql.FdmMesherComposite( ql.Predefined1dMesher(x_values) ) self.__t_max = t_max self.__n = len(x_values) self.__x_values = ql.Array(x_values) self.__dx = ql.FirstDerivativeOp(0, self.__mesher) self.__ddx = ql.SecondDerivativeOp(0, self.__mesher) self.__map = ql.TripleBandLinearOp(0, self.__mesher) def size(self) -> int: return 1 def setTime(self, t1: float, t2: float): t = 0.5 * (t1 + t2) self.__map.axpyb( ql.Array(1, 1.0), self.__dx, self.__ddx.mult(self.__x_values + ql.Array(self.__n, self.__t_max - t)), ql.Array() ) def apply(self, r: ql.Array) -> ql.Array: return self.__map.apply(r) def solve_splitting(self, direction: int, r: ql.Array, dt: float) -> ql.Array: return self.__map.solve_splitting(r, dt, 1.0) if __name__ == "__main__": n_points = 400 n_time_steps = 500 x_min = 0 x_max = 0.4 t_max = 0.02 x_values = np.arange(x_min, x_max + 1e-8, (x_max - x_min) / (n_points - 1)) y_values = ql.Array(list(np.exp(-(x_values - 0.5 * (x_max + x_min)) ** 2 / 1e-4))) op = HeatDiffusionOperator(t_max, list(x_values)) solver = ql.FdmBackwardSolver( ql.FdmLinearOpCompositeProxy(op), ql.FdmBoundaryConditionSet(), ql.FdmStepConditionComposite(ql.DoubleVector(), ql.FdmStepConditionVector()), ql.FdmSchemeDesc.CrankNicolson() ) solver.rollback(y_values, t_max, 0.0, n_time_steps, 0) plt.plot(x_values, y_values) plt.show() On Dienstag, 25. Januar 2022 23:39:57 CET Yev via QuantLib-users wrote: Hi, I have a Python code that solves a 1-dimentional Heat Diffusion PDE. My PDE has Diffusion Coefficient D(x,t) = x+t My grid has 400 points in range [0,0.4] I have a set of x values at time 0, and I iterate for 500 time steps. I'd like to rewrite it using Quantlib, as I hope it will speed up my process. I looked through documentation and source code, but couldn't figure out what classes should I use to implement it. Can you point me to how such problem can be solved with Quantlib? Thank you, Yevgeniy |