MCPcopy
hub / github.com/microsoft/qlib / test_interpreter

Function test_interpreter

tests/rl/test_qlib_simulator.py:181–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

179
180@python_version_request
181def test_interpreter() -> None:
182 NUM_EXECUTION = 3
183 order = get_order()
184 simulator = get_simulator(order)
185 interpreter_action = CategoricalActionInterpreter(values=NUM_EXECUTION)
186
187 NUM_STEPS = 7
188 state = simulator.get_state()
189 position_history = []
190 for i in range(NUM_STEPS):
191 simulator.step(interpreter_action(state, 1))
192 state = simulator.get_state()
193 position_history.append(state.position)
194
195 assert position_history[-1] == max(TOTAL_POSITION - TOTAL_POSITION / NUM_EXECUTION * (i + 1), 0.0)

Callers

nothing calls this directly

Calls 5

get_orderFunction · 0.85
get_simulatorFunction · 0.85
get_stateMethod · 0.45
stepMethod · 0.45

Tested by

no test coverage detected