IDataProvider - mwhicks-dev/py-tradekit GitHub Wiki
The IDataProvider interface is the name given to a data provider implementation, whether it provides real-time data, historic data, or both. IDataProvider will require the following three methods:
get_value(str): ValueDto will, provided a ticker symbol, return a StockValueDto schema (below) containing the symbol, the time at which it was retrieved, and its current value.
get_historical_grains(None): tuple[str, ...] will return a tuple of string grains that the data provider allows in ascending order. For example, Yahoo! Finance, based on its supported grains (daily/weekly/monthly), would return something like ("1d", "1w", "1m").
get_historical_data(HistoricQuery): list[HistoricValueDto] consumes and returns data regarding the historic data of a stock. See the schemas for more information about the input and output values.
| ValueDto |
|---|
| ticker: str time: datetime value: Decimal |
| HistoricalQuery |
|---|
| ticker: str grain: str start: datetime end: datetime |
| HistoricalDataDto |
|---|
| ticker: str start: datetime end: datetime low: Decimal high: Decimal |
Note that historic data does not provide open/close values. This will change later if the need arises.