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
ef7cb0cd
Commit
ef7cb0cd
authored
Jan 10, 2023
by
jichao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复业绩时间去值遇到节假日情况
parent
876fa964
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
fixed_range.py
reports/fixed_range.py
+5
-3
relative_range.py
reports/relative_range.py
+5
-4
No files found.
reports/fixed_range.py
View file @
ef7cb0cd
...
@@ -2,7 +2,7 @@ from datetime import datetime as dt
...
@@ -2,7 +2,7 @@ from datetime import datetime as dt
from
typing
import
List
from
typing
import
List
import
pandas
as
pd
import
pandas
as
pd
from
py_jftech
import
component
,
autowired
,
get_config
,
format_date
from
py_jftech
import
component
,
autowired
,
get_config
,
format_date
,
filter_weekend
from
api
import
RoboReportor
from
api
import
RoboReportor
...
@@ -29,8 +29,10 @@ class FixedRangeReport(RoboReportor):
...
@@ -29,8 +29,10 @@ class FixedRangeReport(RoboReportor):
if
not
datas
.
empty
:
if
not
datas
.
empty
:
result
=
pd
.
DataFrame
(
columns
=
datas
.
columns
)
result
=
pd
.
DataFrame
(
columns
=
datas
.
columns
)
for
range
in
self
.
range_dates
:
for
range
in
self
.
range_dates
:
row_name
=
f
"{format_date(range['start'])}~{format_date(range['end'])}"
start
=
filter_weekend
(
range
[
'start'
])
result
.
loc
[
row_name
]
=
datas
[
range
[
'start'
]:
range
[
'end'
]]
.
values
[
-
1
]
/
datas
[
range
[
'start'
]:
range
[
'end'
]]
.
values
[
0
]
-
1
end
=
filter_weekend
(
range
[
'end'
])
row_name
=
f
"{format_date(start)}~{format_date(end)}"
result
.
loc
[
row_name
]
=
datas
[
start
:
end
]
.
values
[
-
1
]
/
datas
[
start
:
end
]
.
values
[
0
]
-
1
result
=
round
(
result
,
4
)
*
100
result
=
round
(
result
,
4
)
*
100
result
.
reset_index
(
inplace
=
True
)
result
.
reset_index
(
inplace
=
True
)
result
.
rename
(
columns
=
{
'index'
:
'range-date'
},
inplace
=
True
)
result
.
rename
(
columns
=
{
'index'
:
'range-date'
},
inplace
=
True
)
...
...
reports/relative_range.py
View file @
ef7cb0cd
...
@@ -3,7 +3,7 @@ from typing import List
...
@@ -3,7 +3,7 @@ from typing import List
import
pandas
as
pd
import
pandas
as
pd
from
dateutil.relativedelta
import
relativedelta
from
dateutil.relativedelta
import
relativedelta
from
py_jftech
import
component
,
autowired
,
get_config
,
format_date
from
py_jftech
import
component
,
autowired
,
get_config
,
format_date
,
filter_weekend
from
api
import
RoboReportor
from
api
import
RoboReportor
...
@@ -32,9 +32,10 @@ class RelativeRangeReport(RoboReportor):
...
@@ -32,9 +32,10 @@ class RelativeRangeReport(RoboReportor):
for
range
in
self
.
range_dates
:
for
range
in
self
.
range_dates
:
kwargs
=
range
.
copy
()
kwargs
=
range
.
copy
()
del
kwargs
[
'name'
]
del
kwargs
[
'name'
]
start
=
max_date
-
relativedelta
(
**
kwargs
)
start
=
filter_weekend
(
max_date
-
relativedelta
(
**
kwargs
))
row_name
=
f
"{range['name']}({format_date(start)}~{format_date(max_date)})"
end
=
filter_weekend
(
max_date
)
result
.
loc
[
row_name
]
=
datas
[
start
:
max_date
]
.
values
[
-
1
]
/
datas
[
start
:
max_date
]
.
values
[
0
]
-
1
row_name
=
f
"{range['name']}({format_date(start)}~{format_date(end)})"
result
.
loc
[
row_name
]
=
datas
[
start
:
end
]
.
values
[
-
1
]
/
datas
[
start
:
end
]
.
values
[
0
]
-
1
result
=
round
(
result
,
4
)
*
100
result
=
round
(
result
,
4
)
*
100
result
.
reset_index
(
inplace
=
True
)
result
.
reset_index
(
inplace
=
True
)
result
.
rename
(
columns
=
{
'index'
:
'range-date'
},
inplace
=
True
)
result
.
rename
(
columns
=
{
'index'
:
'range-date'
},
inplace
=
True
)
...
...
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