Beispiel #1
0
 def generate_simulated_prices(self, event):
     # When a market simulation is created, generate and register all the simulated prices.
     assert isinstance(event, MarketSimulation.Created)
     market_simulation = self.market_simulation_repo[event.entity_id]
     market_calibration = self.market_calibration_repo[
         event.market_calibration_id]
     generate_simulated_prices(market_calibration, market_simulation)
 def test_generate_simulated_prices(self, simulate_future_prices,
                                    register_simuated_price):
     market_calibration = Mock(spec=MarketCalibration)
     market_simulation = Mock(spec=MarketSimulation)
     generate_simulated_prices(market_simulation=market_simulation,
                               market_calibration=market_calibration)
     self.assertEqual(register_simuated_price.call_count,
                      len(simulate_future_prices.return_value))
 def generate_simulated_prices_for_market_simulation(self, event):
     assert isinstance(event, MarketSimulation.Created)
     market_simulation = self.market_simulation_repo[event.entity_id]
     market_calibration = self.market_calibration_repo[
         event.market_calibration_id]
     for simulated_price in generate_simulated_prices(
             market_simulation, market_calibration):
         self.simulated_price_repo[simulated_price.id] = simulated_price
 def generate_simulated_prices_for_market_simulation(self, event):
     assert isinstance(event, MarketSimulation.Created)
     market_simulation = self.market_simulation_repo[event.entity_id]
     market_calibration = self.market_calibration_repo[event.market_calibration_id]
     for simulated_price in generate_simulated_prices(market_simulation, market_calibration):
         self.simulated_price_repo[simulated_price.id] = simulated_price
 def test_generate_simulated_prices(self, simulate_future_prices, register_simuated_price):
     market_calibration = Mock(spec=MarketCalibration)
     market_simulation = Mock(spec=MarketSimulation)
     prices = generate_simulated_prices(market_simulation=market_simulation, market_calibration=market_calibration)
     prices = list(prices)
     self.assertEqual(register_simuated_price.call_count, len(simulate_future_prices.return_value))
 def generate_simulated_prices(self, event):
     # When a market simulation is created, generate and register all the simulated prices.
     assert isinstance(event, MarketSimulation.Created)
     market_simulation = self.market_simulation_repo[event.entity_id]
     market_calibration = self.market_calibration_repo[event.market_calibration_id]
     generate_simulated_prices(market_calibration, market_simulation)