pull_bondret_treasury#

Functions to pull and save treasury returns data.

Data source: https://openbondassetpricing.com/wp-content/uploads/2024/06/bondret_treasury.csv

This module provides functions to download the treasury returns CSV file from the given URL and save it to a local data directory. You can later load the saved file for further analysis.

Module Contents#

Functions#

pull_bondret_treasury_file

Pulls the treasury returns CSV file from the specified URL.

load_bondret_treasury_file

Loads the locally saved treasury returns file.

_demo

Data#

API#

pull_bondret_treasury.DATA_DIR#

β€˜Path(…)’

pull_bondret_treasury.BOND_TREASURY_URL#

β€˜https://openbondassetpricing.com/wp-content/uploads/2024/06/bondret_treasury.csv’

pull_bondret_treasury.pull_bondret_treasury_file(url=BOND_TREASURY_URL)#

Pulls the treasury returns CSV file from the specified URL.

Parameters

url : str, optional URL of the CSV file containing treasury returns data, by default BOND_TREASURY_URL

Returns

pd.DataFrame DataFrame with the treasury returns data.

pull_bondret_treasury.load_bondret_treasury_file(data_dir=DATA_DIR)#

Loads the locally saved treasury returns file.

Parameters

data_dir : Path, optional The directory where the treasury returns file is saved, by default DATA_DIR

Returns

pd.DataFrame DataFrame with the treasury returns data.

pull_bondret_treasury._demo()#