def test_universe_arithmic(self): universe = Universe('zz500') + Universe('hs300') univ_desc = universe.save() loaded_universe = load_universe(univ_desc) self.assertEqual(universe, loaded_universe) universe = Universe('zz500') - Universe('hs300') univ_desc = universe.save() loaded_universe = load_universe(univ_desc) self.assertEqual(universe, loaded_universe) universe = Universe('zz500') & Universe('hs300') univ_desc = universe.save() loaded_universe = load_universe(univ_desc) self.assertEqual(universe, loaded_universe)
def load(cls, data_desc: dict): freq = data_desc['freq'] universe =load_universe(data_desc['universe']) batch = data_desc['batch'] neutralized_risk = data_desc['neutralized_risk'] risk_model = data_desc['risk_model'] pre_process = data_desc['pre_process'] post_process = data_desc['post_process'] warm_start = data_desc['warm_start'] data_source = data_desc['data_source'] return cls(freq=freq, universe=universe, batch=batch, neutralized_risk=neutralized_risk, risk_model=risk_model, pre_process=pre_process, post_process=post_process, warm_start=warm_start, data_source=data_source)
def test_universe_persistence(self): universe = Universe('zz500') univ_desc = universe.save() loaded_universe = load_universe(univ_desc) self.assertEqual(universe, loaded_universe)