mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-04 03:21:00 +08:00
48 lines
1.0 KiB
Python
48 lines
1.0 KiB
Python
# Copyright (c) Microsoft Corporation.
|
|
# Licensed under the MIT License.
|
|
|
|
|
|
class BaseInterpreter:
|
|
"""Base Interpreter"""
|
|
|
|
def interpret(**kwargs):
|
|
raise NotImplementedError("interpret is not implemented!")
|
|
|
|
|
|
class ActionInterpreter(BaseInterpreter):
|
|
"""Action Interpreter that interpret rl agent action into qlib orders"""
|
|
|
|
def interpret(action, **kwargs):
|
|
"""interpret method
|
|
|
|
Parameters
|
|
----------
|
|
action :
|
|
rl agent action
|
|
|
|
Returns
|
|
-------
|
|
qlib orders
|
|
|
|
"""
|
|
|
|
raise NotImplementedError("interpret is not implemented!")
|
|
|
|
|
|
class StateInterpreter(BaseInterpreter):
|
|
"""State Interpreter that interpret execution result of qlib executor into rl env state"""
|
|
|
|
def interpret(execute_result, **kwargs):
|
|
"""interpret method
|
|
|
|
Parameters
|
|
----------
|
|
execute_result :
|
|
qlib execution result
|
|
|
|
Returns
|
|
----------
|
|
rl env state
|
|
"""
|
|
raise NotImplementedError("interpret is not implemented!")
|