Exemple #1
0
    def initialize_Function(self):
        self.log.notset(__name__ + '::initialize_Function')
        self.log.info('IBridgePy version %s' % (self.versionNumber, ))
        self.log.info('fileName = %s' % (self.fileName, ))
        self.qData = QDataClass(self)
        self.request_data(ReqData.reqIds())
        self.request_data(ReqData.reqCurrentTime())
        if self.multiAccountFlag:
            self.request_data(ReqData.reqAccountSummary(),
                              ReqData.reqAllOpenOrders(),
                              ReqData.reqPositions())
        else:
            self.request_data(
                ReqData.reqAccountUpdates(True, self.accountCode),
                ReqData.reqAllOpenOrders(), ReqData.reqPositions())

        self.log.debug(
            __name__ +
            '::initialize_Function::start to run customers init function')
        self.initialize_quantopian(
            self.context)  # function name was passed in.

        self.log.info('####    Starting to initialize trader    ####')
        if self.multiAccountFlag:
            for acctCode in self.accountCode:
                self.display_all(acctCode)
        else:
            self.display_all()
        self.log.info('####    Initialize trader COMPLETED    ####')
Exemple #2
0
    def initialize_Function(self):
        self.log.notset(__name__ + '::initialize_Function')
        self.log.info('IBridgePy version %s' % (str(self.versionNumber), ))
        self.qData = QDataClass(self)
        self.request_data(ReqData.reqPositions(), ReqData.reqCurrentTime(),
                          ReqData.reqIds())
        self.request_data(ReqData.reqAccountUpdates(True, self.accountCode),
                          ReqData.reqAllOpenOrders())

        self.initialize_quantopian(
            self.context)  # function name was passed in.

        self.log.info('####    Starting to initialize trader    ####')
        if type(self.accountCode) == type(''):
            self.display_all()
        else:
            for acctCode in self.accountCode:
                self.display_all(acctCode)
        self.log.info('####    Initialize trader COMPLETED    ####')
        if self.before_trading_start_quantopian != None:
            self.schedule_function(
                func=self.before_trading_start_quantopian,
                time_rule=time_rules.market_open(minutes=-10),
                calendar=calendars.US_EQUITIES)
        tmp = self.get_datetime()
        self.check_date_rules(tmp)
        self.stime_previous = tmp
    def initialize_Function(self):
        self.log.notset(__name__+'::initialize_Function')
        self.log.info('IBridgePy version %s' %(self.versionNumber,))
        self.log.info('fileName = %s' %(self.fileName,))
        self.qData=QDataClass(self)
        self.request_data(ReqData.reqCurrentTime(), ReqData.reqIds())
        self.request_data(ReqData.reqAccountUpdates(True, self.accountCode),
                          ReqData.reqAllOpenOrders(),
                          ReqData.reqPositions())

        self.log.debug(__name__+'::initialize_Function::start to run customers init function')                 
        self.initialize_quantopian(self.context) # function name was passed in.
        self.log.info('####    Starting to initialize trader    ####')  
        if type(self.accountCode)==type(''):            
            self.display_all()
        else:
            for acctCode in self.accountCode:
                self.display_all(acctCode)
        self.log.info('####    Initialize trader COMPLETED    ####') 
         
        # In order to trigger check_date_rule in marketManagerBase.py
        # self.stime_previous.date != timeNow.date
        # So, minus 1 day here.
        self.stime_previous = self.get_datetime() - dt.timedelta(days=1)