Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
Q
Quant_API_SDK
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenwen.tang
Quant_API_SDK
Commits
5d137155
Commit
5d137155
authored
Jan 23, 2025
by
吕先亚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了最後推薦日last_recomm_date,若發現有新 推薦 ,但 推薦生成日(data_Date) 在最後推薦日(last_recomm_date)之後,也不發再平衡通知
parent
858fd29c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
8 deletions
+17
-8
test_case_exec.txt
test_case_exec.txt
+6
-0
gentestcase.py
test_case_gen/Sample/gentestcase.py
+2
-3
testcase_example.xlsx
test_case_gen/Sample/testcase_example.xlsx
+0
-0
sv_quant_api.py
vender/sv_quant_api.py
+9
-5
No files found.
test_case_exec.txt
View file @
5d137155
...
...
@@ -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_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
test_case_gen/Sample/gentestcase.py
View file @
5d137155
...
...
@@ -30,7 +30,7 @@ def main(xls_path):
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
[
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
=
[]
obj
[
'fas'
]
=
fas
...
...
@@ -62,7 +62,7 @@ def main(xls_path):
recomm
[
'rps'
]
=
[
rp
]
rp
[
'recomm_guid'
]
=
str
(
df
.
loc
[
0
][
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
])
fws
=
[]
rp
[
'fws'
]
=
fws
...
...
@@ -96,4 +96,3 @@ if __name__ == "__main__":
else
:
usage
()
test_case_gen/Sample/testcase_example.xlsx
View file @
5d137155
No preview for this file type
vender/sv_quant_api.py
View file @
5d137155
...
...
@@ -27,11 +27,15 @@ class Quant_api(base_Quant_api):
model_portfolio
=
self
.
get_latest_portfolio
(
pt
[
'recomm_id'
])
if
not
pt
.
get
(
'rp_id'
)
or
pt
.
get
(
'rp_id'
)
!=
model_portfolio
[
'rp_id'
]:
note
=
json
.
loads
(
pt
.
get
(
'note'
))
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'
)
# 如果推薦生成日data_Date在最後一次觸發再平衡时间之后,视为需要再平衡
if
(
not
pt
.
get
(
'last_recomm_date'
)
or
type
(
pt
.
get
(
'last_recomm_date'
))
!=
str
or
model_portfolio
[
'data_Date'
]
>=
pt
.
get
(
'last_recomm_date'
)
.
replace
(
'-'
,
''
)):
note
=
json
.
loads
(
model_portfolio
.
get
(
'note'
))
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
def
_dividend
(
self
,
pt
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment