-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QST: Building SOFR discounting curve combining IRS and SOFR futures #662
Comments
Theres a couple of things going on here.
It would be better to convert the futures price to a rate (100-price). This will give you more consistency when examining sensitivities, using However, against this advice you can still use price if you want to, but you have to specifically inform the # BEFORE
STIRFuture(effective=get_imm(code="H25"), termination= get_imm(code="M25"), spec="usd_stir", curves="sofr")
# AFTER
(STIRFuture(effective=get_imm(code="H25"), termination= get_imm(code="M25"), spec="usd_stir", curves="sofr"), (), {"metric": "price"})
Have a read of this thread and its other hyperlinked thread: Quant Stack Essentially you have 6 discount factors on your curve, the first will always be 1.0 so that leaves 5 degrees of freedom and you have only 4 controlling instruments. The safest approach, if all of your instruments have unique maturities, is to use those maturities as curve nodes (this is what traditional bootstrappers have to do), and nothing else. This will be a good starting point before you do more work to add-in or remove features to enhance the curve.
You have not defined the # REFORMED CODE
nodes={
dt(2025, 1, 28): 1.0,
dt(2025, 2, 28): 1.0, # 1M node
dt(2025, 4, 30): 1.0, # 3M node
dt(2025, 6, 30): 1.0, # 6M node
get_imm(code="M25"): 1.0, # 2025 June IMM
}
sofr = Curve(
nodes=dict(sorted(nodes.items())),
id="sofr",
)
instruments = [
IRS(dt(2025, 1, 28), "1M", "A", spec="usd_irs", curves="sofr"),
IRS(dt(2025, 1, 28), "3M", "A", spec="usd_irs", curves="sofr"),
IRS(dt(2025, 1, 28), "6M", "A", spec="usd_irs", curves="sofr"),
STIRFuture(effective=get_imm(code="H25"), termination= get_imm(code="M25"), spec="usd_stir", curves="sofr"),
]
rates = [4.31, 4.29, 4.23, 4.215]
solver = Solver(
curves=[sofr],
instruments=instruments,
s=rates,
)
sofr.plot("1d", labels=["example sofr o/n curve"]) This will solve exactly. |
@attack68 Thank you so much. Problem solved. |
Hello @attack68 I'm also trying to use 1month SOFR futures for front-end curve building. However, STIRFuture(effective=dt(2025, 7, 1), termination=dt(2025, 8, 1), spec="usd_stir1", curves="sofr") doesn't work while, STIRFuture(effective=dt(2025, 7, 1), termination=get_imm(code="Z25"), spec="usd_stir1", curves="sofr") works. Can you please have quick help on this? Thank you. |
this was a bug in 1.6.0. The spec had an imm roll. you should set roll as "som". see #629. Overload it with: STIRFuture(effective=dt(2025, 7, 1), termination=dt(2025, 8, 1), spec="usd_stir1", roll="som", curves="sofr") |
Hi @attack68 ,
I'm trying to build SOFR discounting curve combining SOFR IRS and SOFR futures.
Ultimate goal is making step function that pricing FED actions.
My initial code is as below but seems not working properly.
Can you please share your idea on this. Thank you.
The text was updated successfully, but these errors were encountered: