Skip to content

Commit

Permalink
fix_typo (#790)
Browse files Browse the repository at this point in the history
Signed-off-by: unknown <lv.linlang@qq.com>
  • Loading branch information
SunsetWolf authored Dec 31, 2021
1 parent f59cfe5 commit dfc0ed3
Show file tree
Hide file tree
Showing 56 changed files with 92 additions and 92 deletions.
8 changes: 4 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Version 0.2.1
--------------------
- Support registering user-defined ``Provider``.
- Support use operators in string format, e.g. ``['Ref($close, 1)']`` is valid field format.
- Support dynamic fields in ``$some_field`` format. And exising fields like ``Close()`` may be deprecated in the future.
- Support dynamic fields in ``$some_field`` format. And existing fields like ``Close()`` may be deprecated in the future.

Version 0.2.2
--------------------
Expand Down Expand Up @@ -78,7 +78,7 @@ Version 0.3.5
- Support multi-label training, you can provide multiple label in ``handler``. (But LightGBM doesn't support due to the algorithm itself)
- Refactor ``handler`` code, dataset.py is no longer used, and you can deploy your own labels and features in ``feature_label_config``
- Handler only offer DataFrame. Also, ``trainer`` and model.py only receive DataFrame
- Change ``split_rolling_data``, we roll the data on market calender now, not on normal date
- Change ``split_rolling_data``, we roll the data on market calendar now, not on normal date
- Move some date config from ``handler`` to ``trainer``

Version 0.4.0
Expand Down Expand Up @@ -167,11 +167,11 @@ Version 0.8.0
- There are lots of changes for daily trading, it is hard to list all of them. But a few important changes could be noticed
- The trading limitation is more accurate;
- In `previous version <https://github.com/microsoft/qlib/blob/v0.7.2/qlib/contrib/backtest/exchange.py#L160>`_, longing and shorting actions share the same action.
- In `current verison <https://github.com/microsoft/qlib/blob/7c31012b507a3823117bddcc693fc64899460b2a/qlib/backtest/exchange.py#L304>`_, the trading limitation is different between loging and shorting action.
- In `current version <https://github.com/microsoft/qlib/blob/7c31012b507a3823117bddcc693fc64899460b2a/qlib/backtest/exchange.py#L304>`_, the trading limitation is different between logging and shorting action.
- The constant is different when calculating annualized metrics.
- `Current version <https://github.com/microsoft/qlib/blob/7c31012b507a3823117bddcc693fc64899460b2a/qlib/contrib/evaluate.py#L42>`_ uses more accurate constant than `previous version <https://github.com/microsoft/qlib/blob/v0.7.2/qlib/contrib/evaluate.py#L22>`_
- `A new version <https://github.com/microsoft/qlib/blob/7c31012b507a3823117bddcc693fc64899460b2a/qlib/tests/data.py#L17>`_ of data is released. Due to the unstability of Yahoo data source, the data may be different after downloading data again.
- Users could chec kout the backtesting results between `Current version <https://github.com/microsoft/qlib/tree/7c31012b507a3823117bddcc693fc64899460b2a/examples/benchmarks>`_ and `previous version <https://github.com/microsoft/qlib/tree/v0.7.2/examples/benchmarks>`_
- Users could check out the backtesting results between `Current version <https://github.com/microsoft/qlib/tree/7c31012b507a3823117bddcc693fc64899460b2a/examples/benchmarks>`_ and `previous version <https://github.com/microsoft/qlib/tree/v0.7.2/examples/benchmarks>`_


Other Versions
Expand Down
2 changes: 1 addition & 1 deletion docs/component/highfreq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To get the join trading performance of daily and intraday trading, they must int
In order to support the joint backtest strategies in multiple levels, a corresponding framework is required. None of the publicly available high-frequency trading frameworks considers multi-level joint trading, which make the backtesting aforementioned inaccurate.

Besides backtesting, the optimization of strategies from different levels is not standalone and can be affected by each other.
For example, the best portfolio management strategy may change with the performance of order executions(e.g. a portfolio with higher turnover may becomes a better choice when we imporve the order execution strategies).
For example, the best portfolio management strategy may change with the performance of order executions(e.g. a portfolio with higher turnover may becomes a better choice when we improve the order execution strategies).
To achieve the overall good performance , it is necessary to consider the interaction of strategies in different level.

Therefore, building a new framework for trading in multiple levels becomes necessary to solve the various problems mentioned above, for which we designed a nested decision execution framework that consider the interaction of strategies.
Expand Down
2 changes: 1 addition & 1 deletion docs/component/recorder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Here is a general view of the structure of the system:
This experiment management system defines a set of interface and provided a concrete implementation ``MLflowExpManager``, which is based on the machine learning platform: ``MLFlow`` (`link <https://mlflow.org/>`_).

If users set the implementation of ``ExpManager`` to be ``MLflowExpManager``, they can use the command `mlflow ui` to visualize and check the experiment results. For more information, pleaes refer to the related documents `here <https://www.mlflow.org/docs/latest/cli.html#mlflow-ui>`_.
If users set the implementation of ``ExpManager`` to be ``MLflowExpManager``, they can use the command `mlflow ui` to visualize and check the experiment results. For more information, please refer to the related documents `here <https://www.mlflow.org/docs/latest/cli.html#mlflow-ui>`_.

Qlib Recorder
===================
Expand Down
10 changes: 5 additions & 5 deletions docs/hidden/tuner.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Let's see an example,

First make sure you have the latest version of `qlib` installed.

Then, you need to privide a configuration to setup the experiment.
Then, you need to provide a configuration to setup the experiment.
We write a simple configuration example as following,

.. code-block:: YAML
Expand Down Expand Up @@ -217,13 +217,13 @@ The tuner pipeline contains different tuners, and the `tuner` program will proce
Each part represents a tuner, and its modules which are to be tuned. Space in each part is the hyper-parameters' space of a certain module, you need to create your searching space and modify it in `/qlib/contrib/tuner/space.py`. We use `hyperopt` package to help us to construct the space, you can see the detail of how to use it in https://github.com/hyperopt/hyperopt/wiki/FMin .

- model
You need to provide the `class` and the `space` of the model. If the model is user's own implementation, you need to privide the `module_path`.
You need to provide the `class` and the `space` of the model. If the model is user's own implementation, you need to provide the `module_path`.

- trainer
You need to proveide the `class` of the trainer. If the trainer is user's own implementation, you need to privide the `module_path`.
You need to provide the `class` of the trainer. If the trainer is user's own implementation, you need to provide the `module_path`.

- strategy
You need to provide the `class` and the `space` of the strategy. If the strategy is user's own implementation, you need to privide the `module_path`.
You need to provide the `class` and the `space` of the strategy. If the strategy is user's own implementation, you need to provide the `module_path`.

- data_label
The label of the data, you can search which kinds of labels will lead to a better result. This part is optional, and you only need to provide `space`.
Expand Down Expand Up @@ -273,7 +273,7 @@ You need to use the same dataset to evaluate your different `estimator` experime
About the data and backtest
~~~~~~~~~~~~~~~~~~~~~~~~~~~

`data` and `backtest` are all same in the whole `tuner` experiment. Different `estimator` experiments must use the same data and backtest method. So, these two parts of config are same with that in `estimator` configuration. You can see the precise defination of these parts in `estimator` introduction. We only provide an example here.
`data` and `backtest` are all same in the whole `tuner` experiment. Different `estimator` experiments must use the same data and backtest method. So, these two parts of config are same with that in `estimator` configuration. You can see the precise definition of these parts in `estimator` introduction. We only provide an example here.

.. code-block:: YAML
Expand Down
4 changes: 2 additions & 2 deletions docs/introduction/quick.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Users can easily intsall ``Qlib`` according to the following steps:
git clone https://github.com/microsoft/qlib.git && cd qlib
python setup.py install
To kown more about `installation`, please refer to `Qlib Installation <../start/installation.html>`_.
To known more about `installation`, please refer to `Qlib Installation <../start/installation.html>`_.

Prepare Data
==============
Expand All @@ -44,7 +44,7 @@ Load and prepare data by running the following code:
This dataset is created by public data collected by crawler scripts in ``scripts/data_collector/``, which have been released in the same repository. Users could create the same dataset with it.

To kown more about `prepare data`, please refer to `Data Preparation <../component/data.html#data-preparation>`_.
To known more about `prepare data`, please refer to `Data Preparation <../component/data.html#data-preparation>`_.

Auto Quant Research Workflow
====================================
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmarks/TFT/data_formatters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import enum


# Type defintions
# Type definitions
class DataTypes(enum.IntEnum):
"""Defines numerical types of each column."""

Expand Down
6 changes: 3 additions & 3 deletions examples/benchmarks/TFT/libs/hyperparam_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ def __init__(
param_ranges: Discrete hyperparameter range for random search.
fixed_params: Fixed model parameters per experiment.
root_model_folder: Folder to store optimisation artifacts.
worker_number: Worker index definining which set of hyperparameters to
worker_number: Worker index defining which set of hyperparameters to
test.
search_iterations: Maximum numer of random search iterations.
search_iterations: Maximum number of random search iterations.
num_iterations_per_worker: How many iterations are handled per worker.
clear_serialised_params: Whether to regenerate hyperparameter
combinations.
Expand Down Expand Up @@ -330,7 +330,7 @@ def load_serialised_hyperparam_df(self):
if os.path.exists(self.serialised_ranges_folder):
df = pd.read_csv(self.serialised_ranges_path, index_col=0)
else:
print("Unable to load - regenerating serach ranges instead")
print("Unable to load - regenerating search ranges instead")
df = self.update_serialised_hyperparam_df()

return df
Expand Down
6 changes: 3 additions & 3 deletions examples/benchmarks/TFT/libs/tft_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def get(cls, key):

@classmethod
def contains(cls, key):
"""Retuns boolean indicating whether key is present in cache."""
"""Returns boolean indicating whether key is present in cache."""

return key in cls._data_cache

Expand Down Expand Up @@ -1120,10 +1120,10 @@ def predict(self, df, return_targets=False):
Args:
df: Input dataframe
return_targets: Whether to also return outputs aligned with predictions to
faciliate evaluation
facilitate evaluation
Returns:
Input dataframe or tuple of (input dataframe, algined output dataframe).
Input dataframe or tuple of (input dataframe, aligned output dataframe).
"""

data = self._batch_data(df)
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmarks/TFT/tft.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def finetune(self, dataset: DatasetH):
def to_pickle(self, path: Union[Path, str]):
"""
Tensorflow model can't be dumped directly.
So the data should be save seperatedly
So the data should be save separately
**TODO**: Please implement the function to load the files
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmarks/TRA/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ And here are two ways to run the model:
python example.py --config_file configs/config_alstm.yaml
```

Here we trained TRA on a pretrained backbone model. Therefore we run `*_init.yaml` before TRA's scipts.
Here we trained TRA on a pretrained backbone model. Therefore we run `*_init.yaml` before TRA's scripts.

### Results

Expand Down
6 changes: 3 additions & 3 deletions examples/benchmarks/TRA/src/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def train_epoch(self, data_set):
loss = (pred - label).pow(2).mean()

L = (all_preds.detach() - label[:, None]).pow(2)
L -= L.min(dim=-1, keepdim=True).values # normalize & ensure postive input
L -= L.min(dim=-1, keepdim=True).values # normalize & ensure positive input

data_set.assign_data(index, L) # save loss to memory

Expand Down Expand Up @@ -165,7 +165,7 @@ def test_epoch(self, data_set, return_pred=False):

L = (all_preds - label[:, None]).pow(2)

L -= L.min(dim=-1, keepdim=True).values # normalize & ensure postive input
L -= L.min(dim=-1, keepdim=True).values # normalize & ensure positive input

data_set.assign_data(index, L) # save loss to memory

Expand Down Expand Up @@ -484,7 +484,7 @@ class TRA(nn.Module):

"""Temporal Routing Adaptor (TRA)
TRA takes historical prediction erros & latent representation as inputs,
TRA takes historical prediction errors & latent representation as inputs,
then routes the input sample to a specific predictor for training & inference.
Args:
Expand Down
2 changes: 1 addition & 1 deletion examples/highfreq/highfreq_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(self, feature, l=None, r=None):
self.l = l
self.r = r
if (self.l is not None and self.l <= 0) or (self.r is not None and self.r >= 0):
raise ValueError("Cut operator l shoud > 0 and r should < 0")
raise ValueError("Cut operator l should > 0 and r should < 0")

super(Cut, self).__init__(feature)

Expand Down
2 changes: 1 addition & 1 deletion examples/nested_decision_execution/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def collect_data(self):
# - Aligning the profit calculation between multiple levels and single levels.
# 2) comparing different backtest
# - Basic test idea:
# - the daily backtest will be similar as multi-level(the data quality makes this gap samller)
# - the daily backtest will be similar as multi-level(the data quality makes this gap smaller)

def check_diff_freq(self):
self._init_qlib()
Expand Down
2 changes: 1 addition & 1 deletion qlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def auto_init(**kwargs):
default_exp_name: "Experiment"
Example 2)
If you wan to create simple a stand alone config, you can use following config(a.k.a `conf_type: origin`)
If you want to create simple a stand alone config, you can use following config(a.k.a `conf_type: origin`)
.. code-block:: python
Expand Down
6 changes: 3 additions & 3 deletions qlib/backtest/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
class AccumulatedInfo:
"""
accumulated trading info, including accumulated return/cost/turnover
AccumulatedInfo should be shared accross different levels
AccumulatedInfo should be shared across different levels
"""

def __init__(self):
Expand Down Expand Up @@ -199,7 +199,7 @@ def update_order(self, order, trade_val, cost, trade_price):

# if stock is sold out, no stock price information in Position, then we should update account first, then update current position
# if stock is bought, there is no stock in current position, update current, then update account
# The cost will be substracted from the cash at last. So the trading logic can ignore the cost calculation
# The cost will be subtracted from the cash at last. So the trading logic can ignore the cost calculation
if order.direction == Order.SELL:
# sell stock
self._update_state_from_order(order, trade_val, cost, trade_price)
Expand Down Expand Up @@ -378,7 +378,7 @@ def update_bar_end(
)

def get_portfolio_metrics(self):
"""get the history portfolio_metrics and postions instance"""
"""get the history portfolio_metrics and positions instance"""
if self.is_port_metr_enabled():
_portfolio_metrics = self.portfolio_metrics.generate_portfolio_metrics_dataframe()
_positions = self.get_hist_positions()
Expand Down
2 changes: 1 addition & 1 deletion qlib/backtest/backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def backtest_loop(start_time, end_time, trade_strategy: BaseStrategy, trade_executor: BaseExecutor):
"""backtest funciton for the interaction of the outermost strategy and executor in the nested decision execution
"""backtest function for the interaction of the outermost strategy and executor in the nested decision execution
please refer to the docs of `collect_data_loop`
Expand Down
4 changes: 2 additions & 2 deletions qlib/backtest/decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ def mod_inner_decision(self, inner_trade_decision: BaseTradeDecision):
`inner_trade_decision` will be changed **inplaced**.
Motivation of the `mod_inner_decision`
- Leave a hook for outer decision to affact the decision generated by the inner strategy
- e.g. the outmost strategy generate a time range for trading. But the upper layer can only affact the
- Leave a hook for outer decision to affect the decision generated by the inner strategy
- e.g. the outmost strategy generate a time range for trading. But the upper layer can only affect the
nearest layer in the original design. With `mod_inner_decision`, the decision can passed through multiple
layers
Expand Down
4 changes: 2 additions & 2 deletions qlib/backtest/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(
Necessary fields:
$close is for calculating the total value at end of each day.
Optional fields:
$volume is only necessary when we limit the trade amount or caculate PA(vwap) indicator
$volume is only necessary when we limit the trade amount or calculate PA(vwap) indicator
$vwap is only necessary when we use the $vwap price as the deal price
$factor is for rounding to the trading unit
limit_sell will be set to False by default(False indicates we can sell this
Expand Down Expand Up @@ -505,7 +505,7 @@ def generate_order_for_target_amount_position(self, target_position, current_pos
Note: some future information is used in this function
Parameter:
target_position : dict { stock_id : amount }
current_postion : dict { stock_id : amount}
current_position : dict { stock_id : amount}
trade_unit : trade_unit
down sample : for amount 321 and trade_unit 100, deal_amount is 300
deal order on trade_date
Expand Down
6 changes: 3 additions & 3 deletions qlib/backtest/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
Parameters
----------
time_per_step : str
trade time per trading step, used for genreate the trade calendar
trade time per trading step, used for generate the trade calendar
show_indicator: bool, optional
whether to show indicators, :
- 'pa', the price advantage
Expand Down Expand Up @@ -369,12 +369,12 @@ def _init_sub_trading(self, trade_decision):
self.inner_strategy.reset(level_infra=sub_level_infra, outer_trade_decision=trade_decision)

def _update_trade_decision(self, trade_decision: BaseTradeDecision) -> BaseTradeDecision:
# outter strategy have chance to update decision each iterator
# outer strategy have chance to update decision each iterator
updated_trade_decision = trade_decision.update(self.inner_executor.trade_calendar)
if updated_trade_decision is not None:
trade_decision = updated_trade_decision
# NEW UPDATE
# create a hook for inner strategy to update outter decision
# create a hook for inner strategy to update outer decision
self.inner_strategy.alter_outer_trade_decision(trade_decision)
return trade_decision

Expand Down
2 changes: 1 addition & 1 deletion qlib/backtest/high_performance_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def sum_all_indicators(order_indicator, indicators: list, metrics: Union[str, Li
indicators : List[BaseOrderIndicator]
the list of all inner indicators.
metrics : Union[str, List[str]]
all metrics needs ot be sumed.
all metrics needs to be sumed.
fill_value : float, optional
fill np.NaN with value. By default None.
"""
Expand Down
Loading

0 comments on commit dfc0ed3

Please sign in to comment.