def __init__(self, symbol, managerager, HH2, HH1, LL1, LL2): StrategyBase.__init__(self, symbol, "StrategyGrid", managerager) self.TAG = "StrategyGrid" self.FLOW_GAP_BAR = 3 self.MAX_HOLD = 100 self.HH2 = HH2 self.HH1 = HH1 self.LL1 = LL1 self.LL2 = LL2 self.run_flag = True self.h_break_flag = False self.l_break_flag = False self.cur_price_flag = 0 self.price_immediate = False self.H2_breakout_flag = False self.H2_breakout_index = 0 self.L2_breakout_flag = False self.L2_breakout_index = 0 self.mark_bar = 0 self.report_flag = 0 self.STD_CHECHSUM = 5 print("[%s] runing............" % (self.TAG)) print("[%s] hh2=%d hh1=%d ll1=%d ll2=%d" % (self.TAG, self.HH2, self.HH1, self.LL1, self.LL2))
def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name) # loads score chart from file self.score_chart = scorechart.from_file( Config.get_instance().get(Config.SCORECHART_FILE) )
def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name) # uses score chart to determine best response self.score_chart = scorechart.from_file( Config.get_instance().get(Config.SCORECHART_FILE) )
def __init__(self, symbol, manager): StrategyBase.__init__(self, symbol, "StrategyAvgCross", manager) self.MAX_HOLD = 159 self.interval_bar = 20 self.cross_avg_run_flag = 0 self.total_bars_inday = 4 * 60 - 15 self.short_term = 10 self.long_term = 30 self.init_crs_downs = 0 self.init_crs_overs = 0 self.trade_dir = TradeDirection.BUYSELL self.TAG = "StrategyAvgCross" #=============================================# self.lastday_bar = 2 self.hh_20 = 0 self.ll_20 = 0 self.to_hh_20_bar = 0 self.to_ll_20_bar = 0 self.d_hh_3 = 0 self.d_hh_3_bar = 0 self.d_ll_3 = 0 self.d_ll_3_bar = 0 self.last_crossdown_bar = 999 self.last_crossover_bar = 999 print("[%s] runing............" % (self.TAG))
def __init__(self, strategy_name): """ Initializes epsilon-greedy strategy selection method """ StrategyBase.__init__(self, strategy_name) self.result_list = [] self.match_list = [] self.s_id = None self.epsilon = Config.get_instance().egreedy_exploration
def loss_happend(self, t_dir, loss_p): StrategyBase.loss_happend(self, t_dir, loss_p) self.debug("loss hanpend t_dir=%d loss_money=%d" % (t_dir, loss_p)) if (abs(loss_p) > 19 and t_dir > 0): self.LL1 = self.LL2 - 10 self.LL2 = self.LL1 - 25 self.trade_dir = TradeDirection.SELLONLY elif (abs(loss_p) > 19 and t_dir < 0): self.HH1 = self.HH2 + 10 self.HH2 = self.HH1 + 25 self.trade_dir = TradeDirection.BUYONLY
def __init__(self, strategy_name): """ Initializes UCB1 strategy selection method """ StrategyBase.__init__(self, strategy_name) self.formula = self.ucb1 # overrides bot_list with bandit choices self.bot_list = Config.get_instance().get_bandit_choices() self.data = {choice: {'trials': 0, 'sum': 0, 'sum_of_squares': 0} for choice in self.bot_list}
def __init__(self, strategy_name): """ Initializes Exp3 """ StrategyBase.__init__(self, strategy_name) # overrides bot_list with bandit choices self.bot_list = Config.get_instance().get_bandit_choices() self.gamma = Config.get_instance().exp3_gamma self.alpha = 1 #self.weights = {choice: 1.0 for choice in self.bot_list} self.weights = {choice: 0.0 for choice in self.bot_list}
def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name) self.result_list = [] self.match_list = [] config = Config.get_instance() # read score chart from a file self.score_chart = scorechart.from_file( config.get(Config.SCORECHART_FILE)) # get weights self.regrets = config.get(Config.INITIAL_REGRETS)
def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name) self.result_list = [] self.match_list = [] config = Config.get_instance() # read score chart from a file self.score_chart = scorechart.from_file( config.get(Config.SCORECHART_FILE) ) # get weights self.regrets = config.get(Config.INITIAL_REGRETS)
def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name)
def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name) self.result_list = [] self.match_list = [] self.s_id = None pass