def _update(stock,begin, conn):
print "update ----- :", stock
try:
df = ts.get_h_data(stock, start=begin, retry_count=5, pause=1)
if len(df) != 0:
print df.head(2)
df[['open', 'high', 'close', 'low', 'volume']].to_sql(stock, conn, if_exists='append')
import time
time.sleep(10)
except Exception, arg:
print "exception:", stock, arg
raise SystemExit(-1)
#errorlist.append(stock)
评论列表
文章目录