@@ -66,38 +66,41 @@ def fetch(
6666
6767class DataHandler (BaseDataHandler ):
6868 """
69-
7069 The motivation of DataHandler:
71- - it proivdes a implementation of BaseDataHandler that we implement it with
72- - Handle response with a internal loaded dataframe
73- - the dataframe is loaded by a data loader.
7470
75- The steps to using a handler
76- 1. initialized data handler (call by `init`).
77- 2. use the data.
71+ This class provides an implementation of `BaseDataHandler` that:
72+ - Handle response with a internal loaded dataframe
73+ - The dataframe is loaded by a data loader.
74+
75+ Steps to use a handler:
76+
77+ 1. Initialize the data handler by calling `init()`
78+ 2. Use the data via the handler interface
7879
80+ Index conventions:
7981
80- The data handler try to maintain a handler with 2 level.
81- `datetime` & `instruments`.
82+ The data handler maintains a handler with two levels of index:
83+ - `datetime`
84+ - `instruments`
8285
83- Any order of the index level can be supported (The order will be implied in the data) .
84- The order <`datetime`, `instruments`> will be used when the dataframe index name is missed .
86+ The order of index levels is flexible, and will be inferred from the data.
87+ If the index name is missing, the default order `<datetime, instruments>` is assumed .
8588
86- Example of the data:
87- The multi-index of the columns is optional.
89+ Example of the data (with optional multi-index columns):
8890
8991 .. code-block:: text
9092
91- feature label
92- $close $volume Ref($close, 1) Mean($close, 3) $high-$low LABEL0
93+ feature label
94+ $close $volume Ref($close, 1) Mean($close, 3) $high-$low LABEL0
9395 datetime instrument
9496 2010-01-04 SH600000 81.807068 17145150.0 83.737389 83.016739 2.741058 0.0032
9597 SH600004 13.313329 11800983.0 13.313329 13.317701 0.183632 0.0042
9698 SH600005 37.796539 12231662.0 38.258602 37.919757 0.970325 0.0289
9799
100+ Performance Tips:
98101
99- Tips for improving the performance of datahandler
100- - Fetching data with `col_set=CS_RAW` will return the raw data and may avoid pandas from copying the data when calling `loc`
102+ - Fetching data with `col_set=CS_RAW` returns raw data
103+ - This may avoid unnecessary copying by pandas when calling `loc`
101104 """
102105
103106 _data : pd .DataFrame # underlying data.
0 commit comments