mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-16 01:06:56 +08:00
add documentation on which storage methods are used in qlib
This commit is contained in:
@@ -24,20 +24,43 @@ If the user is only using it in `qlib`, you can customize Storage to implement o
|
|||||||
class UserCalendarStorage(CalendarStorage):
|
class UserCalendarStorage(CalendarStorage):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def data(self):
|
def data(self) -> Iterable[CalVT]:
|
||||||
pass
|
'''get all data'''
|
||||||
|
raise NotImplementedError("Subclass of CalendarStorage must implement `data` method")
|
||||||
|
|
||||||
|
def check_exists(self) -> bool:
|
||||||
|
'''check if storage(uri) exists, if not exists: return False'''
|
||||||
|
raise NotImplementedError("Subclass of BaseStorage must implement `check_exists` method")
|
||||||
|
|
||||||
|
|
||||||
class UserInstrumentStorage(InstrumentStorage):
|
class UserInstrumentStorage(InstrumentStorage):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def data(self):
|
def data(self) -> Dict[InstKT, InstVT]:
|
||||||
pass
|
'''get all data'''
|
||||||
|
raise NotImplementedError("Subclass of InstrumentStorage must implement `data` method")
|
||||||
|
|
||||||
|
def check_exists(self) -> bool:
|
||||||
|
'''check if storage(uri) exists, if not exists: return False'''
|
||||||
|
raise NotImplementedError("Subclass of BaseStorage must implement `check_exists` method")
|
||||||
|
|
||||||
|
|
||||||
class UserFeatureStorage(FeatureStorage):
|
class UserFeatureStorage(FeatureStorage):
|
||||||
|
|
||||||
@check_storage
|
def __getitem__(self, s: slice) -> pd.Series:
|
||||||
def __getitem__(self, i: slice) -> pd.Series:
|
'''x.__getitem__(slice(start: int, stop: int, step: int)) <==> x[start:stop:step]
|
||||||
pass
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
pd.Series(values, index=pd.RangeIndex(start, len(values))
|
||||||
|
'''
|
||||||
|
raise NotImplementedError(
|
||||||
|
"Subclass of FeatureStorage must implement `__getitem__(s: slice)` method"
|
||||||
|
)
|
||||||
|
|
||||||
|
def check_exists(self) -> bool:
|
||||||
|
'''check if storage(uri) exists, if not exists: return False'''
|
||||||
|
raise NotImplementedError("Subclass of BaseStorage must implement `check_exists` method")
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user