mirror of
https://github.com/microsoft/qlib.git
synced 2026-06-06 05:51:17 +08:00
[930] Fix typo HasingStockStorage to HashingStockStorage. (#947)
This commit is contained in:
@@ -257,7 +257,7 @@ class DataHandler(Serializable):
|
||||
selector=selector, level=level, col_set=col_set, fetch_orig=self.fetch_orig, proc_func=proc_func
|
||||
)
|
||||
else:
|
||||
raise TypeError(f"data_storage should be pd.DataFrame|HasingStockStorage, not {type(data_storage)}")
|
||||
raise TypeError(f"data_storage should be pd.DataFrame|HashingStockStorage, not {type(data_storage)}")
|
||||
|
||||
if squeeze:
|
||||
# squeeze columns
|
||||
|
||||
@@ -349,6 +349,6 @@ class HashStockFormat(Processor):
|
||||
"""Process the storage of from df into hasing stock format"""
|
||||
|
||||
def __call__(self, df: pd.DataFrame):
|
||||
from .storage import HasingStockStorage # pylint: disable=C0415
|
||||
from .storage import HashingStockStorage # pylint: disable=C0415
|
||||
|
||||
return HasingStockStorage.from_df(df)
|
||||
return HashingStockStorage.from_df(df)
|
||||
|
||||
@@ -59,11 +59,11 @@ class BaseHandlerStorage:
|
||||
raise NotImplementedError("is_proc_func_supported method is not implemented!")
|
||||
|
||||
|
||||
class HasingStockStorage(BaseHandlerStorage):
|
||||
"""Hasing data storage for datahanlder
|
||||
class HashingStockStorage(BaseHandlerStorage):
|
||||
"""Hashing data storage for datahanlder
|
||||
- The default data storage pandas.DataFrame is too slow when randomly accessing one stock's data
|
||||
- HasingStockStorage hashes the multiple stocks' data(pandas.DataFrame) by the key `stock_id`.
|
||||
- HasingStockStorage hashes the pandas.DataFrame into a dict, whose key is the stock_id(str) and value this stock data(panda.DataFrame), it has the following format:
|
||||
- HashingStockStorage hashes the multiple stocks' data(pandas.DataFrame) by the key `stock_id`.
|
||||
- HashingStockStorage hashes the pandas.DataFrame into a dict, whose key is the stock_id(str) and value this stock data(panda.DataFrame), it has the following format:
|
||||
{
|
||||
stock1_id: stock1_data,
|
||||
stock2_id: stock2_data,
|
||||
@@ -82,7 +82,7 @@ class HasingStockStorage(BaseHandlerStorage):
|
||||
|
||||
@staticmethod
|
||||
def from_df(df):
|
||||
return HasingStockStorage(df)
|
||||
return HashingStockStorage(df)
|
||||
|
||||
def _fetch_hash_df_by_stock(self, selector, level):
|
||||
"""fetch the data with stock selector
|
||||
@@ -153,5 +153,5 @@ class HasingStockStorage(BaseHandlerStorage):
|
||||
return pd.concat(fetch_stock_df_list, sort=False, copy=~fetch_orig)
|
||||
|
||||
def is_proc_func_supported(self):
|
||||
"""the arg `proc_func` in `fetch` method is not supported in HasingStockStorage"""
|
||||
"""the arg `proc_func` in `fetch` method is not supported in HashingStockStorage"""
|
||||
return False
|
||||
|
||||
@@ -95,7 +95,7 @@ class TestHandlerStorage(TestAutoData):
|
||||
fetch_stocks = [instruments[_index] for _index in random_indexs]
|
||||
data_handler.fetch(selector=(fetch_stocks, slice(fetch_start_time, fetch_end_time)), level=None)
|
||||
|
||||
with TimeInspector.logt("random fetch with HasingStock Storage"):
|
||||
with TimeInspector.logt("random fetch with HashingStock Storage"):
|
||||
|
||||
# single stock
|
||||
for i in range(100):
|
||||
|
||||
Reference in New Issue
Block a user