def get_all_trade_days(conn):
s =("""select distinct trade_days from asharecalendar order by trade_days""")
all_trade_days = sql.read_sql(s,conn)
all_trade_days = all_trade_days.TRADE_DAYS.values.tolist()
return all_trade_days
def get_price(conn,test_stock, start_date, end_date,fields):
fields = ','.join(fields)
s =("""select %s from aindexeodprices """
"""where s_info_windcode = '%s' and trade_dt between %s and %s order by trade_dt asc"""
% (fields,test_stock,start_date,end_date))
price = sql.read_sql(s,conn)
return price
网友评论