Example #1
0
 def __init__(self, ctx):
     pywingchun.Ledger.__init__(self, ctx.locator, ctx.mode, ctx.low_latency)
     self.ctx = ctx
     self.ctx.ledger = self
     self.ctx.logger = create_logger("ledger", ctx.log_level, self.io_device.home)
     self.ctx.calendar = Calendar(ctx)
     self.ctx.db = LedgerDB(self.io_device.home, ctx.name)
     self.ctx.inst_infos = {}
     self.ctx.orders = {}
     self.ctx.trading_day = None
     self.ctx.ledgers = {}
     self.ctx.get_inst_info = self.get_inst_info
Example #2
0
    def __init__(self, ctx):
        pyyjj.master.__init__(self, pyyjj.location(kfj.MODES['live'], kfj.CATEGORIES['system'], 'master', 'master', ctx.locator), ctx.low_latency)
        self.ctx = ctx
        self.ctx.master = self
        self.ctx.logger = create_logger("watcher", ctx.log_level, self.io_device.home)
        self.ctx.apprentices = {}

        ctx.calendar = Calendar(ctx)
        ctx.trading_day = ctx.calendar.trading_day
        self.publish_time(yjj_msg.TradingDay, ctx.calendar.trading_day_ns)

        ctx.master = self

        os_signal.handle_os_signals(self.exit_gracefully)
Example #3
0
    def __init__(self, ctx):
        pywingchun.Ledger.__init__(self, ctx.locator, ctx.mode,
                                   ctx.low_latency)
        self.ctx = ctx
        self.ctx.logger = create_logger("ledger", ctx.log_level,
                                        self.io_device.home)
        self.ctx.calendar = Calendar(ctx)
        self.ctx.db = LedgerDB(self.io_device.home, ctx.name)
        self.ctx.orders = {}

        self.trading_day = None
        self.accounts = {}
        self.subportfolios = {}
        self.portfolios = {}
Example #4
0
    def __init__(self, ctx):
        pyyjj.master.__init__(
            self,
            pyyjj.location(kfj.MODES['live'], kfj.CATEGORIES['system'],
                           'master', 'master', ctx.locator), ctx.low_latency)
        self.ctx = ctx
        self.ctx.master = self
        self.ctx.logger = create_logger("watcher", ctx.log_level,
                                        self.io_device.home)
        self.ctx.apprentices = {}

        # calendar_db_location = pyyjj.location(pyyjj.mode.LIVE, pyyjj.category.SYSTEM, 'etc', 'kungfu', ctx.locator)
        # ctx.calendar = pywingchun.Calendar(ctx.locator.layout_file(calendar_db_location, pyyjj.layout.SQLITE, 'holidays'))
        # ctx.current_trading_day = ctx.calendar.current_trading_day()
        ctx.calendar = Calendar(ctx)
        ctx.current_trading_day = ctx.calendar.current_trading_day()

        os_signal.handle_os_signals(self.exit_gracefully)