Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
fund_report
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
fund_report
Commits
ce855a22
Commit
ce855a22
authored
Dec 23, 2020
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
交易日历
parent
c003112f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
data_service.py
app/service/data_service.py
+11
-0
data_service_v2.py
app/service/data_service_v2.py
+11
-1
data_service_v2_1.py
app/service/data_service_v2_1.py
+11
-1
No files found.
app/service/data_service.py
View file @
ce855a22
...
...
@@ -16,6 +16,7 @@ from decimal import Decimal
from
app.api.engine
import
tamp_user_engine
,
tamp_product_engine
,
TAMP_SQL
# from app.model.tamp_user_models import CustomerOrder, CustomerInfo
# from app.model.tamp_product_models import FundInfo
from
app.utils.fund_rank
import
get_trade_cal
class
UserCustomerDataAdaptor
:
...
...
@@ -48,6 +49,16 @@ class UserCustomerDataAdaptor:
@
staticmethod
def
get_trade_cal
(
start_date
,
end_date
):
try
:
df
=
get_trade_cal
()
df
=
df
[
df
[
"cal_date"
]
>=
start_date
]
df
.
drop
([
'end_date'
],
axis
=
1
,
inplace
=
True
)
df
.
rename
(
columns
=
{
'cal_date'
:
'end_date'
},
inplace
=
True
)
df
[
"datetime"
]
=
df
[
"end_date"
]
.
apply
(
lambda
x
:
datetime
.
datetime
.
strptime
(
x
,
"
%
Y
%
m
%
d"
))
return
df
except
:
pass
ts
.
set_token
(
'ac1f734f8a25651aa07319ca35b1b0c0854e361e306fe85d85e092bc'
)
pro
=
ts
.
pro_api
()
if
end_date
is
not
None
:
...
...
app/service/data_service_v2.py
View file @
ce855a22
...
...
@@ -18,7 +18,7 @@ from app.api.engine import tamp_user_engine, tamp_product_engine, TAMP_SQL, tamp
# from app.model.tamp_user_models import CustomerOrder, CustomerInfo
# from app.model.tamp_product_models import FundInfo
from
app.utils.fund_rank
import
get_frequency
from
app.utils.fund_rank
import
get_frequency
,
get_trade_cal
class
UserCustomerDataAdaptor
:
...
...
@@ -51,6 +51,16 @@ class UserCustomerDataAdaptor:
@
staticmethod
def
get_trade_cal
(
start_date
,
end_date
):
try
:
df
=
get_trade_cal
()
df
=
df
[
df
[
"cal_date"
]
>=
start_date
]
df
.
drop
([
'end_date'
],
axis
=
1
,
inplace
=
True
)
df
.
rename
(
columns
=
{
'cal_date'
:
'end_date'
},
inplace
=
True
)
df
[
"datetime"
]
=
df
[
"end_date"
]
.
apply
(
lambda
x
:
datetime
.
datetime
.
strptime
(
x
,
"
%
Y
%
m
%
d"
))
return
df
except
:
pass
ts
.
set_token
(
'ac1f734f8a25651aa07319ca35b1b0c0854e361e306fe85d85e092bc'
)
pro
=
ts
.
pro_api
()
if
end_date
is
not
None
:
...
...
app/service/data_service_v2_1.py
View file @
ce855a22
...
...
@@ -18,7 +18,7 @@ from app.api.engine import tamp_user_engine, tamp_product_engine, TAMP_SQL, tamp
# from app.model.tamp_user_models import CustomerOrder, CustomerInfo
# from app.model.tamp_product_models import FundInfo
from
app.utils.fund_rank
import
get_frequency
from
app.utils.fund_rank
import
get_frequency
,
get_trade_cal
class
UserCustomerDataAdaptor
:
...
...
@@ -51,6 +51,16 @@ class UserCustomerDataAdaptor:
@
staticmethod
def
get_trade_cal
(
start_date
,
end_date
):
try
:
df
=
get_trade_cal
()
df
=
df
[
df
[
"cal_date"
]
>=
start_date
]
df
.
drop
([
'end_date'
],
axis
=
1
,
inplace
=
True
)
df
.
rename
(
columns
=
{
'cal_date'
:
'end_date'
},
inplace
=
True
)
df
[
"datetime"
]
=
df
[
"end_date"
]
.
apply
(
lambda
x
:
datetime
.
datetime
.
strptime
(
x
,
"
%
Y
%
m
%
d"
))
return
df
except
:
pass
ts
.
set_token
(
'ac1f734f8a25651aa07319ca35b1b0c0854e361e306fe85d85e092bc'
)
pro
=
ts
.
pro_api
()
if
end_date
is
not
None
:
...
...
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