Skip to content

yieldcurvemonkey/Curvy-CUSIPs

Repository files navigation

Curvy-CUSIPs

Using Open Sourced Data for Rates Trading examples in Python:

To get started

Clone repo:

git clone https://github.com/yieldcurvemonkey/Curvy-CUSIPs.git

pip install dependencies:

pip install -r requirements.txt

cd into scripts dir:

cd .\Curvy-CUSIPs\scripts

Init Cash Treasuries DBs:

python update_ust_cusips_db.py init
  • This will take 30-60 minutes

  • This will create 6 databases

    • ust_cusip_set
    • ust_cusip_timeseries
    • ust_eod_ct_yields
    • ust_bid_ct_yields
    • ust_mid_ct_yields
    • ust_offer_ct_yields
  • Data is source from FedInvest

  • Data availability: daily bid, offer, mid prices and ytms at cusip level (and cusip characteristics) starting from late 2008

  • Script, by default, fetches data starting from 2018

  • See below for examples

Update Cash Treasuries DBs:

python update_ust_cusips_db.py

Init SOFR OIS Curve DB:

python update_sofr_ois_db.py init
  • This will take 30-60 minutes
  • This will create one database: nyclose_sofr_ois
  • Curve marking from < 2024-01-12 is from the BBG 490 Curve, newer EOD markings are sourced from the Eris FTP
  • See below for examples

Update SOFR OIS Curve DB:

python update_sofr_ois_db.py

Init and update ATM Swaption Vol DB:

python update_atm_swaption_vol.py

Init Swaption Vol Cube DB

python update_swaption_vol_cube.py init

Update Swaption Vol Cube DB

python update_swaption_vol_cube.py

Checkout examples in \notebooks

  • Yield Curve Plotting
  • CT Yields Dataframe
  • CUSIP look up
  • CUSIP plotting
  • Spread, Flies plotting
  • SOFR OIS Curve Ploting
  • SOFR OIS Swap Spreads
  • Spread, Flies plotting
  • Swap Fwds
  • similar to NSV and VCUB screens
  • Historical ATM Grids
  • Historical Vol Cubes
  • Plotting 3 surfaces
    • expiry-tail
    • expiry-strike
    • tail-strike
  • Vol Timeseries
  • Recreating the SWPM screen

womp womp

  • Recreating the SWPM screen

womp womp

  • Plot your splines/par curve model against all active CUSIPs on a historical date
  • Example shown is a textbook par model: filter based on some liquidity premium then fit a cubic spline

womp womp

  • Thats a pretty good fit given that we are using publicly sourced data!
  • The par model in the example is loosely based (same knot points) on JPM's par curve model, so we should expect that our residuals are similar

womp womp womp womp

  • DV01 Neutrality, Beta and PCA risk weightings
  • Comparing with JPM's Rates Stratgey 10s/30s swap curve steepeners paired with a 16% weighted shorts in 2s and Buy the belly of a 6M forward 5s/10s/30s swap yield curve butterfly (-0.5:1.0:-0.5 weighted)
  • PV01 Neutrality, Beta and PCA risk weightings
  • Using PCA and different regressions to find RV in swap spaces

womp womp

til

More examples/notebooks coming soon

Todos

  • HedgeHog:

    • key-rate duration
    • partial pv01s
    • swaption hedger
      • vanillas
      • conditionals
    • beta_estimates:
      • robust-rolling pca implementation
  • Spectral

    • init dir
    • PCA class enhancements
  • Tempora

    • init dir

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •