Commit 336d41ba authored by 赵杰's avatar 赵杰

fund_name

parent 47358623
...@@ -324,7 +324,17 @@ def get_radar_data(fund): ...@@ -324,7 +324,17 @@ def get_radar_data(fund):
{'name': '综合评分', 'data': '%.2f' % total_score}]} {'name': '综合评分', 'data': '%.2f' % total_score}]}
def get_fund_name(fund): def get_fund_name(fund, fund_type=1):
if fund_type == 0:
with TAMP_SQL(tamp_fund_engine) as tamp_fund:
tamp_fund_session = tamp_fund.session
sql = "SELECT name FROM public_fund_basic WHERE ts_code='{}'".format(fund)
# df = pd.read_sql(sql, con)
cur = tamp_fund_session.execute(sql)
data = cur.fetchall()
df = pd.DataFrame(list(data), columns=['fund_short_name'])
return df
elif fund_type == 1 or fund_type == 2:
with TAMP_SQL(tamp_fund_engine) as tamp_fund: with TAMP_SQL(tamp_fund_engine) as tamp_fund:
tamp_fund_session = tamp_fund.session tamp_fund_session = tamp_fund.session
sql = "SELECT fund_short_name FROM fund_info WHERE id='{}'".format(fund) sql = "SELECT fund_short_name FROM fund_info WHERE id='{}'".format(fund)
...@@ -342,6 +352,15 @@ def get_fund_name(fund): ...@@ -342,6 +352,15 @@ def get_fund_name(fund):
df = pd.DataFrame(list(data), columns=['fund_short_name']) df = pd.DataFrame(list(data), columns=['fund_short_name'])
return df return df
return df return df
else:
with TAMP_SQL(tamp_fund_engine) as tamp_fund:
tamp_fund_session = tamp_fund.session
sql = "SELECT fund_name FROM ifa_imported_fund_info WHERE id='{}'".format(fund)
# df = pd.read_sql(sql, con)
cur = tamp_fund_session.execute(sql)
data = cur.fetchall()
df = pd.DataFrame(list(data), columns=['fund_short_name'])
return df
# 获取排名信息 # 获取排名信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment