예제 #1
0
    def __init__(self, config):
        Environment._env = self
        self.config = config
        self._universe = None
        self.data_proxy = None
        self.data_source = None
        self.price_board = None
        self.event_source = None
        self.strategy_loader = None
        self.global_vars = None
        self.persist_provider = None
        self.persist_helper = None
        self.broker = None
        self.profile_deco = None
        self.system_log = system_log
        self.user_log = user_log
        self.user_detail_log = user_detail_log
        self.event_bus = EventBus()
        #self.portfolio = None
        self.portfolio = None
        self.booking = None
        self.benchmark_portfolio = None
        self.calendar_dt = None
        self.trading_dt = None
        self.mod_dict = None
        self.plot_store = None
        self.bar_dict = None
        self._frontend_validators = []
        self._account_model_dict = {}
        self._position_model_dict = {}
        self._transaction_cost_decider_dict = {}

        import MysqlTick.Loopback.mysqlTickCache as tickCache
        self.tickbase = tickCache.MysqlCache()
예제 #2
0
 def _current_bar_tick_price_decider(self, order_book_id, _):
     try:
         tickbase = tickCache.MysqlCache()
         price = tickbase.getLastTickPriceByEnvironment(order_book_id)
         return price  #zoulida
         #return self._env.bar_dict[order_book_id].price
     except (KeyError, TypeError):
         return 0
예제 #3
0
def init(context):
    logger.info("init")
    context.s1 = "600519.XSHG"
    context.cc = "600016.XSHG"
    update_universe(context.s1)
    # 是否已发送了order
    context.fired = False
    context.tickbase = tickCache.MysqlCache()

    global timeBeginStrategy
    timeBeginStrategy = datetime.datetime.now()
예제 #4
0
def init(context):
    logger.info("init")
    context.s1 = "600519.XSHG"
    context.cc = "600016.XSHG"
    update_universe(context.s1)
    # 是否已发送了order
    context.fired = False
    context.tickbase = tickCache.MysqlCache()

    import rqalpha.utilzld.mergeTicks as MT
    mt = MT.MergeTicks()
    mt.setBeginTime('11:29:59')
    mt.setEndTime('13:00:02')
    global timeBeginStrategy
    timeBeginStrategy = datetime.datetime.now()