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
336d41ba
Commit
336d41ba
authored
Jan 22, 2021
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fund_name
parent
47358623
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
18 deletions
+37
-18
portfolio_diagnose.py
app/service/portfolio_diagnose.py
+37
-18
No files found.
app/service/portfolio_diagnose.py
View file @
336d41ba
...
@@ -324,24 +324,43 @@ def get_radar_data(fund):
...
@@ -324,24 +324,43 @@ def get_radar_data(fund):
{
'name'
:
'综合评分'
,
'data'
:
'
%.2
f'
%
total_score
}]}
{
'name'
:
'综合评分'
,
'data'
:
'
%.2
f'
%
total_score
}]}
def
get_fund_name
(
fund
):
def
get_fund_name
(
fund
,
fund_type
=
1
):
with
TAMP_SQL
(
tamp_fund_engine
)
as
tamp_fund
:
if
fund_type
==
0
:
tamp_fund_session
=
tamp_fund
.
session
with
TAMP_SQL
(
tamp_fund_engine
)
as
tamp_fund
:
sql
=
"SELECT fund_short_name FROM fund_info WHERE id='{}'"
.
format
(
fund
)
tamp_fund_session
=
tamp_fund
.
session
# df = pd.read_sql(sql, con)
sql
=
"SELECT name FROM public_fund_basic WHERE ts_code='{}'"
.
format
(
fund
)
cur
=
tamp_fund_session
.
execute
(
sql
)
# df = pd.read_sql(sql, con)
data
=
cur
.
fetchall
()
cur
=
tamp_fund_session
.
execute
(
sql
)
df
=
pd
.
DataFrame
(
list
(
data
),
columns
=
[
'fund_short_name'
])
data
=
cur
.
fetchall
()
if
len
(
df
)
==
0
:
df
=
pd
.
DataFrame
(
list
(
data
),
columns
=
[
'fund_short_name'
])
with
TAMP_SQL
(
tamp_product_engine
)
as
tamp_product
:
return
df
tamp_product_session
=
tamp_product
.
session
elif
fund_type
==
1
or
fund_type
==
2
:
sql
=
"SELECT fund_short_name FROM fund_info WHERE id='{}'"
.
format
(
fund
)
with
TAMP_SQL
(
tamp_fund_engine
)
as
tamp_fund
:
# df = pd.read_sql(sql, con)
tamp_fund_session
=
tamp_fund
.
session
cur
=
tamp_product_session
.
execute
(
sql
)
sql
=
"SELECT fund_short_name FROM fund_info WHERE id='{}'"
.
format
(
fund
)
data
=
cur
.
fetchall
()
# df = pd.read_sql(sql, con)
df
=
pd
.
DataFrame
(
list
(
data
),
columns
=
[
'fund_short_name'
])
cur
=
tamp_fund_session
.
execute
(
sql
)
return
df
data
=
cur
.
fetchall
()
return
df
df
=
pd
.
DataFrame
(
list
(
data
),
columns
=
[
'fund_short_name'
])
if
len
(
df
)
==
0
:
with
TAMP_SQL
(
tamp_product_engine
)
as
tamp_product
:
tamp_product_session
=
tamp_product
.
session
sql
=
"SELECT fund_short_name FROM fund_info WHERE id='{}'"
.
format
(
fund
)
# df = pd.read_sql(sql, con)
cur
=
tamp_product_session
.
execute
(
sql
)
data
=
cur
.
fetchall
()
df
=
pd
.
DataFrame
(
list
(
data
),
columns
=
[
'fund_short_name'
])
return
df
return
df
else
:
with
TAMP_SQL
(
tamp_fund_engine
)
as
tamp_fund
:
tamp_fund_session
=
tamp_fund
.
session
sql
=
"SELECT fund_name FROM ifa_imported_fund_info WHERE id='{}'"
.
format
(
fund
)
# df = pd.read_sql(sql, con)
cur
=
tamp_fund_session
.
execute
(
sql
)
data
=
cur
.
fetchall
()
df
=
pd
.
DataFrame
(
list
(
data
),
columns
=
[
'fund_short_name'
])
return
df
# 获取排名信息
# 获取排名信息
...
...
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