Commit 5e71ed36 authored by 吕先亚's avatar 吕先亚

bugfix 回报日期不含当天

parent 2a4a64d6
......@@ -62,12 +62,12 @@ def judgement(id, type, predict):
start = parse_date(max_date) if max_date else prev_workday(datetime.today())
navs = []
if type == 'INDEX':
navs = get_index_list(index_ids=id, min_date=start, limit=predict_term)
navs = get_index_list(index_ids=id, min_date=start, limit=predict_term + 1)
navs = [nav['rid_close'] for nav in navs]
elif type == 'FUND':
navs = get_fund_list(fund_ids=id, min_date=start, limit=predict_term)
navs = get_fund_list(fund_ids=id, min_date=start, limit=predict_term + 1)
navs = [nav['rfn_nav_cal'] for nav in navs]
if len(navs) == predict_term:
if len(navs) == predict_term + 1:
upper = True if navs[-1] >= navs[0] else False
result = {}
for k, v, in predict.items():
......
......@@ -102,19 +102,18 @@ def is_right(id, type, start, predict):
predict_term = 21
navs = []
if type == 'INDEX':
navs = get_index_list(index_ids=id, min_date=start, limit=predict_term)
navs = get_index_list(index_ids=id, min_date=start, limit=predict_term + 1)
navs = [nav['rid_close'] for nav in navs]
elif type == 'FUND':
navs = get_fund_list(fund_ids=id, min_date=start, limit=predict_term)
navs = get_fund_list(fund_ids=id, min_date=start, limit=predict_term + 1)
navs = [nav['rfn_nav_cal'] for nav in navs]
if len(navs) == predict_term:
if len(navs) == predict_term + 1:
rtn = navs[-1] / navs[0] - 1
real = map_to_label(rtn)
result = True if predict == real or (rtn < 0 and predict < 0) or (rtn > 0 and predict > 0) else False
return result, round(rtn * 100, 2), real
return None, None, None
if __name__ == '__main__':
do_reporter2()
# sync()
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