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
e99adf36
Commit
e99adf36
authored
Nov 27, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added api for load all formulas
parent
d0152b38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
sqlengine.py
alphamind/data/engines/sqlengine.py
+11
-1
No files found.
alphamind/data/engines/sqlengine.py
View file @
e99adf36
...
@@ -737,6 +737,14 @@ class SqlEngine(object):
...
@@ -737,6 +737,14 @@ class SqlEngine(object):
if
not
df
.
empty
:
if
not
df
.
empty
:
return
decode_formula
(
df
.
loc
[
0
,
'formula_desc'
][
'desc'
])
return
decode_formula
(
df
.
loc
[
0
,
'formula_desc'
][
'desc'
])
def
load_all_formulas
(
self
):
query
=
select
([
Formulas
])
df
=
pd
.
read_sql
(
query
,
self
.
engine
,
index_col
=
'formula'
)
if
not
df
.
empty
:
return
pd
.
Series
({
name
:
decode_formula
(
df
.
loc
[
name
,
'formula_desc'
][
'desc'
])
for
name
in
df
.
index
})
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
from
PyFin.api
import
RES
,
LAST
from
PyFin.api
import
RES
,
LAST
...
@@ -749,4 +757,6 @@ if __name__ == '__main__':
...
@@ -749,4 +757,6 @@ if __name__ == '__main__':
engine
.
save_formula
(
f
'{name}_res'
,
formula
)
engine
.
save_formula
(
f
'{name}_res'
,
formula
)
formula
=
RES
(
20
,
-
LAST
(
name
)
^
LAST
(
'roe_q'
))
formula
=
RES
(
20
,
-
LAST
(
name
)
^
LAST
(
'roe_q'
))
engine
.
save_formula
(
f
'{name}_neg_res'
,
formula
)
engine
.
save_formula
(
f
'{name}_neg_res'
,
formula
)
\ No newline at end of file
print
(
engine
.
load_all_formulas
())
\ 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