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

Reformat with black.

This commit is contained in:
Charles Young
2021-03-08 19:43:03 +08:00
parent 8b9065c166
commit 53cf89d7c2
45 changed files with 548 additions and 122 deletions

View File

@@ -78,7 +78,10 @@ port_analysis_config = {
"strategy": {
"class": "TopkDropoutStrategy",
"module_path": "qlib.contrib.strategy.strategy",
"kwargs": {"topk": 50, "n_drop": 5,},
"kwargs": {
"topk": 50,
"n_drop": 5,
},
},
"backtest": {
"verbose": False,
@@ -173,7 +176,9 @@ class TestAllFlow(TestAutoData):
def test_1_backtest(self):
analyze_df = backtest_analysis(TestAllFlow.PRED_SCORE, TestAllFlow.RID)
self.assertGreaterEqual(
analyze_df.loc(axis=0)["excess_return_with_cost", "annualized_return"].values[0], 0.10, "backtest failed",
analyze_df.loc(axis=0)["excess_return_with_cost", "annualized_return"].values[0],
0.10,
"backtest failed",
)

View File

@@ -40,7 +40,9 @@ class TestDumpData(unittest.TestCase):
TestDumpData.STOCK_NAMES = list(map(lambda x: x.name[:-4].upper(), SOURCE_DIR.glob("*.csv")))
provider_uri = str(QLIB_DIR.resolve())
qlib.init(
provider_uri=provider_uri, expression_cache=None, dataset_cache=None,
provider_uri=provider_uri,
expression_cache=None,
dataset_cache=None,
)
@classmethod
@@ -52,7 +54,10 @@ class TestDumpData(unittest.TestCase):
def test_1_dump_calendars(self):
ori_calendars = set(
map(pd.Timestamp, pd.read_csv(QLIB_DIR.joinpath("calendars", "day.txt"), header=None).loc[:, 0].values,)
map(
pd.Timestamp,
pd.read_csv(QLIB_DIR.joinpath("calendars", "day.txt"), header=None).loc[:, 0].values,
)
)
res_calendars = set(D.calendar())
assert len(ori_calendars - res_calendars) == len(res_calendars - ori_calendars) == 0, "dump calendars failed"

View File

@@ -26,7 +26,9 @@ class TestGetData(unittest.TestCase):
def setUpClass(cls) -> None:
provider_uri = str(QLIB_DIR.resolve())
qlib.init(
provider_uri=provider_uri, expression_cache=None, dataset_cache=None,
provider_uri=provider_uri,
expression_cache=None,
dataset_cache=None,
)
@classmethod