prepare_sparkline_data
Documentation for eth_defi.research.sparkline.prepare_sparkline_data function.
- prepare_sparkline_data(vault_prices_df, minimum_history=Timedelta('0 days 00:00:00'), window=Timedelta('90 days 00:00:00'))
Prepare one vault’s observations for a fixed-width sparkline.
Two valid observations at distinct timestamps suffice, even on the first day. Daily closing observations keep their actual timestamps, and the initial observation is retained so its first day’s movement is visible. Charts retain a 90-day axis by default. Young vaults leave the period before their first observation blank, while older sparse vaults carry their last pre-window value to the left boundary.
- Parameters
vault_prices_df (pandas.DataFrame) – Single-vault data indexed by naive UTC timestamps with a
share_pricecolumn.minimum_history (pandas.Timedelta) – Optional elapsed-history floor. Defaults to zero; two distinct valid observation timestamps are still required.
window (pandas.Timedelta) – Full elapsed time represented by the horizontal axis.
- Returns
Daily closes, initial price and chart bounds, or
Nonewhen there are fewer than two distinct valid timestamps or history is too short.- Return type