Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
R
robo-dividend
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
robo-dividend
Commits
3a0901a9
Commit
3a0901a9
authored
Sep 06, 2024
by
吕先亚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加准确率统计
parent
55052eb1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
2 deletions
+49
-2
reporter.py
ai/reporter.py
+49
-2
No files found.
ai/reporter.py
View file @
3a0901a9
...
...
@@ -3,10 +3,12 @@ import json
import
pandas
as
pd
import
requests
from
py_jftech
import
format_date
from
ai.config
import
LABEL_TAG
from
ai.EstimateMarketTrendV20
import
sync
from
ai.config
import
LABEL_TAG
,
LABEL_RANGE
from
ai.dao
import
robo_predict
from
ai.dao.robo_datas
import
get_base_info
from
ai.dao.robo_datas
import
get_base_info
,
get_index_list
,
get_fund_list
symbols
=
[
'ACWI'
,
'EWJ'
,
'MCHI'
,
'EEM'
,
'BKF'
,
'INDA'
,
'AAXJ'
,
'VGK'
,
'QQQ'
,
'SPY'
,
'SPX'
,
'IWN'
,
'IUSG'
,
'IWD'
,
'DON'
,
'GDX'
,
'TOLZ'
,
'XLU'
,
'XBI'
,
'ESGD'
,
'IGE'
,
'EMLC'
,
'IGAA'
,
...
...
@@ -52,5 +54,50 @@ def do_reporter2():
pf
.
to_excel
(
"Forcast_Report.xlsx"
,
index
=
False
)
def
map_to_label
(
ret
):
for
label
,
(
lower
,
upper
)
in
LABEL_RANGE
.
items
():
if
float
(
lower
)
<=
ret
<
float
(
upper
):
return
label
def
is_right
(
id
,
type
,
start
,
predict
):
from
datetime
import
datetime
predict_term
=
21
navs
=
[]
if
type
==
'INDEX'
:
navs
=
get_index_list
(
index_ids
=
id
,
min_date
=
start
,
limit
=
predict_term
)
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
=
[
nav
[
'rfn_nav_cal'
]
for
nav
in
navs
]
if
len
(
navs
)
==
predict_term
:
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
return
None
def
statistics
():
datas
=
[]
index_info
=
get_base_info
()
info
=
{
x
[
'id'
]:
x
for
x
in
index_info
}
records
=
robo_predict
.
get_list
()
for
item
in
records
:
result
=
is_right
(
item
[
'rbd_id'
],
info
.
get
(
item
[
'rbd_id'
])[
'type'
],
item
[
'date'
],
item
[
'predict'
])
data
=
{
'Forcast On Date'
:
format_date
(
item
[
'date'
]),
'Ticker'
:
info
.
get
(
item
[
'rbd_id'
])[
'ticker'
]
.
replace
(
' Index'
,
''
)
.
replace
(
' Equity'
,
''
),
'In 21 business days'
:
LABEL_TAG
.
get
(
item
[
'predict'
]),
'Ticker Name'
:
json
.
loads
(
info
.
get
(
item
[
'rbd_id'
])[
'datas'
])[
'chineseName'
],
'result'
:
result
}
datas
.
append
(
data
)
pf
=
pd
.
DataFrame
(
datas
)
pf
.
to_excel
(
"result.xlsx"
,
index
=
False
)
if
__name__
==
'__main__'
:
do_reporter2
()
# sync()
# statistics()
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