1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-15 00:36:55 +08:00

data.rst update

This commit is contained in:
Young
2020-11-26 09:15:13 +00:00
parent 3a3937aa42
commit 7d092f39c8

View File

@@ -143,7 +143,7 @@ Filter
Expression dynamic instrument filter. Filter the instruments based on a certain expression. An expression rule indicating a certain feature field is required. Expression dynamic instrument filter. Filter the instruments based on a certain expression. An expression rule indicating a certain feature field is required.
- `basic features filter`: rule_expression = '$close/$open>5' - `basic features filter`: rule_expression = '$close/$open>5'
- `cross-sectional features filter` : rule_expression = '$rank($close)<10' - `cross-sectional features filter` \: rule_expression = '$rank($close)<10'
- `time-sequence features filter`: rule_expression = '$Ref($close, 3)>100' - `time-sequence features filter`: rule_expression = '$Ref($close, 3)>100'
To know more about ``Filter``, please refer to `Filter API <../reference/api.html#module-qlib.data.filter>`_. To know more about ``Filter``, please refer to `Filter API <../reference/api.html#module-qlib.data.filter>`_.
@@ -169,11 +169,11 @@ Here are some interfaces of the ``QlibDataLoader`` class:
- `load(instruments, start_time=None, end_time=None)` - `load(instruments, start_time=None, end_time=None)`
- This method loads the data as pd.DataFrame - This method loads the data as pd.DataFrame
- Parameters: - Parameters:
- `instruments` : str or dict - `instruments` \: str or dict
it can either be the market name or the config file of instruments generated by InstrumentProvider. it can either be the market name or the config file of instruments generated by InstrumentProvider.
- `start_time` : str - `start_time` \: str
start of the time range. start of the time range.
- `end_time` : str - `end_time` \: str
end of the time range. end of the time range.
- Returns: - Returns:
- The data being loaded with type `pd.DataFrame` - The data being loaded with type `pd.DataFrame`
@@ -181,15 +181,15 @@ Here are some interfaces of the ``QlibDataLoader`` class:
- `load_group_df(instruments, exprs: list, names: list, start_time=None, end_time=None)` - `load_group_df(instruments, exprs: list, names: list, start_time=None, end_time=None)`
- This method loads the dataframe for specific group. - This method loads the dataframe for specific group.
- Parameters: - Parameters:
- `instruments` : str or dict - `instruments` \: str or dict
it can either be the market name or the config file of instruments generated by InstrumentProvider. it can either be the market name or the config file of instruments generated by InstrumentProvider.
- `exprs` : list - `exprs` \: list
the expressions to describe the content of the data. the expressions to describe the content of the data.
- `names` : list - `names` \: list
the name of the data. the name of the data.
- `start_time` : str - `start_time` \: str
start of the time range. start of the time range.
- `end_time` : str - `end_time` \: str
end of the time range. end of the time range.
- Returns: - Returns:
- The queried data in type `pd.DataFrame`. - The queried data in type `pd.DataFrame`.
@@ -220,7 +220,7 @@ Here are some important interfaces that ``DataHandlerLP`` provides:
- `__init__(instruments=None, start_time=None, end_time=None, data_loader: Tuple[dict, str, DataLoader] = None, infer_processors=[], learn_processors=[], process_type=PTYPE_A, **kwargs)` - `__init__(instruments=None, start_time=None, end_time=None, data_loader: Tuple[dict, str, DataLoader] = None, infer_processors=[], learn_processors=[], process_type=PTYPE_A, **kwargs)`
- Initialization of the class. - Initialization of the class.
- Parameters: - Parameters:
- `infer_processors` : list - `infer_processors` \: list
- list of <description info> of processors to generate data for inference - list of <description info> of processors to generate data for inference
- example of <description info>: - example of <description info>:
@@ -238,7 +238,7 @@ Here are some important interfaces that ``DataHandlerLP`` provides:
"DropnaFeature" "DropnaFeature"
3) object instance of Processor 3) object instance of Processor
- `learn_processors` : list - `learn_processors` \: list
similar to infer_processors, but for generating data for learning models similar to infer_processors, but for generating data for learning models
- `process_type`: str - `process_type`: str
@@ -253,13 +253,13 @@ Here are some important interfaces that ``DataHandlerLP`` provides:
- `fetch(selector: Union[pd.Timestamp, slice, str] = slice(None, None), level: Union[str, int] = "datetime", col_set=DataHandler.CS_ALL, data_key: str = DK_I)` - `fetch(selector: Union[pd.Timestamp, slice, str] = slice(None, None), level: Union[str, int] = "datetime", col_set=DataHandler.CS_ALL, data_key: str = DK_I)`
- This method fetches data from underlying data source - This method fetches data from underlying data source
- Parameters: - Parameters:
- `selector` : Union[pd.Timestamp, slice, str] - `selector` \: Union[pd.Timestamp, slice, str]
describe how to select data by index. describe how to select data by index.
- `level` : Union[str, int] - `level` \: Union[str, int]
which index level to select the data. which index level to select the data.
- `col_set` : str - `col_set` \: str
select a set of meaningful columns.(e.g. features, columns). select a set of meaningful columns.(e.g. features, columns).
- `data_key` : str - `data_key` \: str
The data to fetch: DK_*. The data to fetch: DK_*.
- Returns: - Returns:
- The retrieved results in the type: `pd.DataFrame`. - The retrieved results in the type: `pd.DataFrame`.
@@ -267,9 +267,9 @@ Here are some important interfaces that ``DataHandlerLP`` provides:
- `get_cols(col_set=DataHandler.CS_ALL, data_key: str = DK_I)` - `get_cols(col_set=DataHandler.CS_ALL, data_key: str = DK_I)`
- This method gets the column names. - This method gets the column names.
- Parameters: - Parameters:
- `col_set` : str - `col_set` \: str
select a set of meaningful columns.(e.g. features, columns). select a set of meaningful columns.(e.g. features, columns).
- `data_key` : str - `data_key` \: str
the data to fetch: DK_*. the data to fetch: DK_*.
- Returns: - Returns:
- A list of column names. - A list of column names.
@@ -356,7 +356,7 @@ The ``DatasetH`` class is the `dataset` with `Data Handler`. Here is the most im
- `prepare(segments: Union[List[str], Tuple[str], str, slice], col_set=DataHandler.CS_ALL, data_key=DataHandlerLP.DK_I, **kwargs)` - `prepare(segments: Union[List[str], Tuple[str], str, slice], col_set=DataHandler.CS_ALL, data_key=DataHandlerLP.DK_I, **kwargs)`
- This method prepares the data for learning and inference. - This method prepares the data for learning and inference.
- Parameters: - Parameters:
- `segments` : Union[List[str], Tuple[str], str, slice] - `segments` \: Union[List[str], Tuple[str], str, slice]
Describe the scope of the data to be prepared Describe the scope of the data to be prepared
Here are some examples: Here are some examples:
@@ -364,9 +364,9 @@ The ``DatasetH`` class is the `dataset` with `Data Handler`. Here is the most im
- ['train', 'valid'] - ['train', 'valid']
- `col_set` : str - `col_set` \: str
The col_set will be passed to self._handler when fetching data. The col_set will be passed to self._handler when fetching data.
- `data_key` : str - `data_key` \: str
The data to fetch: DK_* The data to fetch: DK_*
Default is DK_I, which indicate fetching data for **inference**. Default is DK_I, which indicate fetching data for **inference**.