示例#1
0
 def test_run_single_call_start_and_terminate(self):
     simulator = Simulator()
     simulator.start = MagicMock()
     simulator.initialize = MagicMock()
     simulator.terminate = MagicMock()
     simulator.operator = MagicMock()
     simulator.operator.state = "terminated"
     simulator.run_single()
     simulator.start.assert_called()
     simulator.initialize.assert_called()
     simulator.terminate.assert_called()
示例#2
0
    def test_ITG_run_single_simulation(self, mock_print):
        budget = 100000
        interval = 0.01
        from_dash_to = "200430.055000-200430.073000"
        simulator = Simulator(
            budget=1000000,
            interval=interval,
            strategy=0,
            from_dash_to=from_dash_to,
            currency="BTC",
        )

        simulator.run_single()
        self.assertEqual(mock_print.call_args[0][0], "Good Bye~")