diff --git a/__pycache__/generate.cpython-312.pyc b/__pycache__/generate.cpython-312.pyc index ed8ec12..844d468 100644 Binary files a/__pycache__/generate.cpython-312.pyc and b/__pycache__/generate.cpython-312.pyc differ diff --git a/generate.py b/generate.py index c997c2e..fe11e31 100644 --- a/generate.py +++ b/generate.py @@ -719,6 +719,29 @@ def main(): print(f" {info['label']}: {v}%{chg_str}") time.sleep(0.3) # Rate limit print(f" Fetched {len(output['gov_bonds'])} bonds") + + # Backfill yields from EODHD bonds for the curve/spreads views + bond_to_yield = { + "us2y": ("US", "y2"), "us10y": ("US", "y10"), "us30y": ("US", "y30"), + "uk2y": ("UK", "y2"), "uk10y": ("UK", "y10"), "uk30y": ("UK", "y30"), + "de2y": ("Eurozone", "y2"), "de10y": ("Eurozone", "y10"), "de30y": ("Eurozone", "y30"), + "jp2y": ("Japan", "y2"), "jp10y": ("Japan", "y10"), "jp30y": ("Japan", "y30"), + "it2y": ("Italy", "y2"), "it10y": ("Italy", "y10"), + "fr10y": ("France", "y10"), "es10y": ("Spain", "y10"), + "ca2y": ("Canada", "y2"), "ca10y": ("Canada", "y10"), + "au2y": ("Australia", "y2"), "au10y": ("Australia", "y10"), + "nz2y": ("New Zealand", "y2"), "nz10y": ("New Zealand", "y10"), + "ch10y": ("Switzerland", "y10"), "se10y": ("Sweden", "y10"), "no10y": ("Norway", "y10"), + } + for bond_key, (country, tenor) in bond_to_yield.items(): + bond = output["gov_bonds"].get(bond_key) + if bond and bond.get("value") is not None: + if country not in output["yields"]: + output["yields"][country] = {} + # Only fill if not already set from FRED/yfinance + if output["yields"][country].get(tenor) is None: + output["yields"][country][tenor] = bond["value"] + print(" Backfilled yields from EODHD bonds") else: print(" EODHD API key not set — skipping government bonds") diff --git a/index.html b/index.html index a46f4b4..9b3c06b 100644 --- a/index.html +++ b/index.html @@ -44,11 +44,11 @@ const Dot=({on})=>{tabs.map(t=>)}} function Tbl({cols,rows,sm}){return
{cols.map(c=>)}{rows.map((r,i)=>{cols.map(c=>{const v=c.rn?c.rn(r):r[c.k];return })})}
{c.l}
{v!=null?v:"—"}
} function TV({sym,h=280}){const [shouldLoad,setShouldLoad]=React.useState(false);React.useEffect(()=>{setShouldLoad(false)},[sym]);if(!sym)return
No chart
;if(!shouldLoad)return
Chart ready to load
{sym}
;return