1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-11 23:06:58 +08:00
This commit is contained in:
Yuchen Fang
2021-01-28 00:34:32 +08:00
parent 7f9216dc90
commit 98086e4fdc
37 changed files with 4604 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import numpy as np
class Abs_Reward(object):
"""The abstract class for Reward."""
def __init__(self, config):
return
def get_reward(self):
""":return: reward"""
reward = 0
return reward
def __call__(self, *args, **kargs):
return self.get_reward(*args, **kargs)
def isinstant(self):
""":return: Whether the reward should be given at every timestep or only at the end of this episode."""
raise NotImplementedError
class Instant_Reward(Abs_Reward):
def __init__(self, config):
self.ffr_ratio = config["ffr_ratio"]
self.vvr_ratio = config["vvr_ratio"]
def isinstant(self):
return True
class EndEpisode_Reward(Abs_Reward):
def __init__(self, config):
self.ffr_ratio = config["ffr_ratio"]
self.vvr_ratio = config["vvr_ratio"]
def isinstant(self):
return False