当前位置: 首页>>代码示例>>Python>>正文


Python logger.info函数代码示例

本文整理汇总了Python中pyalgotrade.logger.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __threadMain

 def __threadMain(self):
     try:
         logger.info("Initializing client.")
         self.__stream.filter(track=self.__track, follow=self.__follow, languages=self.__languages)
     finally:
         logger.info("Client finished.")
         self.__running = False
开发者ID:Henry-Yan-Duke,项目名称:pyalgotrade,代码行数:7,代码来源:feed.py

示例2: dispatchImpl

    def dispatchImpl(self, eventFilter):
        try:
            eventType, eventData = self.__queue.get(True, Client.QUEUE_TIMEOUT)
            if eventFilter is not None and eventType not in eventFilter:
                return

            if eventType == WSClient.ON_TICKER:
                self.__tickerEvent.emit(eventData)
            elif eventType == WSClient.ON_TRADE:
                self.__tradeEvent.emit(eventData)
            elif eventType == WSClient.ON_USER_ORDER:
                self.__userOrderEvent.emit(eventData)
            elif eventType == WSClient.ON_RESULT:
                requestId, result = eventData
                logger.info("Result: %s - %s" % (requestId, result))
            elif eventType == WSClient.ON_REMARK:
                requestId, data = eventData
                logger.info("Remark: %s - %s" % (requestId, data))
            elif eventType == WSClient.ON_CONNECTED:
                self.__onConnected()
            elif eventType == WSClient.ON_DISCONNECTED:
                self.__onDisconnected()
            else:
                logger.error("Invalid event received to dispatch: %s - %s" % (eventType, eventData))
        except Queue.Empty:
            pass
开发者ID:akkineniramesh,项目名称:pyalgotrade,代码行数:26,代码来源:client.py

示例3: update_bars

def update_bars(dbFilePath, symbolsFile, timezone, fromYear, toYear):
	db = sqlitefeed.Database(dbFilePath)
	for symbol in open(symbolsFile, "r"):
		symbol = symbol.strip()
		logger.info("Downloading %s bars" % (symbol))
		for year in range(fromYear, toYear+1):
			download_bars(db, symbol, year, timezone)
开发者ID:Barcelons281,项目名称:pyalgotrade,代码行数:7,代码来源:update-db.py

示例4: stop

 def stop(self):
     try:
         if self.__thread is not None and self.__thread.is_alive():
             logger.info("Shutting down client.")
             self.__stream.disconnect()
     except Exception, e:
         logger.error("Error disconnecting stream: %s." % (str(e)))
开发者ID:Henry-Yan-Duke,项目名称:pyalgotrade,代码行数:7,代码来源:feed.py

示例5: build_feed

def build_feed(instruments, fromYear, toYear, storage, frequency=bar.Frequency.DAY, timezone=None, skipErrors=False):
    logger = pyalgotrade.logger.getLogger("yahoofinance")
    ret = yahoofeed.Feed(frequency, timezone)

    if not os.path.exists(storage):
        logger.info("Creating %s directory" % (storage))
        os.mkdir(storage)

    for year in range(fromYear, toYear+1):
        for instrument in instruments:
            fileName = os.path.join(storage, "%s-%d-yahoofinance.csv" % (instrument, year))
            if not os.path.exists(fileName):
                logger.info("Downloading %s %d to %s" % (instrument, year, fileName))
                try:
                    if frequency == bar.Frequency.DAY:
                        download_daily_bars(instrument, year, fileName)
                    elif frequency == bar.Frequency.WEEK:
                        download_weekly_bars(instrument, year, fileName)
                    else:
                        raise Exception("Invalid frequency")
                except Exception, e:
                    if skipErrors:
                        logger.error(str(e))
                        continue
                    else:
                        raise e
            ret.addBarsFromCSV(instrument, fileName)
开发者ID:arippbbc,项目名称:pyalgotrade,代码行数:27,代码来源:yahoofinance.py

示例6: OnRtnDepthMarketData

 def OnRtnDepthMarketData(self, *args):
     
     logger.info("OnRtnDepthMarketData")
     logger.info("id: "+args[0].InstrumentID)
     logger.info("TradingDay: " + args[0].TradingDay + " " + args[0].UpdateTime)
     logger.info("LastPrice: " + str(args[0].LastPrice))
     if self.__insertIntoMysql:
         if self.__mysqlCon == None:
             self.__mysqlCon = client.mysqlConnection(CONSTANTS.HOST,
                                                      CONSTANTS.USERNAME,
                                                      CONSTANTS.PASSWORD,
                                                      CONSTANTS.DATABASE)
         date = datetime.strptime(args[0].TradingDay, "%Y%m%d")
         dateStr = date.strftime("%Y-%m-%d")
         dateStr = dateStr + " " + args[0].UpdateTime
         self.__mysqlCon.addBar(args[0].InstrumentID,
                         RealTimeBar(dateStr,
                                     args[0].LastPrice,
                                     args[0].Volume))
     if self.__dumpToFile:
         try:
             self.dumpToFile(args[0])
         except Exception as e:
             print "except", e
     logger.info("OnRtnDepthMarketData End")
开发者ID:TimonPeng,项目名称:pi314,代码行数:25,代码来源:ctpClient.py

示例7: download_symbols

def download_symbols(market):
    market = market.upper()
    pages = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
    for x in pages:
        url = "http://www.eoddata.com/stocklist/%s/%s.htm" % (market, x)
        logger.info("Processing %s" % url)
        for symbol in get_symbols_from_page(url):
            yield symbol
开发者ID:tibkiss,项目名称:pyalgotrade,代码行数:8,代码来源:update-symbols.py

示例8: stop

 def stop(self):
     try:
         self.__stopped = True
         if self.__thread is not None and self.__thread.is_alive():
             logger.info("Shutting down MtGox client.")
             self.__wsClient.stopClient()
     except Exception, e:
         logger.error("Error shutting down MtGox client: %s" % (str(e)))
开发者ID:harsha550,项目名称:pyalgotrade,代码行数:8,代码来源:client.py

示例9: deleteDataFromDate

 def deleteDataFromDate(self, date):
     cursor = self.__con.cursor()
     query = "delete from data where date(date) >= '{0:s}' and date(date) <= '{0:s}'"
     query = query.format(date)
     logger.info(query)
     cursor.execute(query)
     self.__con.commit()
     cursor.close()
开发者ID:TimonPeng,项目名称:pi314,代码行数:8,代码来源:client.py

示例10: OnRspSubMarketData

 def OnRspSubMarketData(self, *args):
     logger.info("OnRspSubMarketData")
     if args:
         rspInfoField = args[1]
         logger.info("Subscribe Instrument " + args[0].InstrumentID)
         logger.info("errorID " + str(rspInfoField.ErrorID))
         logger.info("errorMsg " + str(rspInfoField.ErrorMsg))
     logger.info("OnRspSubMarketData End")
开发者ID:TimonPeng,项目名称:pi314,代码行数:8,代码来源:ctpClient.py

示例11: run

 def run(self):
     logger.info("Thread started")
     while not self.__stopped:
         self.__wait()
         if not self.__stopped:
             try:
                 self.doCall()
             except Exception, e:
                 logger.critical("Unhandled exception", exc_info=e)
开发者ID:darwinbeing,项目名称:pyalgotrade-mercadobitcoin,代码行数:9,代码来源:livefeed.py

示例12: build_feed

def build_feed(sourceCode, tableCodes, fromYear, toYear, storage, frequency=bar.Frequency.DAY, timezone=None, skipErrors=False, noAdjClose=False, authToken=None):
    """Build and load a :class:`pyalgotrade.barfeed.quandlfeed.Feed` using CSV files downloaded from Quandl.
    CSV files are downloaded if they haven't been downloaded before.

    :param sourceCode: The dataset source code.
    :type sourceCode: string.
    :param tableCodes: The dataset table codes.
    :type tableCodes: list.
    :param fromYear: The first year.
    :type fromYear: int.
    :param toYear: The last year.
    :type toYear: int.
    :param storage: The path were the files will be loaded from, or downloaded to.
    :type storage: string.
    :param frequency: The frequency of the bars. Only **pyalgotrade.bar.Frequency.DAY** or **pyalgotrade.bar.Frequency.WEEK**
        are supported.
    :param timezone: The default timezone to use to localize bars. Check :mod:`pyalgotrade.marketsession`.
    :type timezone: A pytz timezone.
    :param skipErrors: True to keep on loading/downloading files in case of errors.
    :type skipErrors: boolean.
    :param noAdjClose: True if the instruments don't have adjusted close values.
    :type noAdjClose: boolean.
    :param authToken: Optional. An authentication token needed if you're doing more than 50 calls per day.
    :type authToken: string.
    :rtype: :class:`pyalgotrade.barfeed.quandlfeed.Feed`.
    """

    logger = pyalgotrade.logger.getLogger("quandl")
    ret = quandlfeed.Feed(frequency, timezone)
    if noAdjClose:
        ret.setNoAdjClose()

    if not os.path.exists(storage):
        logger.info("Creating %s directory" % (storage))
        os.mkdir(storage)

    for year in range(fromYear, toYear+1):
        for tableCode in tableCodes:
            fileName = os.path.join(storage, "%s-%s-%d-quandl.csv" % (sourceCode, tableCode, year))
            if not os.path.exists(fileName):
                logger.info("Downloading %s %d to %s" % (tableCode, year, fileName))
                try:
                    if frequency == bar.Frequency.DAY:
                        download_daily_bars(sourceCode, tableCode, year, fileName, authToken)
                    elif frequency == bar.Frequency.WEEK:
                        download_weekly_bars(sourceCode, tableCode, year, fileName, authToken)
                    else:
                        raise Exception("Invalid frequency")
                except Exception as e:
                    if skipErrors:
                        logger.error(str(e))
                        continue
                    else:
                        raise e
            ret.addBarsFromCSV(tableCode, fileName)
    return ret
开发者ID:WESTLIN,项目名称:PyAlgoTrade_DocCn,代码行数:56,代码来源:quandl.py

示例13: __onDisconnected

 def __onDisconnected(self):
     if self.__enableReconnection:
         initialized = False
         while not self.__stopped and not initialized:
             logger.info("Reconnecting")
             initialized = self.__initializeClient()
             if not initialized:
                 time.sleep(5)
     else:
         self.__stopped = True
开发者ID:TimonPeng,项目名称:pi314,代码行数:10,代码来源:client.py

示例14: OnFrontConnected

 def OnFrontConnected(self):
     logger.info("OnFrontConnected")
     f = CThostFtdcReqUserLoginField()
     f.BrokerID = self.__broker_id
     f.UserUD = self.__user_id
     f.Password = self.__password
     self.__md.ReqUserLogin(f, self.__reqNum)
     self.__reqNum = self.__reqNum + 1
     if (datetime.now() - self.__starttime) > timedelta(seconds=60*60*10):
         self.stopClient()
开发者ID:TimonPeng,项目名称:pi314,代码行数:10,代码来源:ctpClient.py

示例15: main

def main():
    try:
        writer = symbolsxml.Writer()
        for symbol in open("merval-symbols.txt", "r"):
            symbol = symbol.strip()
            process_symbol(writer, symbol)
        logger.info("Writing merval.xml")
        writer.write("merval.xml")
    except Exception, e:
        logger.error(str(e))
开发者ID:vdt,项目名称:pyalgotrade,代码行数:10,代码来源:get_merval_symbols.py


注:本文中的pyalgotrade.logger.info函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。