-
Notifications
You must be signed in to change notification settings - Fork 960
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,12 @@ | |
email: [email protected] | ||
create_dt: 2021/11/7 21:07 | ||
""" | ||
import os | ||
import shutil | ||
import pandas as pd | ||
from copy import deepcopy | ||
from typing import List | ||
from czsc.utils.cache import home_path | ||
from czsc.traders.base import CzscSignals, BarGenerator, CzscTrader | ||
from czsc.traders.sig_parse import get_signals_config, get_signals_freqs | ||
from czsc.objects import Signal, Factor, Event, Operate, Position | ||
|
@@ -252,6 +255,10 @@ def _weighted_ensemble(poss): | |
assert ct.get_ensemble_pos('vote') == 0 | ||
assert ct.get_ensemble_pos('max') == 0 | ||
assert ct.get_ensemble_pos('mean') == 0 | ||
dfw = ct.get_ensemble_weight(method='mean') | ||
assert len(dfw) == len(bars_right) | ||
|
||
res = ct.weight_backtest(method='mean', res_path=os.path.join(home_path, "test_trader")) | ||
|
||
# 通过 on_bar 执行 | ||
ct1 = CzscTrader(deepcopy(bg), signals_config=signals_config, | ||
|