mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-14 00:06: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
|
2. Please follow following steps to download example data
|
||||||
```bash
|
```bash
|
||||||
cd examples/orderbook_data/
|
cd examples/orderbook_data/
|
||||||
wget http://fintech.msra.cn/stock_data/downloads/highfreq_orderboook_example_data.tar.bz2
|
python scripts/get_data.py qlib_data --target_dir "~/.qlib/orderbook_data" --name orderbook_data
|
||||||
tar xf highfreq_orderboook_example_data.tar.bz2
|
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Please import the example data to your mongo db
|
3. Please import the example data to your mongo db
|
||||||
|
|||||||
@@ -71,11 +71,15 @@ def fetch_df_by_index(
|
|||||||
if fetch_orig:
|
if fetch_orig:
|
||||||
for slc in idx_slc:
|
for slc in idx_slc:
|
||||||
if slc != slice(None, None):
|
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
|
else: # pylint: disable=W0120
|
||||||
return df
|
return df
|
||||||
else:
|
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:
|
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):
|
def _get_file_name_with_version(qlib_version, dataset_version):
|
||||||
dataset_version = "v2" if dataset_version is None else 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 = 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
|
return file_name_with_version
|
||||||
|
|
||||||
file_name = _get_file_name_with_version(qlib_version, dataset_version=version)
|
file_name = _get_file_name_with_version(qlib_version, dataset_version=version)
|
||||||
|
|||||||
Reference in New Issue
Block a user