def download_stock(stock, download_latest=True, realtime_engine=settings.SINA, download_history=True, history_engine=settings.CSV_ENGINE, download_statistics=False): logger.info('Start download finance data:{}'.format(stock.code)) #download statistics from reuters if download_statistics: from stocktrace.parse.reutersparser import downloadKeyStatDatas downloadKeyStatDatas() #update latest price from yahoo or sina #Seems YQL API is not stable,tables often to be locked if download_latest: from stocktrace.parse.sinaparser import update update(stock.code, realtime_engine) if download_history: # #download history data from yahoo CSV or YDN from stocktrace.parse.yahooparser import download_history_data download_history_data(stock.code, save=True, begin_date='2012-01-01') if realtime_engine == settings.SINA and history_engine == settings.CSV_ENGINE: from stocktrace.dao.stockdao import update_week52 update_week52(stock.code) logger.info('Finish download finance data:{}'.format(stock.code))
def download_stock(self, download_latest=True, realtime_engine='sina', download_history=True, history_engine='csv', download_statistics=False): # logger.info('Start download finance data:{}'.format(stock.code)) #download statistics from reuters if download_statistics: from stocktrace.parse.reutersparser import downloadKeyStatDatas downloadKeyStatDatas() #update latest price from yahoo or sina #Seems YQL API is not stable,tables often to be locked if download_latest: from stocktrace.parse.sinaparser import update update(self.code, realtime_engine) if download_history: # #download history data from yahoo CSV or YDN from stocktrace.parse.yahooparser import download_history_data download_history_data(self.code, save=True, begin_date='2012-01-01') if realtime_engine == 'sina' and history_engine == 'csv': from stocktrace.dao.stockdao import update_week52 update_week52(self.code)
def download(clearAll=False, downloadLatest=False, downloadHistory=False, parse_industry=False, stockList='stock_list_all'): from stocktrace.parse.yahooparser import downloadHistoryData from stocktrace.dao.stockdao import clear, findAllExistentTickers from stocktrace.parse.reutersparser import downloadKeyStatDatas from stocktrace.parse.sinaparser import downloadLatestData from stocktrace.parse.ifengparser import parseIndustry from stocktrace.redis.redisservice import findStocksByList logger.info('***Start download finance data****') if clearAll: #clear redis cache # redclient.flushall() clear() #download industry info from ifeng if parse_industry: parseIndustry() #download securities list from local downloadQuoteList(True, False, stockList) #load stock list to redis zset loadStockListToRedis(stockList) #download statistics from reuters if settings.DOWNLOAD_KEY_STAT: downloadKeyStatDatas() quotes = findAllExistentTickers() #find from redis cache # quotes = findStocksByList(stockList) # quotes = stockList logger.debug(quotes) #update latest price from yahoo or sina #Seems YQL API is not stable,tables often to be locked if downloadLatest: downloadLatestData(quotes, engine=settings.SINA) if downloadHistory: #download history data from yahoo downloadHistoryData(quotes, engine=settings.CSV_ENGINE) logger.info('***Finish download finance data****')
def download(clearAll= False,downloadLatest = False,downloadHistory = False,parse_industry = False,stockList='stock_list_all'): from stocktrace.parse.yahooparser import downloadHistoryData from stocktrace.dao.stockdao import clear,findAllExistentTickers from stocktrace.parse.reutersparser import downloadKeyStatDatas from stocktrace.parse.sinaparser import downloadLatestData from stocktrace.parse.ifengparser import parseIndustry from stocktrace.redis.redisservice import findStocksByList logger.info('***Start download finance data****') if clearAll: #clear redis cache # redclient.flushall() clear(); #download industry info from ifeng if parse_industry: parseIndustry() #download securities list from local downloadQuoteList(True,False,stockList) #load stock list to redis zset loadStockListToRedis(stockList) #download statistics from reuters if settings.DOWNLOAD_KEY_STAT: downloadKeyStatDatas() quotes = findAllExistentTickers() #find from redis cache # quotes = findStocksByList(stockList) # quotes = stockList logger.debug(quotes) #update latest price from yahoo or sina #Seems YQL API is not stable,tables often to be locked if downloadLatest: downloadLatestData(quotes,engine = settings.SINA) if downloadHistory: #download history data from yahoo downloadHistoryData(quotes,engine = settings.CSV_ENGINE) logger.info('***Finish download finance data****')