def _cache_monthly(self, date):
'''
??date???????????????True
:param code:
:param ktype:
:param date:
:return:
'''
print 'caching...'
start, end = self._get_date_range_of_month(date, 'str')
df = ts.get_hist_data(code=self.code, ktype=self.ktype, start=start, end=end, retry_count=6)
if df is not None:
df.to_csv(self._get_cache_filename(date))
waiting_seconds = 0
while not self._in_cache(date=date):
sleep(1)
waiting_seconds += 1
if waiting_seconds > 30:
self._cache_monthly(date=date)
return True
评论列表
文章目录