Commit c5fc0389 authored by 赵杰's avatar 赵杰

指数去重

parent 99f85f44
...@@ -35,7 +35,7 @@ class UserCustomerDataAdaptor: ...@@ -35,7 +35,7 @@ class UserCustomerDataAdaptor:
all_fund_distribution = {} all_fund_distribution = {}
all_fund_performance = {} all_fund_performance = {}
def __init__(self, user_id, customer_id, end_date=str(datetime.datetime.now()), index_id="IN0000007M"): def __init__(self, user_id, customer_id, end_date=str(datetime.datetime.now()), index_id="4000233"):
self.user_id = user_id self.user_id = user_id
self.customer_id = customer_id self.customer_id = customer_id
self.compare_index_id = index_id self.compare_index_id = index_id
...@@ -274,7 +274,7 @@ class UserCustomerDataAdaptor: ...@@ -274,7 +274,7 @@ class UserCustomerDataAdaptor:
tamp_product_session = tamp_product.session tamp_product_session = tamp_product.session
tamp_fund_session = tamp_fund.session tamp_fund_session = tamp_fund.session
now_date = datetime.datetime.now().strftime("%Y%m%d") now_date = datetime.datetime.now().strftime("%Y%m%d")
trade_date_df = self.get_trade_cal("20000101", now_date) trade_date_df = self.get_trade_cal("20050101", now_date)
self.trade_cal_date = trade_date_df self.trade_cal_date = trade_date_df
all_fund_nav = pd.DataFrame(index=trade_date_df["datetime"]) all_fund_nav = pd.DataFrame(index=trade_date_df["datetime"])
all_fund_cnav = pd.DataFrame(index=trade_date_df["datetime"]) all_fund_cnav = pd.DataFrame(index=trade_date_df["datetime"])
...@@ -369,11 +369,12 @@ class UserCustomerDataAdaptor: ...@@ -369,11 +369,12 @@ class UserCustomerDataAdaptor:
return all_fund_nav, all_fund_cnav return all_fund_nav, all_fund_cnav
# 获取客户对比指数净值数据 # 获取客户对比指数净值数据
def get_customer_index_nav_data(self, index_id="IN0000007M"): def get_customer_index_nav_data(self, index_id="4000233"):
with TAMP_SQL(tamp_product_engine) as tamp_product: with TAMP_SQL(tamp_fund_engine) as tamp_fund:
tamp_product_session = tamp_product.session tamp_fund_session = tamp_fund.session
sql = "select distinct price_date,close from fund_market_indexes where index_id='{}' order by price_date ASC".format(index_id) sql = "select DISTINCT `price_date`, `close` from tx_fund_market_indexes where index_id='{}' order by price_date ASC".format(
cur = tamp_product_session.execute(sql) index_id)
cur = tamp_fund_session.execute(sql)
data = cur.fetchall() data = cur.fetchall()
index_df = pd.DataFrame(list(data), columns=['price_date', 'index']) index_df = pd.DataFrame(list(data), columns=['price_date', 'index'])
index_df["price_date"] = pd.to_datetime(index_df["price_date"]) index_df["price_date"] = pd.to_datetime(index_df["price_date"])
......
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