Skip to content

v0.8.7 - Eurobond historical daily prices

Choose a tag to compare

@saidsurucu saidsurucu released this 17 Apr 21:31
· 10 commits to master since this release

New Features

  • Eurobond historical prices (closes #11): Eurobond.history() returns a DataFrame of daily bid/ask prices and yields across a date range. Weekends are skipped (Ziraat API returns zeros), holidays and suspended days are filtered, and per-date results are cached so repeat queries are instant.
import borsapy as bp

bond = bp.Eurobond("US900123DG28")

# Period-based lookback
df = bond.history(period="1y")

# Explicit date range
df = bond.history(start="2021-08-16", end="2026-03-11")

print(df.head())
#              bid_price  bid_yield  ask_price  ask_yield  days_to_maturity
# Date
# 2024-10-01   118.353000       6.75  120.255083       6.48              3032
# 2024-10-02   118.129042       6.78  119.997125       6.52              3031
# ...

Parameters

  • period: Lookback window ending today. One of 1mo, 3mo, 6mo, 1y, 2y, 3y, 5y, 10y, ytd, max.
  • start / end: Accepts "YYYY-MM-DD", "DD.MM.YYYY", datetime, or date.
  • skip_weekends: True by default.

Performance

Implemented client-side via one HTTP request per business day against the Ziraat Bank API (GetZBBonoTahvilOran), using a ThreadPoolExecutor (5 workers). Expect ~10s per year on a cold cache; subsequent calls hit the per-date cache (TTL.OHLCV_HISTORY, 1 hour).

Technical Changes

  • borsapy/_providers/ziraat_eurobond.py: new get_history(), _iter_business_dates(), _fetch_bonds_for_date_cached()
  • borsapy/eurobond.py: new Eurobond.history() + _parse_date_arg helper (accepts 5 date formats including Turkish dotted DD.MM.YYYY)
  • 26 new unit tests in tests/test_eurobond.py covering date parsing, business-day enumeration, ISIN normalization, zero-price filtering, sort invariance, and period/start resolution