1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-15 00:36:55 +08:00
This commit is contained in:
Yuchen Fang
2021-01-28 00:34:32 +08:00
committed by you-n-g
parent 7f9216dc90
commit bcadf47f32
37 changed files with 4604 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import numpy as np
from .base import Abs_Reward
class PPO_Reward(Abs_Reward):
"""The reward function defined in IJCAI 2020"""
def __init__(self, *args):
pass
def isinstant(self):
return False
def get_reward(self, performace_raise, ffr, this_tt_ratio, is_buy):
if is_buy:
this_tt_ratio = 1 / this_tt_ratio
if this_tt_ratio < 1:
return -1.0
elif this_tt_ratio < 1.1:
return 0.0
else:
return 1.0