data.data_repository
data.data_repository
DataRepository
Bases: Generic[TConfig]
Retrieves data from either internal storage, a broker, or both. Data that is not already in storage is automatically added.
get_data_and_store
staticmethod
get_data_and_store(broker: HistoricalBroker[TConfig], config: TConfig, expected_timestamps: Iterable[datetime], database_path: str | Path | None = None) -> list[MarketDataEvent]
Retrieves data from either the database, a broker, or both. Any data not in the database that is retrieved from the broker is then put into storage for further use.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
broker
|
HistoricalBroker[TConfig]
|
The historical broker to derive data from if necessary. |
required |
config
|
TConfig
|
The corresponding config to the historical broker. |
required |
expected_timestamps
|
Iterable[datetime]
|
An iterable of the expected timestamps. |
required |
database_path
|
str | Path | None
|
Where the database should live. If not provided, DataStorage resolves it via the OS-standard user data directory. |
None
|
Source code in src\contango\data\data_repository.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |