コード例 #1
0
ファイル: stock.py プロジェクト: liushuchun/stocktrace
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))
コード例 #2
0
ファイル: stock.py プロジェクト: cfan0330github/stocktrace
    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)
コード例 #3
0
 def testDownload(self):
     from stocktrace.parse.yahooparser import download_history_data
     from stocktrace.util import settings
     download_history_data('600327', engine=settings.CSV_ENGINE)
     from datetime import date
     from datetime import timedelta
     print date.today()
     delta = timedelta(-1)
     begin = date.today() + delta
     print begin
コード例 #4
0
ファイル: parsetest.py プロジェクト: rainly/stocktrace
 def testDownload(self):
     from stocktrace.parse.yahooparser import download_history_data
     from stocktrace.util import settings
     download_history_data('600327',engine =  settings.CSV_ENGINE)
     from datetime import date
     from datetime import timedelta
     print date.today()
     delta = timedelta(-1)
     begin = date.today()+delta
     print begin
コード例 #5
0
ファイル: yahoo_test.py プロジェクト: mirroam/stocktrace
 def test_yahoo_csv(self):
     download_history_data(self.code, True)
コード例 #6
0
ファイル: yahoo_test.py プロジェクト: mirroam/stocktrace
 def test_poll_ydn(self):
     download_history_data(self.code, True, engine='ydn')
コード例 #7
0
 def test_yahoo_csv(self):
     download_history_data(self.code,True)
コード例 #8
0
 def test_poll_ydn(self):
     download_history_data(self.code,True,engine = 'ydn')