Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
alpha-mind
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
Dr.李
alpha-mind
Commits
ef8cebfc
Commit
ef8cebfc
authored
Jun 30, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added scripts for daily strategy weights
parent
186b5f4b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
update_uqer_data.py
scripts/update_uqer_data.py
+27
-0
No files found.
scripts/update_uqer_data.py
View file @
ef8cebfc
...
@@ -262,6 +262,25 @@ def update_uqer_daily_return(ds, **kwargs):
...
@@ -262,6 +262,25 @@ def update_uqer_daily_return(ds, **kwargs):
df
=
pd
.
read_sql
(
"select Code, chgPct as d1 from market where Date = '{0}'"
.
format
(
this_date
),
engine
)
df
=
pd
.
read_sql
(
"select Code, chgPct as d1 from market where Date = '{0}'"
.
format
(
this_date
),
engine
)
df
[
'Date'
]
=
previous_date
df
[
'Date'
]
=
previous_date
engine
.
execute
(
"delete from {0} where Date = '{1}'"
.
format
(
table
,
previous_date
))
engine
.
execute
(
"delete from {0} where Date = '{1}'"
.
format
(
table
,
previous_date
))
data_info_log
(
df
,
table
)
df
.
to_sql
(
table
,
engine
,
index
=
False
,
if_exists
=
'append'
)
def
update_stratgy_table
(
ds
,
**
kwargs
):
strategy_date
=
kwargs
[
'next_execution_date'
]
df
=
pd
.
DataFrame
({
'strategyName'
:
[
'mutual_fund'
,
'mutual_fund'
,
'mutual_fund'
,
'prod'
,
'prod'
],
'factor'
:
[
'BDTO'
,
'CFinc1'
,
'DivP'
,
'EPSAfterNonRecurring'
,
'RVOL'
,
'CoppockCurve'
,
'EPS'
],
'weight'
:
[
0.1002
,
0.2314
,
0.1764
,
0.3739
,
0.1181
,
-
0.3333
,
0.6666
],
'source'
:
[
'tiny'
,
'tiny'
,
'tiny'
,
'tiny'
,
'tiny'
,
'uqer'
,
'uqer'
]})
table
=
'strategy'
df
[
'Date'
]
=
strategy_date
engine
.
execute
(
"delete from {0} where Date = '{1}'"
.
format
(
table
,
strategy_date
.
strftime
(
'
%
Y-
%
m-
%
d'
)))
data_info_log
(
df
,
table
)
format_data
(
df
)
df
.
to_sql
(
table
,
engine
,
index
=
False
,
if_exists
=
'append'
)
df
.
to_sql
(
table
,
engine
,
index
=
False
,
if_exists
=
'append'
)
...
@@ -332,5 +351,13 @@ _ = PythonOperator(
...
@@ -332,5 +351,13 @@ _ = PythonOperator(
)
)
task
=
PythonOperator
(
task_id
=
'update_stratgy_table'
,
provide_context
=
True
,
python_callable
=
update_stratgy_table
,
dag
=
dag
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
update_uqer_index_components
(
ds
=
'2017-06-22'
)
update_uqer_index_components
(
ds
=
'2017-06-22'
)
\ No newline at end of file
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