示例#1
0
 def get_action(self, observation: TradeObservation, sess=None) -> PolicyAction:
     self._sess = sess
     self._observation = observation
     if self._observation.current_value_high_pct > self._observation.limit_pct:
         return TradePolicyStopLossUpAction(parameter=self._observation.current_value_low_pct)
     if self._observation.current_value_low_pct > 0.1 * self._observation.limit_pct:
         return TradePolicySellAction()
     if self._observation.current_value_low_pct > self._observation.stop_loss_pct:
         return TradePolicyWaitAction()
     return TradePolicySellAction()
示例#2
0
 def __get_action_from_action_values__(action_val: list,
                                       obs: TradeObservation):
     stop_loss_pct_new = obs.stop_loss_pct + 1
     sell_action_active = True
     # print('action_val[0][0]={}'.format(action_val[0][0]))
     if sell_action_active:
         return TradePolicyWaitAction(
         ) if action_val[0][0] == 1 else TradePolicySellAction()
     else:
         return TradePolicyWaitAction(
         ) if action_val[0][0] == 0 else TradePolicyStopLossUpAction(
             parameter=stop_loss_pct_new)
示例#3
0
 def get_random_action():
     random_int = random.randint(0, 1)
     return TradePolicyWaitAction(
     ) if random_int == 0 else TradePolicySellAction()
示例#4
0
 def get_action(self, observation: TradeObservation, sess=None) -> PolicyAction:
     self._observation = observation
     if self._observation.current_tick_pct >= self._observation.forecast_ticks_to_positive_max_pct:
         if self._observation.current_value_high_pct >= self._observation.after_buy_max_pct:
             return TradePolicySellAction()
     return TradePolicyWaitAction()
示例#5
0
 def get_action(self, observation: TradeObservation, sess=None) -> PolicyAction:
     self._observation = observation
     if self._observation.current_value_high_pct >= self._observation.forecast_limit:
         return TradePolicySellAction()
     return TradePolicyWaitAction()
示例#6
0
 def get_action(self, observation: TradeObservation, sess=None) -> PolicyAction:
     self._observation = observation
     if self._observation.current_value_low_pct > self._threshold_pct:
         return TradePolicySellAction()
     return TradePolicyWaitAction()