turtle_quant_1.data_processing.maintainer¶
turtle_quant_1.data_processing.maintainer
¶
Data maintainer for ensuring continuous historical data availability.
DataMaintainer
¶
DataMaintainer(
symbols: Optional[List[str]] = None,
freq: CandleUnit = CANDLE_UNIT,
fetcher: Optional[BaseDataFetcher] = None,
)
Bases: BaseDataMaintainer
Maintains continuous historical data for all symbols.
Initialize the data maintainer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbols
|
Optional[List[str]]
|
List of symbols to maintain. If None, uses SYMBOLS from config. |
None
|
freq
|
CandleUnit
|
Candle frequency for the data being maintained. The maintainer always stores raw data at the 5M atomic resolution; this value is retained for informational purposes and future use. |
CANDLE_UNIT
|
fetcher
|
Optional[BaseDataFetcher]
|
Data fetcher to use. If None, uses YFinanceDataFetcher. |
None
|
Source code in src/turtle_quant_1/data_processing/maintainer.py
impute_data
¶
Ensure continuous data exists for a symbol up to the specified end date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
Symbol to ensure data for. |
required |
data
|
DataFrame
|
DataFrame with data. |
required |
end_date
|
Optional[datetime]
|
Timezone-aware end date to ensure data up to. If None, uses current time. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with updated data. |