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
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Amy C. <amy...@gm...> - 2024-03-27 15:56:25
|
Hi All,
I am struggling to calculate the implied volatility for a Euribor6m
Swaption.
I was given single period swap rates and swap rates for ESTR, as well as
Euribor 6M swap rates. I have created rate helpers from these and
constructed a curve for each.
Following this, I have inserted the values I was giving for a 10Y10Y
swaption. The expected volatility in normal terms is 75.2 Bps. However, I
get 98.22 as a result.
Is there anything special about the discount curve fed into the pricing
engine for swaptions?
Please see my code below.
Thank you,
Amy
*Output:*
NPV: -19.210268277252
Fixed Leg NPV: 1723.3766390105964 Floating Leg NPV: -1742.5869072878484 Fair
Rate: 0.02608758943943771 Maturity Date: March 7th, 2044 Start Date: March
6th, 2034 Quantlib Calc: 98.22 Bps Expected Val: 75.2 Bps
*Input:*
import QuantLib as ql
ql.Settings.instance().evaluationDate = ql.Date(29, 2, 2024)
estr_sps = [
{
"start_date": ql.Date(20, 3, 2024),
"end_date": ql.Date(20, 6, 2024),
"rate": 0.038,
},
{
"start_date": ql.Date(17, 7, 2024),
"end_date": ql.Date(17, 10, 2024),
"rate": 0.0346,
},
{
"start_date": ql.Date(20, 11, 2024),
"end_date": ql.Date(20, 2, 2025),
"rate": 0.03,
},
{
"start_date": ql.Date(19, 3, 2025),
"end_date": ql.Date(19, 6, 2025),
"rate": 0.026,
},
{
"start_date": ql.Date(16, 7, 2025),
"end_date": ql.Date(16, 10, 2025),
"rate": 0.0246,
},
{
"start_date": ql.Date(19, 11, 2025),
"end_date": ql.Date(19, 2, 2026),
"rate": 0.023,
},
{
"start_date": ql.Date(18, 3, 2026),
"end_date": ql.Date(18, 6, 2026),
"rate": 0.0229,
},
{
"start_date": ql.Date(15, 7, 2026),
"end_date": ql.Date(15, 10, 2026),
"rate": 0.0227,
},
{
"start_date": ql.Date(18, 11, 2026),
"end_date": ql.Date(18, 2, 2027),
"rate": 0.022,
},
{
"start_date": ql.Date(17, 3, 2027),
"end_date": ql.Date(17, 6, 2027),
"rate": 0.0223,
},
{
"start_date": ql.Date(21, 7, 2027),
"end_date": ql.Date(21, 10, 2027),
"rate": 0.0223,
},
]
estr_swaps = [
{"periods": "48M", "rate": 0.0264},
{"periods": "60M", "rate": 0.0258},
{"periods": "72M", "rate": 0.0255},
{"periods": "84M", "rate": 0.0253},
{"periods": "96M", "rate": 0.0253},
{"periods": "108M", "rate": 0.0254},
{"periods": "120M", "rate": 0.0256},
{"periods": "132M", "rate": 0.0256},
{"periods": "144M", "rate": 0.0259},
{"periods": "156M", "rate": 0.0268},
{"periods": "168M", "rate": 0.0262},
{"periods": "180M", "rate": 0.0263},
{"periods": "192M", "rate": 0.0263},
{"periods": "204M", "rate": 0.0263},
{"periods": "216M", "rate": 0.0262},
{"periods": "228M", "rate": 0.026},
{"periods": "240M", "rate": 0.026},
{"periods": "300M", "rate": 0.025},
{"periods": "360M", "rate": 0.0242},
{"periods": "420M", "rate": 0.0235},
{"periods": "480M", "rate": 0.0229},
{"periods": "540M", "rate": 0.0223},
{"periods": "600M", "rate": 0.0217},
{"periods": "720M", "rate": 0.021},
{"periods": "840M", "rate": 0.0203},
]
euribor6m_swaps = [
{"periods": "12M", "rate": 0.0374},
{"periods": "24M", "rate": 0.0324},
{"periods": "36M", "rate": 0.03},
{"periods": "48M", "rate": 0.0288},
{"periods": "60M", "rate": 0.0279},
{"periods": "72M", "rate": 0.0276},
{"periods": "84M", "rate": 0.0273},
{"periods": "96M", "rate": 0.0272},
{"periods": "108M", "rate": 0.0272},
{"periods": "120M", "rate": 0.0273},
{"periods": "132M", "rate": 0.0273},
{"periods": "144M", "rate": 0.0274},
{"periods": "156M", "rate": 0.0274},
{"periods": "168M", "rate": 0.0274},
{"periods": "180M", "rate": 0.0274},
{"periods": "192M", "rate": 0.0273},
{"periods": "204M", "rate": 0.0272},
{"periods": "216M", "rate": 0.027},
{"periods": "228M", "rate": 0.0268},
{"periods": "240M", "rate": 0.0266},
{"periods": "300M", "rate": 0.0254},
{"periods": "360M", "rate": 0.0243},
{"periods": "420M", "rate": 0.0235},
{"periods": "480M", "rate": 0.0226},
{"periods": "540M", "rate": 0.0218},
{"periods": "600M", "rate": 0.021},
{"periods": "720M", "rate": 0.0202},
{"periods": "840M", "rate": 0.0194},
]
estr_helpers = list()
for sps in estr_sps:
estr_helpers.append(
ql.DatedOISRateHelper(
sps["start_date"],
sps["end_date"],
ql.QuoteHandle(ql.SimpleQuote(sps["rate"])),
ql.Estr(),
)
)
for swap in estr_swaps:
estr_helpers.append(
ql.OISRateHelper(
2,
ql.Period(swap["periods"]),
ql.QuoteHandle(ql.SimpleQuote(swap["rate"])),
ql.Estr(),
)
)
estr_curve = ql.PiecewiseLogCubicDiscount(2, ql.TARGET(), estr_helpers, ql.
Actual360())
estr_curve.enableExtrapolation()
estr_curve_handle = ql.YieldTermStructureHandle(estr_curve)
euribor6m_swaps_helpers = list()
euribor6m = ql.Euribor6M()
for swap in euribor6m_swaps:
euribor6m_swaps_helpers.append(
ql.SwapRateHelper(
ql.QuoteHandle(ql.SimpleQuote(swap["rate"])),
ql.Period(swap["periods"]),
ql.TARGET(),
ql.Annual,
ql.Unadjusted,
ql.Actual360(),
euribor6m,
)
)
euribor6m_curve = ql.PiecewiseLogCubicDiscount(
2, ql.TARGET(), euribor6m_swaps_helpers, ql.Actual360()
)
euribor6m_curve.enableExtrapolation()
euribor6m_curve_handle = ql.YieldTermStructureHandle(euribor6m_curve)
exercise_date = ql.TARGET().advance(
ql.Settings.instance().evaluationDate, ql.Period(120, ql.Months)
)
swap = ql.MakeVanillaSwap(
ql.Period(120, ql.Months),
ql.Euribor6M(euribor6m_curve_handle),
0.0258,
ql.Period(120, ql.Months),
Nominal=10_000,
pricingEngine=ql.DiscountingSwapEngine(estr_curve_handle),
swapType=ql.Swap.Receiver,
)
print(f"NPV: {swap.NPV()}")
print(f"Fixed Leg NPV: {swap.fixedLegNPV()}")
print(f"Floating Leg NPV: {swap.floatingLegNPV()}")
print(f"Fair Rate: {swap.fairRate()}")
print(f"Maturity Date: {swap.maturityDate()}")
print(f"Start Date: {swap.startDate()}")
exercise = ql.EuropeanExercise(swap.startDate())
swaption = ql.Swaption(swap, exercise)
volatility = 0.2
vol_handle = ql.QuoteHandle(ql.SimpleQuote(volatility))
bachelier_model = ql.BachelierSwaptionEngine(estr_curve_handle, vol_handle)
swaption.setPricingEngine(bachelier_model)
normal_vol = (
swaption.impliedVolatility(
819,
estr_curve_handle,
guess=0.002,
type=ql.Normal,
)
* 10_000
)
print("\n")
print(f"Quantlib Calc: {round(normal_vol,2)} Bps")
print(f"Expected Val: 75.2 Bps")
|
|
From: Aleksis R. <ale...@go...> - 2024-03-18 15:14:26
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Thanks for the follow up and the PR, Marcin.</div><div><br></div><div>Look forward to the updated class.</div><div><br></div><div>Aleksis</div><br id="lineBreakAtBeginningOfSignature"><div dir="ltr">Sent from my iPhone</div><div dir="ltr"><br><blockquote type="cite">On Mar 18, 2024, at 10:59, Marcin Rybacki <mry...@gm...> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="ltr">Hi Aleksis,<div><br></div><div>Thank you for your thorough analysis. You do have a point here and there seems to be a bug in the source code which implies that the curve settlement date should be the same as the instrument settlement date, in order to price the instrument back to par.</div><div><br></div><div>I created a PR that should fix this:<br><a href="https://github.com/lballabio/QuantLib/pull/1930">https://github.com/lballabio/QuantLib/pull/1930</a><br></div><div><br></div><div>Kind regards,</div><div>Marcin</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 2 Mar 2024 at 19:00, Aleksis Ali Raza <<a href="mailto:ale...@go...">ale...@go...</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Thanks for reply Marcin. <div><br></div><div>Agreed, but unfortunately the only way I can get the xccy swaps to price to par is by having a curve settlement set to 2 and PVing the cashflows to the sett’t date. I’ve spent some on this but can’t find a work around. Below is a toy example illustrating this problem (a copy/paste will run it). The only way I get a zero npv for the xccy swap is by having a curve sett of T+2 in all curves (euribor3M_curve, usdlibor3M_curve and eur_usd_curve).</div><div><br></div><div><div style="background-color:rgb(30,31,34);color:rgb(188,190,196)"><pre style="font-family:"JetBrains Mono",monospace;font-size:9pt"><span style="color:rgb(207,142,109)">import </span>QuantLib <span style="color:rgb(207,142,109)">as </span>ql<br><br>today = ql.Date(<span style="color:rgb(42,172,184)">27</span>, ql.October, <span style="color:rgb(42,172,184)">2021</span>)<br>ql.Settings.instance().evaluationDate = today<br><br>calendar = ql.UnitedStates(ql.UnitedStates.FederalReserve)<br>euribor3M_curve = ql.YieldTermStructureHandle(ql.FlatForward(<span style="color:rgb(42,172,184)">0</span>,calendar,<span style="color:rgb(42,172,184)">0.06</span>,ql.Actual360()))<br>euribor3M = ql.IborIndex(<span style="color:rgb(106,171,115)">'c'</span>, ql.Period(<span style="color:rgb(106,171,115)">'3m'</span>), <span style="color:rgb(42,172,184)">2</span>, ql.Currency(), ql.TARGET(),<br> ql.ModifiedFollowing, <span style="color:rgb(207,142,109)">False</span>, ql.Actual365Fixed(),euribor3M_curve)<br>usdlibor3M_curve = ql.YieldTermStructureHandle(ql.FlatForward(<span style="color:rgb(42,172,184)">0</span>,calendar,<span style="color:rgb(42,172,184)">0.02</span>,ql.Actual365Fixed()))<br>usdlibor3M = ql.IborIndex(<span style="color:rgb(106,171,115)">'c'</span>, ql.Period(<span style="color:rgb(106,171,115)">'3m'</span>), <span style="color:rgb(42,172,184)">2</span>, ql.Currency(), calendar,<br> ql.ModifiedFollowing, <span style="color:rgb(207,142,109)">False</span>, ql.Actual360(),usdlibor3M_curve)<br>notional = <span style="color:rgb(42,172,184)">1_000_000<br></span>fx_0 = <span style="color:rgb(42,172,184)">0.85<br></span>start_date = calendar.advance(today, ql.Period(<span style="color:rgb(42,172,184)">2</span>, ql.Days))<br>end_date = calendar.advance(start_date, ql.Period(<span style="color:rgb(42,172,184)">3</span>, ql.Months))<br>tenor = ql.Period(<span style="color:rgb(42,172,184)">3</span>, ql.Months)<br>rule = ql.DateGeneration.Forward<br>convention = ql.Following<br>end_of_month = <span style="color:rgb(207,142,109)">False<br></span>schedule = ql.Schedule(start_date,end_date,tenor,calendar,convention,convention,rule,end_of_month)<br>usd_leg = ((ql.SimpleCashFlow(-notional, schedule[<span style="color:rgb(42,172,184)">0</span>]),)+ ql.IborLeg(<span style="color:rgb(170,73,38)">nominals</span>=[notional],<span style="color:rgb(170,73,38)">schedule</span>=schedule,<span style="color:rgb(170,73,38)">index</span>=usdlibor3M,)<br> + (ql.SimpleCashFlow(notional, schedule[-<span style="color:rgb(42,172,184)">1</span>]),))<br>usd_npv = ql.CashFlows.npv(usd_leg, usdlibor3M_curve, <span style="color:rgb(207,142,109)">True</span>,start_date)<br><span style="color:rgb(136,136,198)">print</span>(usd_npv)<br>quote = -<span style="color:rgb(42,172,184)">0.03<br></span>ccbs_quotes = {<span style="color:rgb(106,171,115)">'3M'</span>: quote}<br>day_counter = euribor3M_curve.dayCounter()<br>ccbs_helpers = [ql.ConstNotionalCrossCurrencyBasisSwapRateHelper(<br> ql.QuoteHandle(ql.SimpleQuote(value)),<br> ql.Period(period),<br> <span style="color:rgb(42,172,184)">2</span>,<br> calendar,<br> convention,<br> end_of_month,<br> usdlibor3M,<br> euribor3M,<br> usdlibor3M_curve,<br> <span style="color:rgb(207,142,109)">True</span>,<br> <span style="color:rgb(207,142,109)">False</span>)<br> <span style="color:rgb(207,142,109)">for </span>period, value <span style="color:rgb(207,142,109)">in </span>ccbs_quotes.items()]<br><br>eur_usd_curve = ql.YieldTermStructureHandle(ql.PiecewiseLogLinearDiscount(<span style="color:rgb(42,172,184)">0</span>, calendar, ccbs_helpers, day_counter))<br>eur_leg = ((ql.SimpleCashFlow(-notional * fx_0, schedule[<span style="color:rgb(42,172,184)">0</span>]),)+ ql.IborLeg(<span style="color:rgb(170,73,38)">nominals</span>=[notional * fx_0],<span style="color:rgb(170,73,38)">schedule</span>=schedule,<span style="color:rgb(170,73,38)">index</span>=euribor3M,<span style="color:rgb(170,73,38)">spreads</span>=[quote])<br> + (ql.SimpleCashFlow(notional * fx_0, schedule[-<span style="color:rgb(42,172,184)">1</span>]),))<br>eur_npv = ql.CashFlows.npv(eur_leg,eur_usd_curve, <span style="color:rgb(207,142,109)">True</span>,start_date)<br><span style="color:rgb(136,136,198)">print</span>(eur_npv)<br>eur_leg_euribor = ((ql.SimpleCashFlow(-notional * fx_0, schedule[<span style="color:rgb(42,172,184)">0</span>]),)+ ql.IborLeg(<span style="color:rgb(170,73,38)">nominals</span>=[notional * fx_0],<span style="color:rgb(170,73,38)">schedule</span>=schedule,<span style="color:rgb(170,73,38)">index</span>=euribor3M,<span style="color:rgb(170,73,38)">spreads</span>=[<span style="color:rgb(42,172,184)">0</span>])<br> + (ql.SimpleCashFlow(notional * fx_0, schedule[-<span style="color:rgb(42,172,184)">1</span>]),))<br>eur_npv_euribor = ql.CashFlows.npv(eur_leg_euribor,euribor3M_curve, <span style="color:rgb(207,142,109)">True</span>,start_date)<br><span style="color:rgb(136,136,198)">print</span>(eur_npv_euribor)<br><br><span style="color:rgb(136,136,198)">print</span>(ccbs_helpers[<span style="color:rgb(42,172,184)">0</span>].impliedQuote())</pre></div></div><div><div><br></div><div><div><blockquote type="cite"><div>On Mar 2, 2024, at 9:33 AM, Marcin Rybacki <<a href="mailto:mry...@gm..." target="_blank">mry...@gm...</a>> wrote:</div><br><div><div dir="auto">Hi Aleksis,</div><div dir="auto"><br></div><div dir="auto">The curve origin (curve settlement date) does not necessarily need to correspond to the settlement convention of the instruments used to construct the curve.</div><div dir="auto">So, you can safely set it to T+0 and both FX swaps and cross currency swaps, that you use to build the term structure, should price back to par.</div><div dir="auto"><br></div><div dir="auto">I hope this answers your question.</div><div dir="auto"><br></div><div dir="auto">Kind regards,</div><div dir="auto">Marcin</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 28 Feb 2024 at 14:05, Aleksis Ali Raza via QuantLib-users <<a href="mailto:qua...@li..." target="_blank">qua...@li...</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Perhaps this is a naive question but when bootstrapping a cross currency curve using FXSwapHelper for short end and ConstNotionalCrossCurrencyBasisSwapHelper for the long end, I’m running into an issue where I need to specify the <b>curve settlement date</b> (curve_sett in the code below ) as T+2<b>. </b>This is to reflect correct valuation of the cross currency swaps when priced off the curve. However, for FXSwapHelpers curve_sett should be T+0 - this is so that ON and TN FX swaps can be used in the helpers and repriced correctly. The code used is below.<div><div><br></div><div>How does one get around this issue (without having to work with two separate curves, or without leaving out ON and TN from the FXSwapHelpers)?</div><div><div><br></div><div>Thanks, Aleksis</div><div><br></div><div><div style="background-color:rgb(30,31,34);color:rgb(188,190,196)"><pre style="font-family:"JetBrains Mono",monospace;font-size:9pt"><span style="color:rgb(234,9,70);font-style:italic"># FX swaps<br></span>fxSwapHelpers = [ql.FxSwapRateHelper(ql.QuoteHandle(q),<br> ql.QuoteHandle(FX),<br> m,<br> <span style="color:rgb(136,136,198)">int</span>(d),<br> calendar,<br> business_convention_base,<br> end_of_month,<br> <span style="color:rgb(207,142,109)">True</span>,<br> collateral_curve)<br> <span style="color:rgb(207,142,109)">for </span>d, q, m <span style="color:rgb(207,142,109)">in </span><span style="color:rgb(136,136,198)">zip</span>(dffxswapsFXspotlag, fxswap_quotes, dffxswapsmaturity)]<br><br><span style="color:rgb(234,9,70);font-style:italic"># xccy basis curve<br></span>swap_helpers_xccybasis = [ql.ConstNotionalCrossCurrencyBasisSwapRateHelper(ql.QuoteHandle(q),<br> m,<br> <span style="color:rgb(136,136,198)">int</span>(d),<br> calendar,<br> business_convention_quote,<br> end_of_month,<br> index_base,<br> index_quote,<br> collateral_curve,<br> <span style="color:rgb(207,142,109)">True</span>,<br> <span style="color:rgb(207,142,109)">False</span>)<br> <span style="color:rgb(207,142,109)">for </span>q, m, d <span style="color:rgb(207,142,109)">in </span><span style="color:rgb(136,136,198)">zip</span>(xccybasisquotes, xccybasismaturies, dfxccybasisFXspotlag)]<br><br>rate_helpers_xccybasis = fxSwapHelpers + swap_helpers_xccybasis<br>curve_basis = curve_interpolation(curve_sett, calendar, rate_helpers_xccybasis, curve_daycount)<br>curve_basis.enableExtrapolation()<br>final_curve_basis = ql.RelinkableYieldTermStructureHandle(curve_basis)</pre></div><div><br></div></div></div></div></div>_______________________________________________<br> QuantLib-users mailing list<br> <a href="mailto:Qua...@li..." target="_blank">Qua...@li...</a><br> <a href="https://lists.sourceforge.net/lists/listinfo/quantlib-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/lists/listinfo/quantlib-users</a><br> </blockquote></div></div> </div></blockquote></div><br></div></div></div></blockquote></div> </div></blockquote></body></html> |
|
From: Marcin R. <mry...@gm...> - 2024-03-18 10:59:26
|
Hi Aleksis, Thank you for your thorough analysis. You do have a point here and there seems to be a bug in the source code which implies that the curve settlement date should be the same as the instrument settlement date, in order to price the instrument back to par. I created a PR that should fix this: https://github.com/lballabio/QuantLib/pull/1930 Kind regards, Marcin On Sat, 2 Mar 2024 at 19:00, Aleksis Ali Raza <ale...@go...> wrote: > Thanks for reply Marcin. > > Agreed, but unfortunately the only way I can get the xccy swaps to price > to par is by having a curve settlement set to 2 and PVing the cashflows to > the sett’t date. I’ve spent some on this but can’t find a work around. > Below is a toy example illustrating this problem (a copy/paste will run > it). The only way I get a zero npv for the xccy swap is by having a curve > sett of T+2 in all curves (euribor3M_curve, usdlibor3M_curve and > eur_usd_curve). > > import QuantLib as ql > > today = ql.Date(27, ql.October, 2021) > ql.Settings.instance().evaluationDate = today > > calendar = ql.UnitedStates(ql.UnitedStates.FederalReserve) > euribor3M_curve = ql.YieldTermStructureHandle(ql.FlatForward(0,calendar,0.06,ql.Actual360())) > euribor3M = ql.IborIndex('c', ql.Period('3m'), 2, ql.Currency(), ql.TARGET(), > ql.ModifiedFollowing, False, ql.Actual365Fixed(),euribor3M_curve) > usdlibor3M_curve = ql.YieldTermStructureHandle(ql.FlatForward(0,calendar,0.02,ql.Actual365Fixed())) > usdlibor3M = ql.IborIndex('c', ql.Period('3m'), 2, ql.Currency(), calendar, > ql.ModifiedFollowing, False, ql.Actual360(),usdlibor3M_curve) > notional = 1_000_000 > fx_0 = 0.85 > start_date = calendar.advance(today, ql.Period(2, ql.Days)) > end_date = calendar.advance(start_date, ql.Period(3, ql.Months)) > tenor = ql.Period(3, ql.Months) > rule = ql.DateGeneration.Forward > convention = ql.Following > end_of_month = False > schedule = ql.Schedule(start_date,end_date,tenor,calendar,convention,convention,rule,end_of_month) > usd_leg = ((ql.SimpleCashFlow(-notional, schedule[0]),)+ ql.IborLeg(nominals=[notional],schedule=schedule,index=usdlibor3M,) > + (ql.SimpleCashFlow(notional, schedule[-1]),)) > usd_npv = ql.CashFlows.npv(usd_leg, usdlibor3M_curve, True,start_date) > print(usd_npv) > quote = -0.03 > ccbs_quotes = {'3M': quote} > day_counter = euribor3M_curve.dayCounter() > ccbs_helpers = [ql.ConstNotionalCrossCurrencyBasisSwapRateHelper( > ql.QuoteHandle(ql.SimpleQuote(value)), > ql.Period(period), > 2, > calendar, > convention, > end_of_month, > usdlibor3M, > euribor3M, > usdlibor3M_curve, > True, > False) > for period, value in ccbs_quotes.items()] > > eur_usd_curve = ql.YieldTermStructureHandle(ql.PiecewiseLogLinearDiscount(0, calendar, ccbs_helpers, day_counter)) > eur_leg = ((ql.SimpleCashFlow(-notional * fx_0, schedule[0]),)+ ql.IborLeg(nominals=[notional * fx_0],schedule=schedule,index=euribor3M,spreads=[quote]) > + (ql.SimpleCashFlow(notional * fx_0, schedule[-1]),)) > eur_npv = ql.CashFlows.npv(eur_leg,eur_usd_curve, True,start_date) > print(eur_npv) > eur_leg_euribor = ((ql.SimpleCashFlow(-notional * fx_0, schedule[0]),)+ ql.IborLeg(nominals=[notional * fx_0],schedule=schedule,index=euribor3M,spreads=[0]) > + (ql.SimpleCashFlow(notional * fx_0, schedule[-1]),)) > eur_npv_euribor = ql.CashFlows.npv(eur_leg_euribor,euribor3M_curve, True,start_date) > print(eur_npv_euribor) > > print(ccbs_helpers[0].impliedQuote()) > > > On Mar 2, 2024, at 9:33 AM, Marcin Rybacki <mry...@gm...> wrote: > > Hi Aleksis, > > The curve origin (curve settlement date) does not necessarily need to > correspond to the settlement convention of the instruments used to > construct the curve. > So, you can safely set it to T+0 and both FX swaps and cross currency > swaps, that you use to build the term structure, should price back to par. > > I hope this answers your question. > > Kind regards, > Marcin > > On Wed, 28 Feb 2024 at 14:05, Aleksis Ali Raza via QuantLib-users < > qua...@li...> wrote: > >> Perhaps this is a naive question but when bootstrapping a cross currency >> curve using FXSwapHelper for short end and >> ConstNotionalCrossCurrencyBasisSwapHelper for the long end, I’m running >> into an issue where I need to specify the *curve settlement date* >> (curve_sett in the code below ) as T+2*. *This is to reflect correct >> valuation of the cross currency swaps when priced off the curve. However, >> for FXSwapHelpers curve_sett should be T+0 - this is so that ON and TN FX >> swaps can be used in the helpers and repriced correctly. The code used is >> below. >> >> How does one get around this issue (without having to work with two >> separate curves, or without leaving out ON and TN from the FXSwapHelpers)? >> >> Thanks, Aleksis >> >> # FX swaps >> fxSwapHelpers = [ql.FxSwapRateHelper(ql.QuoteHandle(q), >> ql.QuoteHandle(FX), >> m, >> int(d), >> calendar, >> business_convention_base, >> end_of_month, >> True, >> collateral_curve) >> for d, q, m in zip(dffxswapsFXspotlag, fxswap_quotes, dffxswapsmaturity)] >> >> # xccy basis curve >> swap_helpers_xccybasis = [ql.ConstNotionalCrossCurrencyBasisSwapRateHelper(ql.QuoteHandle(q), >> m, >> int(d), >> calendar, >> business_convention_quote, >> end_of_month, >> index_base, >> index_quote, >> collateral_curve, >> True, >> False) >> for q, m, d in zip(xccybasisquotes, xccybasismaturies, dfxccybasisFXspotlag)] >> >> rate_helpers_xccybasis = fxSwapHelpers + swap_helpers_xccybasis >> curve_basis = curve_interpolation(curve_sett, calendar, rate_helpers_xccybasis, curve_daycount) >> curve_basis.enableExtrapolation() >> final_curve_basis = ql.RelinkableYieldTermStructureHandle(curve_basis) >> >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > > |
|
From: Mike D. <mik...@gm...> - 2024-03-17 21:28:32
|
Anyone know if there are plans to update the addin since the QL library is on v1.33 now? |
|
From: Mike D. <mik...@gm...> - 2024-03-16 17:11:52
|
this folder contains all the ratehelpers available in the library: https://github.com/lballabio/QuantLib/tree/master/ql/termstructures/yield this file shows all the types exposed to python via swig: https://github.com/lballabio/QuantLib-SWIG/blob/master/SWIG/ratehelpers.i - Mike On Fri, Mar 15, 2024 at 12:27 PM jian Xu <jia...@gm...> wrote: > I'm not sure how the curve building works under the hood. What other rate > helpers can I use? > > Jian > > > On Fri, Mar 15, 2024 at 12:06 PM Mike DelMedico <mik...@gm...> > wrote: > >> Try using other types of ratehelpers to bypass the issue you are having. >> You know what rate you want to assign to each day so you can control the >> curve build that way instead. You don't need to use the futures ratehelper >> at all. >> >> - Mike >> >> On Fri, Mar 15, 2024 at 10:50 AM jian Xu <jia...@gm...> wrote: >> >>> Hi, >>> >>> I'm having trouble setting the Fed Fund futures when the start of the >>> averaging period is a non-business day. For example, the April 2023 FF >>> futures (4/1 is a Saturday). >>> >>> I added the fixing on 3/31. And when I construct >>> the OvernightIndexFutureRateHelper, I used April 1 2023 as the start date >>> of the averaging period. But then was I construct the yield curve from it, >>> and try to calculate the zero rate, I got the error saying: >>> >>> "RuntimeError: 1st iteration: failed at 1st alive instrument, pillar >>> April 28th, 2023, maturity April 28th, 2023, reference date April 3rd, >>> 2023: missing rate on April 1st, 2023 for index FedFundsON Actual/360" >>> >>> But April 1st, 2023 is a Saturday and I cannot add a fixing there. >>> According to the FF rule book, the benchmark rate on 4/1 should use the one >>> on 3/31. But how should I do that in QuantLib? Am I constructing the >>> yield curve correctly? >>> >>> Any comments are appreciated. Thank you very much! >>> >>> =========================== >>> Following is the python code: >>> >>> import QuantLib as ql >>> import numpy as np >>> >>> today = ql.Date(3, 4, 2023) >>> ql.Settings.instance().evaluationDate = today >>> calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond) >>> >>> ff_index = ql.FedFunds() >>> hist_quote = 95. >>> hist_rate = (100 - hist_quote)/100. >>> >>> ff_index.addFixing(ql.Date(31, 3, 2023), hist_rate) >>> ff_day_counter = ql.Actual360() >>> >>> quoted_rates = [ >>> (ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(28, 4, 2023)), >>> ] >>> convexityAdjustment = ql.QuoteHandle() >>> ff_helpers = [] >>> for rate, maturity in quoted_rates: >>> ff_helpers.append(ql.OvernightIndexFutureRateHelper(rate, >>> >>> ql.Date(1,4,2023), # start of the averaging period >>> maturity, >>> ff_index, >>> >>> convexityAdjustment, >>> >>> ql.RateAveraging.Simple)) >>> yield_curve = ql.PiecewiseLinearZero(today, ff_helpers, ql.Actual360()) >>> zr = yield_curve.zeroRate(next_date, ql.Actual360(), ql.Continuous) # >>> error >>> >>> >>> ================== >>> >>> _______________________________________________ >>> QuantLib-users mailing list >>> Qua...@li... >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>> >> |
|
From: jian Xu <jia...@gm...> - 2024-03-15 17:27:26
|
I'm not sure how the curve building works under the hood. What other rate helpers can I use? Jian On Fri, Mar 15, 2024 at 12:06 PM Mike DelMedico <mik...@gm...> wrote: > Try using other types of ratehelpers to bypass the issue you are having. > You know what rate you want to assign to each day so you can control the > curve build that way instead. You don't need to use the futures ratehelper > at all. > > - Mike > > On Fri, Mar 15, 2024 at 10:50 AM jian Xu <jia...@gm...> wrote: > >> Hi, >> >> I'm having trouble setting the Fed Fund futures when the start of the >> averaging period is a non-business day. For example, the April 2023 FF >> futures (4/1 is a Saturday). >> >> I added the fixing on 3/31. And when I construct >> the OvernightIndexFutureRateHelper, I used April 1 2023 as the start date >> of the averaging period. But then was I construct the yield curve from it, >> and try to calculate the zero rate, I got the error saying: >> >> "RuntimeError: 1st iteration: failed at 1st alive instrument, pillar >> April 28th, 2023, maturity April 28th, 2023, reference date April 3rd, >> 2023: missing rate on April 1st, 2023 for index FedFundsON Actual/360" >> >> But April 1st, 2023 is a Saturday and I cannot add a fixing there. >> According to the FF rule book, the benchmark rate on 4/1 should use the one >> on 3/31. But how should I do that in QuantLib? Am I constructing the >> yield curve correctly? >> >> Any comments are appreciated. Thank you very much! >> >> =========================== >> Following is the python code: >> >> import QuantLib as ql >> import numpy as np >> >> today = ql.Date(3, 4, 2023) >> ql.Settings.instance().evaluationDate = today >> calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond) >> >> ff_index = ql.FedFunds() >> hist_quote = 95. >> hist_rate = (100 - hist_quote)/100. >> >> ff_index.addFixing(ql.Date(31, 3, 2023), hist_rate) >> ff_day_counter = ql.Actual360() >> >> quoted_rates = [ >> (ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(28, 4, 2023)), >> ] >> convexityAdjustment = ql.QuoteHandle() >> ff_helpers = [] >> for rate, maturity in quoted_rates: >> ff_helpers.append(ql.OvernightIndexFutureRateHelper(rate, >> >> ql.Date(1,4,2023), # start of the averaging period >> maturity, >> ff_index, >> >> convexityAdjustment, >> >> ql.RateAveraging.Simple)) >> yield_curve = ql.PiecewiseLinearZero(today, ff_helpers, ql.Actual360()) >> zr = yield_curve.zeroRate(next_date, ql.Actual360(), ql.Continuous) # >> error >> >> >> ================== >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |
|
From: Mike D. <mik...@gm...> - 2024-03-15 17:06:26
|
Try using other types of ratehelpers to bypass the issue you are having. You know what rate you want to assign to each day so you can control the curve build that way instead. You don't need to use the futures ratehelper at all. - Mike On Fri, Mar 15, 2024 at 10:50 AM jian Xu <jia...@gm...> wrote: > Hi, > > I'm having trouble setting the Fed Fund futures when the start of the > averaging period is a non-business day. For example, the April 2023 FF > futures (4/1 is a Saturday). > > I added the fixing on 3/31. And when I construct > the OvernightIndexFutureRateHelper, I used April 1 2023 as the start date > of the averaging period. But then was I construct the yield curve from it, > and try to calculate the zero rate, I got the error saying: > > "RuntimeError: 1st iteration: failed at 1st alive instrument, pillar April > 28th, 2023, maturity April 28th, 2023, reference date April 3rd, 2023: > missing rate on April 1st, 2023 for index FedFundsON Actual/360" > > But April 1st, 2023 is a Saturday and I cannot add a fixing there. > According to the FF rule book, the benchmark rate on 4/1 should use the one > on 3/31. But how should I do that in QuantLib? Am I constructing the > yield curve correctly? > > Any comments are appreciated. Thank you very much! > > =========================== > Following is the python code: > > import QuantLib as ql > import numpy as np > > today = ql.Date(3, 4, 2023) > ql.Settings.instance().evaluationDate = today > calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond) > > ff_index = ql.FedFunds() > hist_quote = 95. > hist_rate = (100 - hist_quote)/100. > > ff_index.addFixing(ql.Date(31, 3, 2023), hist_rate) > ff_day_counter = ql.Actual360() > > quoted_rates = [ > (ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(28, 4, 2023)), > ] > convexityAdjustment = ql.QuoteHandle() > ff_helpers = [] > for rate, maturity in quoted_rates: > ff_helpers.append(ql.OvernightIndexFutureRateHelper(rate, > ql.Date(1,4,2023), > # start of the averaging period > maturity, > ff_index, > > convexityAdjustment, > > ql.RateAveraging.Simple)) > yield_curve = ql.PiecewiseLinearZero(today, ff_helpers, ql.Actual360()) > zr = yield_curve.zeroRate(next_date, ql.Actual360(), ql.Continuous) # > error > > > ================== > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: jian Xu <jia...@gm...> - 2024-03-15 15:44:53
|
Hi,
I'm having trouble setting the Fed Fund futures when the start of the
averaging period is a non-business day. For example, the April 2023 FF
futures (4/1 is a Saturday).
I added the fixing on 3/31. And when I construct
the OvernightIndexFutureRateHelper, I used April 1 2023 as the start date
of the averaging period. But then was I construct the yield curve from it,
and try to calculate the zero rate, I got the error saying:
"RuntimeError: 1st iteration: failed at 1st alive instrument, pillar April
28th, 2023, maturity April 28th, 2023, reference date April 3rd, 2023:
missing rate on April 1st, 2023 for index FedFundsON Actual/360"
But April 1st, 2023 is a Saturday and I cannot add a fixing there.
According to the FF rule book, the benchmark rate on 4/1 should use the one
on 3/31. But how should I do that in QuantLib? Am I constructing the
yield curve correctly?
Any comments are appreciated. Thank you very much!
===========================
Following is the python code:
import QuantLib as ql
import numpy as np
today = ql.Date(3, 4, 2023)
ql.Settings.instance().evaluationDate = today
calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond)
ff_index = ql.FedFunds()
hist_quote = 95.
hist_rate = (100 - hist_quote)/100.
ff_index.addFixing(ql.Date(31, 3, 2023), hist_rate)
ff_day_counter = ql.Actual360()
quoted_rates = [
(ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(28, 4, 2023)),
]
convexityAdjustment = ql.QuoteHandle()
ff_helpers = []
for rate, maturity in quoted_rates:
ff_helpers.append(ql.OvernightIndexFutureRateHelper(rate,
ql.Date(1,4,2023),
# start of the averaging period
maturity,
ff_index,
convexityAdjustment,
ql.RateAveraging.Simple))
yield_curve = ql.PiecewiseLinearZero(today, ff_helpers, ql.Actual360())
zr = yield_curve.zeroRate(next_date, ql.Actual360(), ql.Continuous) # error
==================
|
|
From: jian Xu <jia...@gm...> - 2024-03-13 03:43:08
|
Hi Mike, Thank you very much for the documentation. I followed the exact formula Daily Interest Accumulation Factor (DIAF) = 1 + di/360 * ri / 100 And the DIAF for May 1,2,3,4, 2023 are all 1 + 1/360 * 5/100 = 1.00013889 So I think the corresponding one day zero rate should be ln(DIAF) * 360 = 0.049996528 Which is the same as what I got before. But I still don't know how to get this number from QuantLib. Or was my calculation wrong? Jian On Tue, Mar 12, 2024 at 8:17 PM Mike DelMedico <mik...@gm...> wrote: > FWIW, this is the underlying market convention for the FF contracts. It's > the same exact math as 1m SOFR futures. > > > https://www.cmegroup.com/education/files/sofr-futures-settlement-calculation-methodologies.pdf > > On Tue, Mar 12, 2024 at 8:12 PM jian Xu <jia...@gm...> wrote: > >> Hi, >> >> I'm trying to understand how the zero rate from FedFund rates are >> calculated. For example, if I have May FedFunds futures quoting at 5% on >> May 1, 2, 3, and now I'm standing on May 4, so if I calculate the one day >> forward rate R (continuous compounding, actual/360), then I think it should >> be >> >> exp(- R * yearFrac) = (1+ 5%/360) ^ (-360*yearFrac) >> >> where yearFrac = 1/360. >> >> This gives R = 0.0499652 >> >> However, if I use the following QuantLib code, I got 0.0499267. Can >> anyone tell me where the small difference is from? Thank you very much. >> >> ---------------------------------------- >> import QuantLib as ql >> today = ql.Date(4, 5, 2023) >> ql.Settings.instance().evaluationDate = today >> ff_index = ql.FedFunds() >> hist_quote = 95. >> hist_rate = (100 - hist_quote)/100. >> >> ff_index.addFixing(ql.Date(1, 5, 2023), hist_rate) >> ff_index.addFixing(ql.Date(2, 5, 2023), hist_rate) >> ff_index.addFixing(ql.Date(3, 5, 2023), hist_rate) >> >> calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond) >> ff_day_counter = ql.Actual360() >> >> quoted_rates = [ >> (ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(31, 5, 2023)), >> (ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(30, 6, 2023)), >> ] >> convexityAdjustment = ql.QuoteHandle() >> ff_helpers = [] >> for rate, maturity in quoted_rates: >> ff_helpers.append(ql.OvernightIndexFutureRateHelper(rate, >> today, >> maturity, >> ff_index, >> >> convexityAdjustment, >> >> ql.RateAveraging.Simple)) >> >> ff_yield_curve_simple = ql.PiecewiseFlatForward(today, ff_helpers, >> ff_day_counter) >> zr = ff_yield_curve_simple.zeroRate(ql.Date(5, 5, 2023), ql.Actual360(), >> ql.Continuous, ql.Daily) >> print(zr.rate()) # 0.04999267 >> >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |
|
From: Mike D. <mik...@gm...> - 2024-03-13 02:05:32
|
Hi everyone, It looks like PR #1242 removed the explicit compounding method for the SofrFutureRateHelper constructor and removed the index argument as well. If hypothetically I wanted to add a (fake) future contract ratehelper to the FF/OIS curve, then it sounds like I should not be using SofrFutureRateHelper but instead use OvernightIndexFutureRateHelper, as this would allow me to explicitly pass the index? It seems like the only real difference then is that the inherited index for SofrFutureRateHelper uses the new SOFR calendar, but if I went the other route and passed a FedFund index to OvernightIndexFutureRateHelper, then that would be using the FederalReserve calendar. Am I thinking about this correctly? Thanks, Mike |
|
From: Mike D. <mik...@gm...> - 2024-03-13 01:18:11
|
FWIW, this is the underlying market convention for the FF contracts. It's the same exact math as 1m SOFR futures. https://www.cmegroup.com/education/files/sofr-futures-settlement-calculation-methodologies.pdf On Tue, Mar 12, 2024 at 8:12 PM jian Xu <jia...@gm...> wrote: > Hi, > > I'm trying to understand how the zero rate from FedFund rates are > calculated. For example, if I have May FedFunds futures quoting at 5% on > May 1, 2, 3, and now I'm standing on May 4, so if I calculate the one day > forward rate R (continuous compounding, actual/360), then I think it should > be > > exp(- R * yearFrac) = (1+ 5%/360) ^ (-360*yearFrac) > > where yearFrac = 1/360. > > This gives R = 0.0499652 > > However, if I use the following QuantLib code, I got 0.0499267. Can > anyone tell me where the small difference is from? Thank you very much. > > ---------------------------------------- > import QuantLib as ql > today = ql.Date(4, 5, 2023) > ql.Settings.instance().evaluationDate = today > ff_index = ql.FedFunds() > hist_quote = 95. > hist_rate = (100 - hist_quote)/100. > > ff_index.addFixing(ql.Date(1, 5, 2023), hist_rate) > ff_index.addFixing(ql.Date(2, 5, 2023), hist_rate) > ff_index.addFixing(ql.Date(3, 5, 2023), hist_rate) > > calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond) > ff_day_counter = ql.Actual360() > > quoted_rates = [ > (ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(31, 5, 2023)), > (ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(30, 6, 2023)), > ] > convexityAdjustment = ql.QuoteHandle() > ff_helpers = [] > for rate, maturity in quoted_rates: > ff_helpers.append(ql.OvernightIndexFutureRateHelper(rate, > today, > maturity, > ff_index, > > convexityAdjustment, > > ql.RateAveraging.Simple)) > > ff_yield_curve_simple = ql.PiecewiseFlatForward(today, ff_helpers, > ff_day_counter) > zr = ff_yield_curve_simple.zeroRate(ql.Date(5, 5, 2023), ql.Actual360(), > ql.Continuous, ql.Daily) > print(zr.rate()) # 0.04999267 > > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: jian Xu <jia...@gm...> - 2024-03-13 01:09:05
|
Hi,
I'm trying to understand how the zero rate from FedFund rates are
calculated. For example, if I have May FedFunds futures quoting at 5% on
May 1, 2, 3, and now I'm standing on May 4, so if I calculate the one day
forward rate R (continuous compounding, actual/360), then I think it should
be
exp(- R * yearFrac) = (1+ 5%/360) ^ (-360*yearFrac)
where yearFrac = 1/360.
This gives R = 0.0499652
However, if I use the following QuantLib code, I got 0.0499267. Can anyone
tell me where the small difference is from? Thank you very much.
----------------------------------------
import QuantLib as ql
today = ql.Date(4, 5, 2023)
ql.Settings.instance().evaluationDate = today
ff_index = ql.FedFunds()
hist_quote = 95.
hist_rate = (100 - hist_quote)/100.
ff_index.addFixing(ql.Date(1, 5, 2023), hist_rate)
ff_index.addFixing(ql.Date(2, 5, 2023), hist_rate)
ff_index.addFixing(ql.Date(3, 5, 2023), hist_rate)
calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond)
ff_day_counter = ql.Actual360()
quoted_rates = [
(ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(31, 5, 2023)),
(ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(30, 6, 2023)),
]
convexityAdjustment = ql.QuoteHandle()
ff_helpers = []
for rate, maturity in quoted_rates:
ff_helpers.append(ql.OvernightIndexFutureRateHelper(rate,
today,
maturity,
ff_index,
convexityAdjustment,
ql.RateAveraging.Simple))
ff_yield_curve_simple = ql.PiecewiseFlatForward(today, ff_helpers,
ff_day_counter)
zr = ff_yield_curve_simple.zeroRate(ql.Date(5, 5, 2023), ql.Actual360(),
ql.Continuous, ql.Daily)
print(zr.rate()) # 0.04999267
|
|
From: Luigi B. <lui...@gm...> - 2024-03-12 08:30:27
|
Hello Steve,
this case is still not handled. I'll try to put something together
(contributions are also welcome). In the meantime, one workaround would be
to calculate the fixing and build the cash flows with the short coupon
modeled as a fixed-rate one. It's definitely not optimal, because it won't
react if the forecast curve changes.
Regards,
Luigi
On Tue, Mar 5, 2024 at 9:29 AM Steve Hsieh <war...@gm...> wrote:
> Hi all,
> I would like to know does QuanLib handle the stub fixing internally?
>
> For example, if I have a front short stub, that say 45 days, market
> convention will use linear interpolated fixing rate from 1-month and
> 2-month fixing.
>
> Does QuantLib handle this internally?
> If yes, which part of the code handle this?
> If not , how do I let model takes customized fixing?
> Many Thanks.
>
> Best Regards,
> Steve
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Josh C. <jc...@fa...> - 2024-03-09 00:33:00
|
Dear QL community, Need to price callable zero coupon bond (ZCB) by QuantLib-Python. >From tech document on-line as below. I use ql.CallableZeroCouponBond https://rkapl123.github.io/QLAnnotatedSource/d4/ddb/class_quant_lib_1_1_callable_zero_coupon_bond.html I know the basic application and example about pricing bond object by QL. Below code I'm doing this ZCB testing example. The find out from result is that ql.CallableZeroCouponBond + ql.TreeCallableFixedRateBondEngine This pricing module seems get wrong price. Anyone know how to pricing ZCB by correct BondEngine ? thanks. #************************************************************************************************************************************* *import QuantLib as ql*** ** *calc_date = ql.Date(31,12,2023)*** *ql.Settings.instance().evaluationDate = calc_date*** *day_count = ql.ActualActual(ql.ActualActual.Bond)*** *rate = 0.035*** *ts = ql.FlatForward(calc_date,*** * rate,*** * day_count,*** * ql.Compounded,*** * ql.Semiannual)*** *ts_handle = ql.YieldTermStructureHandle(ts)*** ** *CallSch = ql.CallabilitySchedule()*** *CallSch.append(ql.Callability(ql.BondPrice(104,ql.BondPrice.Clean), ql.Callability.Call, ql.Date(15,1,2016)))*** *CallSch.append(ql.Callability(ql.BondPrice(136.8569,ql.BondPrice.Clean), ql.Callability.Call, ql.Date(15,1,2023)))*** *CallSch.append(ql.Callability(ql.BondPrice(180.0943,ql.BondPrice.Clean), ql.Callability.Call, ql.Date(15,1,2030)))*** *CallSch.append(ql.Callability(ql.BondPrice(236.9919,ql.BondPrice.Clean), ql.Callability.Call, ql.Date(15,1,2037)))*** *CallSch.append(ql.Callability(ql.BondPrice(311.8651,ql.BondPrice.Clean), ql.Callability.Call, ql.Date(15,1,2044)))*** *CallSch.append(ql.Callability(ql.BondPrice(324.3398,ql.BondPrice.Clean), ql.Callability.Call, ql.Date(15,1,2045)))*** ** *ZCBobj= ql.CallableZeroCouponBond(2,3000000,ql.TARGET(),ql.Date(15,1,2045),* * ql.Thirty360(ql.Thirty360.ISDA),ql.Following,324.3398,ql.Date(15,1,2015),CallSch)*** ** *a = 0.03*** *s = 0.12*** *grid_points = 40*** *model = ql.HullWhite(ts_handle, a, s)*** *engine = ql.TreeCallableFixedRateBondEngine(model, grid_points)*** *ZCBobj.setPricingEngine(engine)*** *ZCBobj.cleanPrice()*** *Out[25]: 11.938197755007225*** *ZCBobj.NPV()*** *Out[26]: 358044.0890306983* Best, Josh ----------------- "Talk is cheap. Show me the code." By Linus Torvalds. |
|
From: Luigi B. <lui...@gm...> - 2024-03-05 10:28:58
|
Hi, some of the FixedRateBond constructors were deprecated in version 1.28 and then removed in version 1.33. You should now create a Schedule object and pass that to the bond constructor. You can see an example at < https://github.com/lballabio/QuantLib-SWIG/blob/v1.33/Python/examples/bonds.py#L204 >. Luigi On Mon, Mar 4, 2024 at 6:09 PM Amir Lakha <ami...@gm...> wrote: > Hi, > > I have some code where I was creating a FixedRateBond which was working > correctly in v1.32, however, I am getting the following error if I try > and run in v1.33: > > 25245 def __init__(self, *args, **kwargs): > 25246 r"""__init__(FixedRateBond self, Integer settlementDays, > Real faceAmount, Schedule schedule, DoubleVector coupons, DayCounter > paymentDayCounter, BusinessDayConvention > paymentConvention=QuantLib::Following, Real redemption=100.0, Date > issueDate=Date(), Calendar paymentCalendar=Calendar(), Period > exCouponPeriod=Period(), Calendar exCouponCalendar=Calendar(), > BusinessDayConvention exCouponConvention=Unadjusted, bool > exCouponEndOfMonth=False) -> FixedRateBond""" > > 25247 _QuantLib.FixedRateBond_swiginit(self, > _QuantLib.new_FixedRateBond(*args, **kwargs)) > > TypeError: in method 'new_FixedRateBond', argument 2 of type 'Real' > > The code I am using to initialise the FixedRateBond is : > > self.bond = ql.FixedRateBond(0, calendar, self.nominal, issueDate, > maturity, ql.Period(frequency), self.coupons, dayCount) > > The arguments being passed to the constructor are : > > > - SettleDays: 0 > - Calendar: TARGET calendar > - Face: 1000000 > - Start: November 14th, 2022 > - End: November 14th, 2032 > - Period: 1Y, Coupons: [0.08407], > - DayCount: 30/360 (Bond Basis) day counter > > > Any idea what I am doing wrong? > > kind regards, > > Amir > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Luigi B. <lui...@gm...> - 2024-03-05 10:18:58
|
Hello,
you can read the thread at <
https://sourceforge.net/p/quantlib/mailman/quantlib-users/thread/CAKXkX9zpm1%2BKbrVthmNYe_qaEKjrmKo7WSixvvjVan0APnZfDw%40mail.gmail.com/#msg36015671>.
It refers to older engines, but the discussion also applies to
FdBlackScholesVanillaEngine. It's a limitation of the engine,
unfortunately. As a workaround, the suggestion was to create a new term
structure with the same day counter as the interest-rate curve and with
values of the volatility adjusted to account for the difference in day
count. More details are in the thread, and a simple example is described
in <https://www.youtube.com/watch?v=BdM2Vs6R55g>.
Hope this helps,
Luigi
On Fri, Mar 1, 2024 at 5:33 PM Kiki zzz <kik...@gm...> wrote:
> hi,
>
> I'm trying to use different day counters (e.g. Actual36525 and
> Business252) for interest rate and option volatility
> in FdBlackScholesVanillaEngine to price American or European option. Looks
> like the day counter in volatility does not affect option price. I
> think AnalyticEuropeanEngine on the other hand uses both day counters from
> interest rate and option volatility.
>
> My questions are
> - Is this the behavior by design (i.e. FdBlackScholesVanillaEngine only
> uses one day counter)?
> - If that's the case, what is the best way to workaround this? i.e. use
> different day counters for rates and vol in FdBlackScholesVanillaEngine.
>
> Thanks for the help in advance!
> Kiki
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Steve H. <war...@gm...> - 2024-03-05 08:26:13
|
Hi all, I would like to know does QuanLib handle the stub fixing internally? For example, if I have a front short stub, that say 45 days, market convention will use linear interpolated fixing rate from 1-month and 2-month fixing. Does QuantLib handle this internally? If yes, which part of the code handle this? If not , how do I let model takes customized fixing? Many Thanks. Best Regards, Steve |
|
From: Amir L. <ami...@gm...> - 2024-03-04 17:06:29
|
Hi, I have some code where I was creating a FixedRateBond which was working correctly in v1.32, however, I am getting the following error if I try and run in v1.33: 25245 def __init__(self, *args, **kwargs): 25246 r"""__init__(FixedRateBond self, Integer settlementDays, Real faceAmount, Schedule schedule, DoubleVector coupons, DayCounter paymentDayCounter, BusinessDayConvention paymentConvention=QuantLib::Following, Real redemption=100.0, Date issueDate=Date(), Calendar paymentCalendar=Calendar(), Period exCouponPeriod=Period(), Calendar exCouponCalendar=Calendar(), BusinessDayConvention exCouponConvention=Unadjusted, bool exCouponEndOfMonth=False) -> FixedRateBond""" > 25247 _QuantLib.FixedRateBond_swiginit(self, _QuantLib.new_FixedRateBond(*args, **kwargs)) TypeError: in method 'new_FixedRateBond', argument 2 of type 'Real' The code I am using to initialise the FixedRateBond is : self.bond = ql.FixedRateBond(0, calendar, self.nominal, issueDate, maturity, ql.Period(frequency), self.coupons, dayCount) The arguments being passed to the constructor are : - SettleDays: 0 - Calendar: TARGET calendar - Face: 1000000 - Start: November 14th, 2022 - End: November 14th, 2032 - Period: 1Y, Coupons: [0.08407], - DayCount: 30/360 (Bond Basis) day counter Any idea what I am doing wrong? kind regards, Amir |
|
From: Luigi B. <lui...@gm...> - 2024-03-04 11:22:15
|
Thanks! On Tue, Feb 27, 2024 at 7:10 PM Denys Usynin <de...@aq...> wrote: > This might come useful to those who are thinking of using QuantLib in > Python. As part of my recent consulting project I created a wrapper around > QuantLib which allows working at a higher level than what the > swig-generated Python library provides. > > Anyways, I open sourced the package since I think it may be useful to > others: > > https://github.com/Aqumen-Tech/aqumenlib > > Hopefully the README there answers most questions. > > Currently it only handles basic rates and fixed income and a bit of FX, > since that was all I needed, but the structure should make it easy to add > new pricers; the hard bits were modeling and risk calcs and that wiring is > all in place. > > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Aleksis A. R. <ale...@go...> - 2024-03-02 18:30:44
|
Thanks for reply Marcin.
Agreed, but unfortunately the only way I can get the xccy swaps to price to par is by having a curve settlement set to 2 and PVing the cashflows to the sett’t date. I’ve spent some on this but can’t find a work around. Below is a toy example illustrating this problem (a copy/paste will run it). The only way I get a zero npv for the xccy swap is by having a curve sett of T+2 in all curves (euribor3M_curve, usdlibor3M_curve and eur_usd_curve).
import QuantLib as ql
today = ql.Date(27, ql.October, 2021)
ql.Settings.instance().evaluationDate = today
calendar = ql.UnitedStates(ql.UnitedStates.FederalReserve)
euribor3M_curve = ql.YieldTermStructureHandle(ql.FlatForward(0,calendar,0.06,ql.Actual360()))
euribor3M = ql.IborIndex('c', ql.Period('3m'), 2, ql.Currency(), ql.TARGET(),
ql.ModifiedFollowing, False, ql.Actual365Fixed(),euribor3M_curve)
usdlibor3M_curve = ql.YieldTermStructureHandle(ql.FlatForward(0,calendar,0.02,ql.Actual365Fixed()))
usdlibor3M = ql.IborIndex('c', ql.Period('3m'), 2, ql.Currency(), calendar,
ql.ModifiedFollowing, False, ql.Actual360(),usdlibor3M_curve)
notional = 1_000_000
fx_0 = 0.85
start_date = calendar.advance(today, ql.Period(2, ql.Days))
end_date = calendar.advance(start_date, ql.Period(3, ql.Months))
tenor = ql.Period(3, ql.Months)
rule = ql.DateGeneration.Forward
convention = ql.Following
end_of_month = False
schedule = ql.Schedule(start_date,end_date,tenor,calendar,convention,convention,rule,end_of_month)
usd_leg = ((ql.SimpleCashFlow(-notional, schedule[0]),)+ ql.IborLeg(nominals=[notional],schedule=schedule,index=usdlibor3M,)
+ (ql.SimpleCashFlow(notional, schedule[-1]),))
usd_npv = ql.CashFlows.npv(usd_leg, usdlibor3M_curve, True,start_date)
print(usd_npv)
quote = -0.03
ccbs_quotes = {'3M': quote}
day_counter = euribor3M_curve.dayCounter()
ccbs_helpers = [ql.ConstNotionalCrossCurrencyBasisSwapRateHelper(
ql.QuoteHandle(ql.SimpleQuote(value)),
ql.Period(period),
2,
calendar,
convention,
end_of_month,
usdlibor3M,
euribor3M,
usdlibor3M_curve,
True,
False)
for period, value in ccbs_quotes.items()]
eur_usd_curve = ql.YieldTermStructureHandle(ql.PiecewiseLogLinearDiscount(0, calendar, ccbs_helpers, day_counter))
eur_leg = ((ql.SimpleCashFlow(-notional * fx_0, schedule[0]),)+ ql.IborLeg(nominals=[notional * fx_0],schedule=schedule,index=euribor3M,spreads=[quote])
+ (ql.SimpleCashFlow(notional * fx_0, schedule[-1]),))
eur_npv = ql.CashFlows.npv(eur_leg,eur_usd_curve, True,start_date)
print(eur_npv)
eur_leg_euribor = ((ql.SimpleCashFlow(-notional * fx_0, schedule[0]),)+ ql.IborLeg(nominals=[notional * fx_0],schedule=schedule,index=euribor3M,spreads=[0])
+ (ql.SimpleCashFlow(notional * fx_0, schedule[-1]),))
eur_npv_euribor = ql.CashFlows.npv(eur_leg_euribor,euribor3M_curve, True,start_date)
print(eur_npv_euribor)
print(ccbs_helpers[0].impliedQuote())
> On Mar 2, 2024, at 9:33 AM, Marcin Rybacki <mry...@gm...> wrote:
>
> Hi Aleksis,
>
> The curve origin (curve settlement date) does not necessarily need to correspond to the settlement convention of the instruments used to construct the curve.
> So, you can safely set it to T+0 and both FX swaps and cross currency swaps, that you use to build the term structure, should price back to par.
>
> I hope this answers your question.
>
> Kind regards,
> Marcin
>
> On Wed, 28 Feb 2024 at 14:05, Aleksis Ali Raza via QuantLib-users <qua...@li... <mailto:qua...@li...>> wrote:
>> Perhaps this is a naive question but when bootstrapping a cross currency curve using FXSwapHelper for short end and ConstNotionalCrossCurrencyBasisSwapHelper for the long end, I’m running into an issue where I need to specify the curve settlement date (curve_sett in the code below ) as T+2. This is to reflect correct valuation of the cross currency swaps when priced off the curve. However, for FXSwapHelpers curve_sett should be T+0 - this is so that ON and TN FX swaps can be used in the helpers and repriced correctly. The code used is below.
>>
>> How does one get around this issue (without having to work with two separate curves, or without leaving out ON and TN from the FXSwapHelpers)?
>>
>> Thanks, Aleksis
>>
>> # FX swaps
>> fxSwapHelpers = [ql.FxSwapRateHelper(ql.QuoteHandle(q),
>> ql.QuoteHandle(FX),
>> m,
>> int(d),
>> calendar,
>> business_convention_base,
>> end_of_month,
>> True,
>> collateral_curve)
>> for d, q, m in zip(dffxswapsFXspotlag, fxswap_quotes, dffxswapsmaturity)]
>>
>> # xccy basis curve
>> swap_helpers_xccybasis = [ql.ConstNotionalCrossCurrencyBasisSwapRateHelper(ql.QuoteHandle(q),
>> m,
>> int(d),
>> calendar,
>> business_convention_quote,
>> end_of_month,
>> index_base,
>> index_quote,
>> collateral_curve,
>> True,
>> False)
>> for q, m, d in zip(xccybasisquotes, xccybasismaturies, dfxccybasisFXspotlag)]
>>
>> rate_helpers_xccybasis = fxSwapHelpers + swap_helpers_xccybasis
>> curve_basis = curve_interpolation(curve_sett, calendar, rate_helpers_xccybasis, curve_daycount)
>> curve_basis.enableExtrapolation()
>> final_curve_basis = ql.RelinkableYieldTermStructureHandle(curve_basis)
>>
>> _______________________________________________
>> QuantLib-users mailing list
>> Qua...@li... <mailto:Qua...@li...>
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
|
|
From: Marcin R. <mry...@gm...> - 2024-03-02 09:33:39
|
Hi Aleksis, The curve origin (curve settlement date) does not necessarily need to correspond to the settlement convention of the instruments used to construct the curve. So, you can safely set it to T+0 and both FX swaps and cross currency swaps, that you use to build the term structure, should price back to par. I hope this answers your question. Kind regards, Marcin On Wed, 28 Feb 2024 at 14:05, Aleksis Ali Raza via QuantLib-users < qua...@li...> wrote: > Perhaps this is a naive question but when bootstrapping a cross currency > curve using FXSwapHelper for short end and > ConstNotionalCrossCurrencyBasisSwapHelper for the long end, I’m running > into an issue where I need to specify the *curve settlement date* > (curve_sett in the code below ) as T+2*. *This is to reflect correct > valuation of the cross currency swaps when priced off the curve. However, > for FXSwapHelpers curve_sett should be T+0 - this is so that ON and TN FX > swaps can be used in the helpers and repriced correctly. The code used is > below. > > How does one get around this issue (without having to work with two > separate curves, or without leaving out ON and TN from the FXSwapHelpers)? > > Thanks, Aleksis > > # FX swaps > fxSwapHelpers = [ql.FxSwapRateHelper(ql.QuoteHandle(q), > ql.QuoteHandle(FX), > m, > int(d), > calendar, > business_convention_base, > end_of_month, > True, > collateral_curve) > for d, q, m in zip(dffxswapsFXspotlag, fxswap_quotes, dffxswapsmaturity)] > > # xccy basis curve > swap_helpers_xccybasis = [ql.ConstNotionalCrossCurrencyBasisSwapRateHelper(ql.QuoteHandle(q), > m, > int(d), > calendar, > business_convention_quote, > end_of_month, > index_base, > index_quote, > collateral_curve, > True, > False) > for q, m, d in zip(xccybasisquotes, xccybasismaturies, dfxccybasisFXspotlag)] > > rate_helpers_xccybasis = fxSwapHelpers + swap_helpers_xccybasis > curve_basis = curve_interpolation(curve_sett, calendar, rate_helpers_xccybasis, curve_daycount) > curve_basis.enableExtrapolation() > final_curve_basis = ql.RelinkableYieldTermStructureHandle(curve_basis) > > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
|
From: Luigi B. <lui...@gm...> - 2024-03-02 09:13:25
|
Hello, no, I haven't had time to look at this. However, I suggest you try the official instructions on the QuantLib web site at < https://www.quantlib.org/install.shtml> which are still valid and see if you have the same problem. If needed, it would be a lot more useful to update those, rather than trying to figure out what's wrong in the instructions on some page on the internet that we can't update. Regards, Luigi On Sat, Mar 2, 2024 at 6:18 AM Dr Ocean <do...@li...> wrote: > Hi, > > Any luck? > > Regards. > > Sent from Outlook for iOS <https://aka.ms/o0ukef> > ------------------------------ > *From:* Dr Ocean <Do...@li...> > *Sent:* Wednesday, February 28, 2024 10:10:44 AM > *To:* Luigi Ballabio <lui...@gm...> > *Cc:* qua...@li... < > qua...@li...> > *Subject:* Re: [Quantlib-users] Where can i get help for Quantlib > configuration > > Hi, > > I followed the steps in the link below, since this is the most up to date. > > https://benjaminwhiteside.com/2023/09/26/building-quantlib-in-vs2022-64-bit/ > > <https://benjaminwhiteside.com/2023/09/26/building-quantlib-in-vs2022-64-bit/> > Building QuantLib in VS2022 64-bit > <https://benjaminwhiteside.com/2023/09/26/building-quantlib-in-vs2022-64-bit/> > Build Boost and QuantLib in Windows 11 64-bit using Visual Studio 2022. > benjaminwhiteside.com > > I am getting the following errors after i build the solution, testsuite > compiles fine. > > Severity Code Description Project File Line Suppression State Details > Error C1083 Cannot open include file: 'boost/config.hpp': No such file or > directory LatentModel C:\Program > Files\QuantLib-1.33\QuantLib-1.33\ql\qldefines.hpp 38 > > Severity Code Description Project File Line Suppression State Details > Error LNK1104 cannot open file 'kernel32.lib' BasketLosses C:\Program > Files\QuantLib-1.33\QuantLib-1.33\Examples\BasketLosses\LINK 1 > > I am using the following boost version and MSVC. > boost_1_84_0-msvc-14.3-64 > > ------------------------------ > *From:* Luigi Ballabio <lui...@gm...> > *Sent:* Tuesday, 27 February 2024 8:24 PM > *To:* Dr Ocean <do...@li...> > *Cc:* qua...@li... < > qua...@li...> > *Subject:* Re: [Quantlib-users] Where can i get help for Quantlib > configuration > > Hello, > what operating system are you using? In what way exactly the > instructions don't work? Also, are you referring to the instructions at < > https://www.quantlib.org/install.shtml> or some other ones? > > Thanks, > Luigi > > > On Tue, Feb 27, 2024 at 12:03 PM Dr Ocean <do...@li...> wrote: > > Hi, > > Can anyone tell me which distribution should i use to get support for > quantlib configuration? the posted instructions don't work. > > Regards. > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > > |
|
From: Dr O. <do...@li...> - 2024-03-02 05:18:54
|
Hi, Any luck? Regards. Sent from Outlook for iOS<https://aka.ms/o0ukef> ________________________________ From: Dr Ocean <Do...@li...> Sent: Wednesday, February 28, 2024 10:10:44 AM To: Luigi Ballabio <lui...@gm...> Cc: qua...@li... <qua...@li...> Subject: Re: [Quantlib-users] Where can i get help for Quantlib configuration Hi, I followed the steps in the link below, since this is the most up to date. https://benjaminwhiteside.com/2023/09/26/building-quantlib-in-vs2022-64-bit/ [https://benjaminwhiteside.files.wordpress.com/2023/09/build_quantlib_in_vs2022_64bit.png?w=1200]<https://benjaminwhiteside.com/2023/09/26/building-quantlib-in-vs2022-64-bit/> Building QuantLib in VS2022 64-bit<https://benjaminwhiteside.com/2023/09/26/building-quantlib-in-vs2022-64-bit/> Build Boost and QuantLib in Windows 11 64-bit using Visual Studio 2022. benjaminwhiteside.com I am getting the following errors after i build the solution, testsuite compiles fine. Severity Code Description Project File Line Suppression State Details Error C1083 Cannot open include file: 'boost/config.hpp': No such file or directory LatentModel C:\Program Files\QuantLib-1.33\QuantLib-1.33\ql\qldefines.hpp 38 Severity Code Description Project File Line Suppression State Details Error LNK1104 cannot open file 'kernel32.lib' BasketLosses C:\Program Files\QuantLib-1.33\QuantLib-1.33\Examples\BasketLosses\LINK 1 I am using the following boost version and MSVC. boost_1_84_0-msvc-14.3-64 [cid:7e092454-603a-481d-a427-2fd0aaa0ea76] ________________________________ From: Luigi Ballabio <lui...@gm...> Sent: Tuesday, 27 February 2024 8:24 PM To: Dr Ocean <do...@li...> Cc: qua...@li... <qua...@li...> Subject: Re: [Quantlib-users] Where can i get help for Quantlib configuration Hello, what operating system are you using? In what way exactly the instructions don't work? Also, are you referring to the instructions at <https://www.quantlib.org/install.shtml> or some other ones? Thanks, Luigi On Tue, Feb 27, 2024 at 12:03 PM Dr Ocean <do...@li...<mailto:do...@li...>> wrote: Hi, Can anyone tell me which distribution should i use to get support for quantlib configuration? the posted instructions don't work. Regards. _______________________________________________ QuantLib-users mailing list Qua...@li...<mailto:Qua...@li...> https://lists.sourceforge.net/lists/listinfo/quantlib-users |
|
From: Kiki z. <kik...@gm...> - 2024-03-01 16:29:20
|
hi, I'm trying to use different day counters (e.g. Actual36525 and Business252) for interest rate and option volatility in FdBlackScholesVanillaEngine to price American or European option. Looks like the day counter in volatility does not affect option price. I think AnalyticEuropeanEngine on the other hand uses both day counters from interest rate and option volatility. My questions are - Is this the behavior by design (i.e. FdBlackScholesVanillaEngine only uses one day counter)? - If that's the case, what is the best way to workaround this? i.e. use different day counters for rates and vol in FdBlackScholesVanillaEngine. Thanks for the help in advance! Kiki |
|
From: Aleksis A. R. <ale...@go...> - 2024-02-28 13:03:30
|
Perhaps this is a naive question but when bootstrapping a cross currency curve using FXSwapHelper for short end and ConstNotionalCrossCurrencyBasisSwapHelper for the long end, I’m running into an issue where I need to specify the curve settlement date (curve_sett in the code below ) as T+2. This is to reflect correct valuation of the cross currency swaps when priced off the curve. However, for FXSwapHelpers curve_sett should be T+0 - this is so that ON and TN FX swaps can be used in the helpers and repriced correctly. The code used is below.
How does one get around this issue (without having to work with two separate curves, or without leaving out ON and TN from the FXSwapHelpers)?
Thanks, Aleksis
# FX swaps
fxSwapHelpers = [ql.FxSwapRateHelper(ql.QuoteHandle(q),
ql.QuoteHandle(FX),
m,
int(d),
calendar,
business_convention_base,
end_of_month,
True,
collateral_curve)
for d, q, m in zip(dffxswapsFXspotlag, fxswap_quotes, dffxswapsmaturity)]
# xccy basis curve
swap_helpers_xccybasis = [ql.ConstNotionalCrossCurrencyBasisSwapRateHelper(ql.QuoteHandle(q),
m,
int(d),
calendar,
business_convention_quote,
end_of_month,
index_base,
index_quote,
collateral_curve,
True,
False)
for q, m, d in zip(xccybasisquotes, xccybasismaturies, dfxccybasisFXspotlag)]
rate_helpers_xccybasis = fxSwapHelpers + swap_helpers_xccybasis
curve_basis = curve_interpolation(curve_sett, calendar, rate_helpers_xccybasis, curve_daycount)
curve_basis.enableExtrapolation()
final_curve_basis = ql.RelinkableYieldTermStructureHandle(curve_basis)
|