Example #1
0
 def __init_ledger(self):
     ledger_location = pyyjj.location(pyyjj.get_mode_by_name(self.ctx.mode), pyyjj.category.SYSTEM, 'service', 'ledger', self.ctx.locator)
     self.ctx.ledger_db = LedgerDB(ledger_location, "ledger")
     self.ctx.inst_infos = { inst["instrument_id"]: inst for inst in self.ctx.ledger_db.all_instrument_infos() }
     self.ctx.ledger = self.ctx.ledger_db.load(ctx=self.ctx,ledger_category=LedgerCategory.Portfolio, client_id=self.ctx.name)
     if self.ctx.ledger is None:
         self.ctx.ledger = AccountBook(self.ctx, ledger_category=LedgerCategory.Portfolio,client_id=self.ctx.name, avail=1e7, trading_day=self.ctx.trading_day)
Example #2
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 #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_ledger(self):
     ledger_location = pyyjj.location(pyyjj.get_mode_by_name(self.ctx.mode),
                                      pyyjj.category.SYSTEM, 'service',
                                      'ledger', self.ctx.locator)
     self.ctx.ledger_db = LedgerDB(ledger_location, "ledger")
     self.ctx.inst_infos = {
         inst["instrument_id"]: inst
         for inst in self.ctx.ledger_db.all_instrument_infos()
     }
     book_tags = AccountBookTags(ledger_category=LedgerCategory.Portfolio,
                                 client_id=self.ctx.name)
     self.ctx.book = self.ctx.ledger_db.load(ctx=self.ctx,
                                             book_tags=book_tags)
     if self.ctx.book is None:
         self.ctx.book = AccountBook(self.ctx, tags=book_tags, avail=1e7)