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

Reformat with black.

This commit is contained in:
Charles Young
2021-03-08 19:32:13 +08:00
parent 6a305c73ae
commit 8b9065c166
46 changed files with 123 additions and 546 deletions

View File

@@ -78,10 +78,7 @@ 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,
@@ -176,9 +173,7 @@ 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,9 +40,7 @@ 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
@@ -54,10 +52,7 @@ 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,9 +26,7 @@ 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

View File

@@ -33,7 +33,7 @@ class TestStructuredCovEstimator(unittest.TestCase):
NUM_OBSERVATION = 200
EPS = 1e-6
estimator = StructuredCovEstimator(scale_return=False, assume_centered=True, nan_option='fill')
estimator = StructuredCovEstimator(scale_return=False, assume_centered=True, nan_option="fill")
X = np.random.rand(NUM_OBSERVATION, NUM_VARIABLE)
@@ -50,7 +50,7 @@ class TestStructuredCovEstimator(unittest.TestCase):
NUM_VARIABLE = 10
NUM_OBSERVATION = 200
estimator = StructuredCovEstimator(scale_return=False, assume_centered=True, nan_option='fill')
estimator = StructuredCovEstimator(scale_return=False, assume_centered=True, nan_option="fill")
X = np.random.rand(NUM_OBSERVATION, NUM_VARIABLE)