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

增加了最後推薦日last_recomm_date,若發現有新 推薦 ,但 推薦生成日(data_Date) 在最後推薦日(last_recomm_date)之後,也不發再平衡通知

parent 858fd29c
...@@ -4,4 +4,10 @@ python test_case_gen\Sample\gentestcase.py test_case_gen\Sample\testcase_example ...@@ -4,4 +4,10 @@ python test_case_gen\Sample\gentestcase.py test_case_gen\Sample\testcase_example
执行测试用例: 执行测试用例:
python reb_test.py sv test TEST_CASE_1_portfolio.json TEST_CASE_1_recomm.json test_data\class.json test_data\record_portfolio.json 20230812
python reb_test.py sv test TEST_CASE_2_portfolio.json TEST_CASE_2_recomm.json test_data\class.json test_data\record_portfolio.json 20230812
python reb_test.py sv test TEST_CASE_3_portfolio.json TEST_CASE_3_recomm.json test_data\class.json test_data\record_portfolio.json 20230812
python reb_test.py sv test TEST_CASE_4_portfolio.json TEST_CASE_4_recomm.json test_data\class.json test_data\record_portfolio.json 20230812 python reb_test.py sv test TEST_CASE_4_portfolio.json TEST_CASE_4_recomm.json test_data\class.json test_data\record_portfolio.json 20230812
python reb_test.py sv test TEST_CASE_5_portfolio.json TEST_CASE_5_recomm.json test_data\class.json test_data\record_portfolio.json 20230812
python reb_test.py sv test TEST_CASE_6_portfolio.json TEST_CASE_6_recomm.json test_data\class.json test_data\record_portfolio.json 20230812
python reb_test.py sv test TEST_CASE_7_portfolio.json TEST_CASE_7_recomm.json test_data\class.json test_data\record_portfolio.json 20230812
...@@ -30,7 +30,7 @@ def main(xls_path): ...@@ -30,7 +30,7 @@ def main(xls_path):
obj['create_date'] = df.loc[5][2] obj['create_date'] = df.loc[5][2]
if str(df.loc[6][2]) != 'nan': obj['last_check_date'] = df.loc[6][2] if str(df.loc[6][2]) != 'nan': obj['last_check_date'] = df.loc[6][2]
if str(df.loc[7][2]) != 'nan': obj['last_reb_date'] = df.loc[7][2] if str(df.loc[7][2]) != 'nan': obj['last_reb_date'] = df.loc[7][2]
obj['note'] = str(df.loc[8][2]) #obj['note'] = str(df.loc[8][2])
fas = [] fas = []
obj['fas'] = fas obj['fas'] = fas
...@@ -62,7 +62,7 @@ def main(xls_path): ...@@ -62,7 +62,7 @@ def main(xls_path):
recomm['rps'] = [rp] recomm['rps'] = [rp]
rp['recomm_guid'] = str(df.loc[0][9]) rp['recomm_guid'] = str(df.loc[0][9])
rp['rp_id'] = df.loc[1][9] rp['rp_id'] = df.loc[1][9]
rp['note'] = str(df.loc[8][2]) rp['note'] = str(df.loc[8][8])
rp['data_Date'] = str(df.loc[9][2]) rp['data_Date'] = str(df.loc[9][2])
fws = [] fws = []
rp['fws'] = fws rp['fws'] = fws
...@@ -96,4 +96,3 @@ if __name__ == "__main__": ...@@ -96,4 +96,3 @@ if __name__ == "__main__":
else: else:
usage() usage()
...@@ -27,11 +27,15 @@ class Quant_api(base_Quant_api): ...@@ -27,11 +27,15 @@ class Quant_api(base_Quant_api):
model_portfolio = self.get_latest_portfolio(pt['recomm_id']) model_portfolio = self.get_latest_portfolio(pt['recomm_id'])
if not pt.get('rp_id') or pt.get('rp_id') != model_portfolio['rp_id']: if not pt.get('rp_id') or pt.get('rp_id') != model_portfolio['rp_id']:
note = json.loads(pt.get('note')) # 如果推薦生成日data_Date在最後一次觸發再平衡时间之后,视为需要再平衡
if not note.get('recomm_reason'): if (not pt.get('last_recomm_date') or type(pt.get('last_recomm_date')) != str or
raise RuntimeError('未輸入推薦理由') model_portfolio['data_Date'] >= pt.get('last_recomm_date').replace('-', '')):
return model_portfolio.get('rp_id'), '月初調倉日', last_busi_date(model_portfolio['data_Date']), note.get( note = json.loads(model_portfolio.get('note'))
'recomm_reason') if not note.get('recomm_reason'):
raise RuntimeError('未輸入推薦理由')
return model_portfolio.get('rp_id'), '月初調倉日', last_busi_date(
model_portfolio['data_Date']), note.get(
'recomm_reason')
return 0 return 0
def _dividend(self, pt): def _dividend(self, pt):
......
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