mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-03 02:50:58 +08:00
download orderbook data
This commit is contained in:
@@ -27,8 +27,7 @@ pip install arctic # NOTE: pip may fail to resolve the right package dependency
|
||||
2. Please follow following steps to download example data
|
||||
```bash
|
||||
cd examples/orderbook_data/
|
||||
wget http://fintech.msra.cn/stock_data/downloads/highfreq_orderboook_example_data.tar.bz2
|
||||
tar xf highfreq_orderboook_example_data.tar.bz2
|
||||
python scripts/get_data.py qlib_data --target_dir "~/.qlib/orderbook_data" --name orderbook_data
|
||||
```
|
||||
|
||||
3. Please import the example data to your mongo db
|
||||
|
||||
@@ -71,11 +71,15 @@ def fetch_df_by_index(
|
||||
if fetch_orig:
|
||||
for slc in idx_slc:
|
||||
if slc != slice(None, None):
|
||||
return df.loc[pd.IndexSlice[idx_slc],] # noqa: E231
|
||||
return df.loc[
|
||||
pd.IndexSlice[idx_slc],
|
||||
] # noqa: E231
|
||||
else: # pylint: disable=W0120
|
||||
return df
|
||||
else:
|
||||
return df.loc[pd.IndexSlice[idx_slc],] # noqa: E231
|
||||
return df.loc[
|
||||
pd.IndexSlice[idx_slc],
|
||||
] # noqa: E231
|
||||
|
||||
|
||||
def fetch_df_by_col(df: pd.DataFrame, col_set: Union[str, List[str]]) -> pd.DataFrame:
|
||||
|
||||
@@ -183,6 +183,9 @@ class GetData:
|
||||
def _get_file_name_with_version(qlib_version, dataset_version):
|
||||
dataset_version = "v2" if dataset_version is None else dataset_version
|
||||
file_name_with_version = f"{dataset_version}/{name}_{region.lower()}_{interval.lower()}_{qlib_version}.zip"
|
||||
file_name_with_version = (
|
||||
"highfreq_orderbook_example_data.zip" if name == "orderbook_data" else file_name_with_version
|
||||
)
|
||||
return file_name_with_version
|
||||
|
||||
file_name = _get_file_name_with_version(qlib_version, dataset_version=version)
|
||||
|
||||
Reference in New Issue
Block a user