mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-02 10:31:00 +08:00
28 lines
613 B
Python
28 lines
613 B
Python
import numpy as np
|
|
from gym.spaces import Discrete, Box, Tuple, MultiDiscrete
|
|
|
|
from .base import Base_Action
|
|
|
|
|
|
class Static_Action(Base_Action):
|
|
""" """
|
|
|
|
def __init__(self, config):
|
|
self.action_num = config["action_num"]
|
|
self.action_map = config["action_map"]
|
|
|
|
def get_space(self):
|
|
""" """
|
|
return Discrete(self.action_num)
|
|
|
|
def get_action(self, action, target, position, **kargs):
|
|
"""
|
|
|
|
:param action:
|
|
:param position:
|
|
:param target:
|
|
:param **kargs:
|
|
|
|
"""
|
|
return min(target * self.action_map[action], position)
|