contango.data.data_repository
contango.data.data_repository
DataRepository
Bases: Generic[TConfig]
Retrieves data from either internal storage, a data provider, or both. Data that is not already in storage is automatically added.
get_data_and_store
staticmethod
get_data_and_store(provider: HistoricalDataProvider[TConfig], config: TConfig, expected_timestamps: Iterable[datetime], database_path: str | Path | None = None) -> list[MarketDataEvent]
Retrieves data from either the database, a provider, or both. Any data not in the database that is retrieved from the provider is then put into storage for further use.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
HistoricalDataProvider[TConfig]
|
The historical provider to derive data from if necessary. |
required |
config
|
TConfig
|
The corresponding config to the historical provider. |
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
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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 80 81 82 83 | |