Commit ef8b2c67 authored by 吕先亚's avatar 吕先亚

update

parent fe21fa89
...@@ -63,11 +63,11 @@ def get_fund_infos(datum: Datum = None): ...@@ -63,11 +63,11 @@ def get_fund_infos(datum: Datum = None):
@autowired(names={'combo': 'hold-report'}) @autowired(names={'combo': 'hold-report'})
def load_report(max_date=prev_workday(dt.date.today()), min_date=None, combo: RoboReportor = None): def load_report(max_date=None, min_date=None, combo: RoboReportor = None):
global cp, roi, risk global cp, roi, risk
datas = pd.DataFrame(combo.load_report(max_date=max_date, min_date=min_date)) datas = pd.DataFrame(combo.load_report(max_date=max_date, min_date=min_date))
datas.set_index('date', inplace=True) datas.set_index('date', inplace=True)
datas = datas['acc_av'] datas = datas['fund_av']
returns = round(datas.pct_change(), 5) returns = round(datas.pct_change(), 5)
roi = round(annual_return(returns) * 100, 2) roi = round(annual_return(returns) * 100, 2)
risk = round(annual_volatility(returns) * 100, 2) risk = round(annual_volatility(returns) * 100, 2)
...@@ -85,7 +85,7 @@ async def recommend(): ...@@ -85,7 +85,7 @@ async def recommend():
funds = json.loads(sig['portfolio']) funds = json.loads(sig['portfolio'])
rec_list = [] rec_list = []
portfolios = {'recomm_guid': REC_GID} portfolios = {'recomm_guid': REC_GID}
load_report(min_date=prev_workday(dt.date.today()) - relativedelta(years=1)) load_report(max_date=prev_workday(dt.date.today()), min_date=(dt.date.today()) - relativedelta(years=1))
data = {'recomm_guid': REC_GID, 'data_date': sig['create_time'].strftime('%Y-%m-%d'), data = {'recomm_guid': REC_GID, 'data_date': sig['create_time'].strftime('%Y-%m-%d'),
'funds': [{'weight': round(weight * 100), 'fund_id': id_ticker_map[key]['ftTicker']} for key, weight in 'funds': [{'weight': round(weight * 100), 'fund_id': id_ticker_map[key]['ftTicker']} for key, weight in
funds.items()], 'creat_date': sig['create_time'].strftime('%Y-%m-%d %H:%M:%S'), funds.items()], 'creat_date': sig['create_time'].strftime('%Y-%m-%d %H:%M:%S'),
......
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