1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-11 06:46:56 +08:00

black format & add comments & add randStrategy direction

This commit is contained in:
Young
2021-06-28 08:16:51 +00:00
committed by you-n-g
parent 72c9593aa7
commit 27f0db669f
13 changed files with 132 additions and 102 deletions

View File

@@ -63,7 +63,9 @@ class AccumulatedInfo:
class Account:
def __init__(self, init_cash: float=1e9, freq: str = "day", benchmark_config: dict = {}, pos_type:str = "Position"):
def __init__(
self, init_cash: float = 1e9, freq: str = "day", benchmark_config: dict = {}, pos_type: str = "Position"
):
self.pos_type = pos_type
self.init_vars(init_cash, freq, benchmark_config)
@@ -71,13 +73,13 @@ class Account:
# init cash
self.init_cash = init_cash
self.current: BasePosition = init_instance_by_config({
'class': self.pos_type,
'kwargs': {
"cash": init_cash
},
'module_path': "qlib.backtest.position",
})
self.current: BasePosition = init_instance_by_config(
{
"class": self.pos_type,
"kwargs": {"cash": init_cash},
"module_path": "qlib.backtest.position",
}
)
self.accum_info = AccumulatedInfo()
self.reset(freq=freq, benchmark_config=benchmark_config, init_report=True)