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
1f273295
Commit
1f273295
authored
Nov 24, 2020
by
pengxiong@wealthgrow.cn
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
e9c3018a
2c4e102c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
321 additions
and
265 deletions
+321
-265
base.py
app/model/base.py
+1
-3
tamp_product_models.py
app/model/tamp_product_models.py
+130
-130
tamp_user_models.py
app/model/tamp_user_models.py
+127
-127
data_service.py
app/service/data_service.py
+37
-5
result_service.py
app/service/result_service.py
+26
-0
No files found.
app/model/base.py
View file @
1f273295
...
@@ -6,14 +6,12 @@
...
@@ -6,14 +6,12 @@
# @Email : acepengxiong@163.com
# @Email : acepengxiong@163.com
# @Software : PyCharm
# @Software : PyCharm
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
from
sqlalchemy.ext.declarative
import
declarative_base
,
declared_attr
from
sqlalchemy.ext.declarative
import
declarative_base
Base
=
declarative_base
()
Base
=
declarative_base
()
metadata
=
Base
.
metadata
class
BaseModel
():
class
BaseModel
():
"""."""
"""."""
__abstract__
=
True
def
__init__
(
self
):
def
__init__
(
self
):
pass
pass
...
...
app/model/tamp_product_models.py
View file @
1f273295
...
@@ -3,7 +3,7 @@ from sqlalchemy import Column, DECIMAL, Date, DateTime, String, TIMESTAMP, Text,
...
@@ -3,7 +3,7 @@ from sqlalchemy import Column, DECIMAL, Date, DateTime, String, TIMESTAMP, Text,
from
sqlalchemy
import
Column
,
DECIMAL
,
Date
,
DateTime
,
ForeignKeyConstraint
,
Index
,
LargeBinary
,
String
,
TIMESTAMP
,
Table
,
Text
,
text
from
sqlalchemy
import
Column
,
DECIMAL
,
Date
,
DateTime
,
ForeignKeyConstraint
,
Index
,
LargeBinary
,
String
,
TIMESTAMP
,
Table
,
Text
,
text
from
sqlalchemy.dialects.mysql
import
INTEGER
,
MEDIUMTEXT
,
TINYINT
from
sqlalchemy.dialects.mysql
import
INTEGER
,
MEDIUMTEXT
,
TINYINT
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy.ext.declarative
import
declarative_base
from
app.model.base
import
Base
,
BaseModel
,
metadata
from
app.model.base
import
Base
,
BaseModel
class
CompanyInfo
(
Base
,
BaseModel
):
class
CompanyInfo
(
Base
,
BaseModel
):
...
@@ -386,136 +386,136 @@ class FundFuturestypeMapping(Base, BaseModel):
...
@@ -386,136 +386,136 @@ class FundFuturestypeMapping(Base, BaseModel):
delete_tag
=
Column
(
TINYINT
(
3
),
nullable
=
False
)
delete_tag
=
Column
(
TINYINT
(
3
),
nullable
=
False
)
# class FundInfo(Base, BaseModel):
class
FundInfo
(
Base
,
BaseModel
):
# __tablename__ = 'fund_info'
__tablename__
=
'fund_info'
# __table_args__ = {'comment': '基金基本信息'}
__table_args__
=
{
'comment'
:
'基金基本信息'
}
id
=
Column
(
String
(
64
),
primary_key
=
True
,
comment
=
'基金id'
)
p_fund_id
=
Column
(
String
(
64
),
comment
=
'父级产品ID'
)
fund_name
=
Column
(
String
(
255
),
nullable
=
False
,
comment
=
'基金中文全称'
)
fund_short_name
=
Column
(
String
(
80
),
nullable
=
False
,
comment
=
'基金中文简称'
)
fund_structure
=
Column
(
INTEGER
(
11
),
comment
=
'基金形式:1-公司型,2-合伙型,3-契约型,-1-其他'
)
fund_type
=
Column
(
INTEGER
(
4
),
comment
=
'私募基金类型:1-信托计划,2-有限合伙,3-券商资管,4-公募专户,5-单账户,6-证券投资基金,7-海外基金,8-期货资管,9-保险资管、10-创业投资基金、11-股权投资基金、12-银行理财、13-类固收信托、-1其他投资基金
\t\t\\
n公募基金类型:1-混合型、2-债券型、3-定开债券、4-联接基金、5-货币型、6-债券指数、7-保本型、8-理财型、9-QDII、10-股票指数、11-QDII-指数、12-股票型、13-固定收益、14-分级杠杆、15-ETF-场内、16-QDII-ETF、17-债券创新-场内、18-封闭式'
)
type
=
Column
(
INTEGER
(
3
),
nullable
=
False
,
server_default
=
text
(
"'0'"
),
comment
=
'是否可预约 0:不可预约 1:可预约'
)
raise_type
=
Column
(
INTEGER
(
4
),
comment
=
'募集方式:1-私募,2-公募'
)
fund_characteristic
=
Column
(
Text
,
comment
=
'券商资管产品特点'
)
base_currency
=
Column
(
INTEGER
(
11
),
comment
=
'基础货币,1-人民币,2-港币,3-美元,4-份,-1-其他'
)
inception_date
=
Column
(
Date
,
comment
=
'成立日期'
)
domicile
=
Column
(
INTEGER
(
4
),
comment
=
'注册国家,1-中国大陆、2-香港、3-新加坡、4-开曼群岛、5-台湾、6-英属维尔京群岛BVI、-1-其他'
)
primary_benchmark_id
=
Column
(
String
(
64
),
comment
=
"指数id,以'IN'开头(后加36进制编码格式,不足8位长度左补零) 例:IN00000001"
)
lockup_period
=
Column
(
INTEGER
(
4
),
comment
=
'封闭期 (排排数据:单位:月,-1:不确定,0:无封闭期)'
)
open_day
=
Column
(
String
(
400
),
comment
=
'开放日'
)
apply_day
=
Column
(
DateTime
,
comment
=
'预约开放日'
)
redeem_day
=
Column
(
DateTime
,
comment
=
'赎回开放日'
)
duration
=
Column
(
INTEGER
(
11
),
comment
=
'产品存续期,单位:月。-1,不确定,0,无固定期限,999999永续'
)
investment_scope
=
Column
(
Text
,
comment
=
'基金投资范围'
)
investment_restriction
=
Column
(
Text
,
comment
=
'投资限制'
)
fund_investment_philosophy
=
Column
(
Text
,
comment
=
'投资理念'
)
fund_strategy_description
=
Column
(
Text
,
comment
=
'投资策略'
)
advisor_id
=
Column
(
String
(
64
),
comment
=
'投资顾问id'
)
custodian_id
=
Column
(
String
(
64
),
comment
=
'托管银行Id'
)
broker_id
=
Column
(
String
(
64
),
comment
=
'证券经纪人Id'
)
broker_future_id
=
Column
(
String
(
64
),
comment
=
'期货经纪人id'
)
liquidation_agency_id
=
Column
(
String
(
64
),
comment
=
'外包机构Id'
)
trust_id
=
Column
(
String
(
64
),
comment
=
'基金管理公司Id'
)
investment_consultant_id
=
Column
(
String
(
64
),
comment
=
'投资顾问Id'
)
administrator_id
=
Column
(
String
(
64
),
comment
=
'行政管理人Id'
)
legal_counsel_id
=
Column
(
String
(
64
),
comment
=
'法律顾问Id'
)
auditor_id
=
Column
(
String
(
64
),
comment
=
'审计机构'
)
nav_frequency
=
Column
(
INTEGER
(
3
),
comment
=
'净值披露频率 1:天 2:周 3:月 4:半月 5:季度'
)
performance_disclosure_mark
=
Column
(
INTEGER
(
4
),
comment
=
'产品业绩披露标识:1-AAA,2-AA,3-A,4-A-,5-A+'
)
register_number
=
Column
(
String
(
20
),
comment
=
'备案编码'
)
register_date
=
Column
(
Date
,
comment
=
'备案日期'
)
isvisible
=
Column
(
INTEGER
(
4
),
comment
=
'基金在前台是否可见:1-可见 0-不可见'
)
istiered
=
Column
(
INTEGER
(
4
),
comment
=
'是否分级:1-分级,0-不分级;'
)
is_ranking
=
Column
(
INTEGER
(
4
),
comment
=
'是否参与排名,1-参与排名 0-不参与排名
\t
'
)
is_rating
=
Column
(
INTEGER
(
4
),
comment
=
'是否参与评级,1-参与评级 0-不参与评级
\t
'
)
special_tips
=
Column
(
String
(
300
),
comment
=
'基金协会特别提示'
)
amac_url
=
Column
(
String
(
255
),
comment
=
'基金协会链接'
)
nav_source_type
=
Column
(
INTEGER
(
4
),
comment
=
'净值来源说明:1-托管外包、2-信托券商官网、3-私募机构'
)
combine_target
=
Column
(
Text
,
comment
=
'组合目标'
)
fit_group
=
Column
(
Text
,
comment
=
'适合群体'
)
combine_comment
=
Column
(
Text
,
comment
=
'组合点评'
)
transfer_comment
=
Column
(
Text
,
comment
=
'调仓点评'
)
desc_info
=
Column
(
String
(
512
),
comment
=
'基金描述'
)
strategy
=
Column
(
INTEGER
(
4
),
comment
=
'融智策略分类,1-股票策略,2-宏观策略,3-管理期货,4-事件驱动,5-相对价值策略,6-固定收益策略,7-组合基金,8-复合策略,-1-其它策略'
)
substrategy
=
Column
(
INTEGER
(
4
),
comment
=
"融智子策略分类:1010-主观多头 1020-股票多空 1030-量化多头 2010-宏观策略 3010-主观趋势 3020-主观套利 3030-量化趋势 3040-量化套利 3050-管理期货复合 4010-并购重组 4020-定向增发 4030-大宗交易 4040-事件驱动复合 5010-股票市场中性 5020-套利 5030-相对价值复合 6010-纯债策略 6020-强债策略 6030-固收复合 7010-MOM 7020-FOF 8010-主观多策略 8020-量化多策略 -1-其他策略'"
)
risk_level
=
Column
(
INTEGER
(
1
),
comment
=
'风险等级'
)
create_by
=
Column
(
String
(
64
))
create_time
=
Column
(
DateTime
)
update_by
=
Column
(
String
(
64
))
update_time
=
Column
(
DateTime
)
data_sources
=
Column
(
INTEGER
(
5
),
nullable
=
False
,
server_default
=
text
(
"'1'"
),
comment
=
'数据来源 1:tanpu,2:私募排排'
)
status
=
Column
(
INTEGER
(
1
),
comment
=
'0:待上架 1:已上架 2:已下架'
)
delete_tag
=
Column
(
INTEGER
(
3
),
nullable
=
False
,
server_default
=
text
(
"'0'"
),
comment
=
'删除标识 0:否 1:是'
)
sort
=
Column
(
INTEGER
(
10
),
nullable
=
False
,
server_default
=
text
(
"'0'"
),
comment
=
'排序'
)
#
#
# id = Column(String(64), primary_key=True, comment='基金id')
# t_fund_info = Table(
# p_fund_id = Column(String(64), comment='父级产品ID')
# 'fund_info', metadata,
# fund_name = Column(String(255), nullable=False, comment='基金中文全称')
# Column('id', String(64), primary_key=True, comment='基金id'),
# fund_short_name = Column(String(80), nullable=False, comment='基金中文简称')
# Column('p_fund_id', String(64), comment='父级产品ID'),
# fund_structure = Column(INTEGER(11), comment='基金形式:1-公司型,2-合伙型,3-契约型,-1-其他')
# Column('fund_name', String(255), nullable=False, comment='基金中文全称'),
# fund_type = Column(INTEGER(4), comment='私募基金类型:1-信托计划,2-有限合伙,3-券商资管,4-公募专户,5-单账户,6-证券投资基金,7-海外基金,8-期货资管,9-保险资管、10-创业投资基金、11-股权投资基金、12-银行理财、13-类固收信托、-1其他投资基金 \t\t\\n公募基金类型:1-混合型、2-债券型、3-定开债券、4-联接基金、5-货币型、6-债券指数、7-保本型、8-理财型、9-QDII、10-股票指数、11-QDII-指数、12-股票型、13-固定收益、14-分级杠杆、15-ETF-场内、16-QDII-ETF、17-债券创新-场内、18-封闭式')
# Column('fund_short_name', String(80), nullable=False, comment='基金中文简称'),
# type = Column(INTEGER(3), nullable=False, server_default=text("'0'"), comment='是否可预约 0:不可预约 1:可预约')
# Column('fund_structure', INTEGER(11), comment='基金形式:1-公司型,2-合伙型,3-契约型,-1-其他'),
# raise_type = Column(INTEGER(4), comment='募集方式:1-私募,2-公募')
# Column('fund_type', INTEGER(4),
# fund_characteristic = Column(Text, comment='券商资管产品特点')
# comment='私募基金类型:1-信托计划,2-有限合伙,3-券商资管,4-公募专户,5-单账户,6-证券投资基金,7-海外基金,8-期货资管,9-保险资管、10-创业投资基金、11-股权投资基金、12-银行理财、13-类固收信托、-1其他投资基金 \t\t\\n公募基金类型:1-混合型、2-债券型、3-定开债券、4-联接基金、5-货币型、6-债券指数、7-保本型、8-理财型、9-QDII、10-股票指数、11-QDII-指数、12-股票型、13-固定收益、14-分级杠杆、15-ETF-场内、16-QDII-ETF、17-债券创新-场内、18-封闭式'),
# base_currency = Column(INTEGER(11), comment='基础货币,1-人民币,2-港币,3-美元,4-份,-1-其他')
# Column('type', INTEGER(3), nullable=False, server_default=text("'0'"), comment='是否可预约 0:不可预约 1:可预约'),
# inception_date = Column(Date, comment='成立日期')
# Column('raise_type', INTEGER(4), comment='募集方式:1-私募,2-公募'),
# domicile = Column(INTEGER(4), comment='注册国家,1-中国大陆、2-香港、3-新加坡、4-开曼群岛、5-台湾、6-英属维尔京群岛BVI、-1-其他')
# Column('fund_characteristic', Text, comment='券商资管产品特点'),
# primary_benchmark_id = Column(String(64), comment="指数id,以'IN'开头(后加36进制编码格式,不足8位长度左补零) 例:IN00000001")
# Column('base_currency', INTEGER(11), comment='基础货币,1-人民币,2-港币,3-美元,4-份,-1-其他'),
# lockup_period = Column(INTEGER(4), comment='封闭期 (排排数据:单位:月,-1:不确定,0:无封闭期)')
# Column('inception_date', Date, comment='成立日期'),
# open_day = Column(String(400), comment='开放日')
# Column('domicile', INTEGER(4), comment='注册国家,1-中国大陆、2-香港、3-新加坡、4-开曼群岛、5-台湾、6-英属维尔京群岛BVI、-1-其他'),
# apply_day = Column(DateTime, comment='预约开放日')
# Column('primary_benchmark_id', String(64), comment="指数id,以'IN'开头(后加36进制编码格式,不足8位长度左补零) 例:IN00000001"),
# redeem_day = Column(DateTime, comment='赎回开放日')
# Column('lockup_period', INTEGER(4), comment='封闭期 (排排数据:单位:月,-1:不确定,0:无封闭期)'),
# duration = Column(INTEGER(11), comment='产品存续期,单位:月。-1,不确定,0,无固定期限,999999永续')
# Column('open_day', String(400), comment='开放日'),
# investment_scope = Column(Text, comment='基金投资范围')
# Column('apply_day', DateTime, comment='预约开放日'),
# investment_restriction = Column(Text, comment='投资限制')
# Column('redeem_day', DateTime, comment='赎回开放日'),
# fund_investment_philosophy = Column(Text, comment='投资理念')
# Column('duration', INTEGER(11), comment='产品存续期,单位:月。-1,不确定,0,无固定期限,999999永续'),
# fund_strategy_description = Column(Text, comment='投资策略')
# Column('investment_scope', Text, comment='基金投资范围'),
# advisor_id = Column(String(64), comment='投资顾问id')
# Column('investment_restriction', Text, comment='投资限制'),
# custodian_id = Column(String(64), comment='托管银行Id')
# Column('fund_investment_philosophy', Text, comment='投资理念'),
# broker_id = Column(String(64), comment='证券经纪人Id')
# Column('fund_strategy_description', Text, comment='投资策略'),
# broker_future_id = Column(String(64), comment='期货经纪人id')
# Column('advisor_id', String(64), comment='投资顾问id'),
# liquidation_agency_id = Column(String(64), comment='外包机构Id')
# Column('custodian_id', String(64), comment='托管银行Id'),
# trust_id = Column(String(64), comment='基金管理公司Id')
# Column('broker_id', String(64), comment='证券经纪人Id'),
# investment_consultant_id = Column(String(64), comment='投资顾问Id')
# Column('broker_future_id', String(64), comment='期货经纪人id'),
# administrator_id = Column(String(64), comment='行政管理人Id')
# Column('liquidation_agency_id', String(64), comment='外包机构Id'),
# legal_counsel_id = Column(String(64), comment='法律顾问Id')
# Column('trust_id', String(64), comment='基金管理公司Id'),
# auditor_id = Column(String(64), comment='审计机构')
# Column('investment_consultant_id', String(64), comment='投资顾问Id'),
# nav_frequency = Column(INTEGER(3), comment='净值披露频率 1:天 2:周 3:月 4:半月 5:季度')
# Column('administrator_id', String(64), comment='行政管理人Id'),
# performance_disclosure_mark = Column(INTEGER(4), comment='产品业绩披露标识:1-AAA,2-AA,3-A,4-A-,5-A+')
# Column('legal_counsel_id', String(64), comment='法律顾问Id'),
# register_number = Column(String(20), comment='备案编码')
# Column('auditor_id', String(64), comment='审计机构'),
# register_date = Column(Date, comment='备案日期')
# Column('nav_frequency', INTEGER(3), comment='净值披露频率 1:天 2:周 3:月 4:半月 5:季度'),
# isvisible = Column(INTEGER(4), comment='基金在前台是否可见:1-可见 0-不可见')
# Column('performance_disclosure_mark', INTEGER(4), comment='产品业绩披露标识:1-AAA,2-AA,3-A,4-A-,5-A+'),
# istiered = Column(INTEGER(4), comment='是否分级:1-分级,0-不分级;')
# Column('register_number', String(20), comment='备案编码'),
# is_ranking = Column(INTEGER(4), comment='是否参与排名,1-参与排名 0-不参与排名 \t')
# Column('register_date', Date, comment='备案日期'),
# is_rating = Column(INTEGER(4), comment='是否参与评级,1-参与评级 0-不参与评级\t')
# Column('isvisible', INTEGER(4), comment='基金在前台是否可见:1-可见 0-不可见'),
# special_tips = Column(String(300), comment='基金协会特别提示')
# Column('istiered', INTEGER(4), comment='是否分级:1-分级,0-不分级;'),
# amac_url = Column(String(255), comment='基金协会链接')
# Column('is_ranking', INTEGER(4), comment='是否参与排名,1-参与排名 0-不参与排名 \t'),
# nav_source_type = Column(INTEGER(4), comment='净值来源说明:1-托管外包、2-信托券商官网、3-私募机构')
# Column('is_rating', INTEGER(4), comment='是否参与评级,1-参与评级 0-不参与评级\t'),
# combine_target = Column(Text, comment='组合目标')
# Column('special_tips', String(300), comment='基金协会特别提示'),
# fit_group = Column(Text, comment='适合群体')
# Column('amac_url', String(255), comment='基金协会链接'),
# combine_comment = Column(Text, comment='组合点评')
# Column('nav_source_type', INTEGER(4), comment='净值来源说明:1-托管外包、2-信托券商官网、3-私募机构'),
# transfer_comment = Column(Text, comment='调仓点评')
# Column('combine_target', Text, comment='组合目标'),
# desc_info = Column(String(512), comment='基金描述')
# Column('fit_group', Text, comment='适合群体'),
# strategy = Column(INTEGER(4), comment='融智策略分类,1-股票策略,2-宏观策略,3-管理期货,4-事件驱动,5-相对价值策略,6-固定收益策略,7-组合基金,8-复合策略,-1-其它策略')
# Column('combine_comment', Text, comment='组合点评'),
# substrategy = Column(INTEGER(4), comment="融智子策略分类:1010-主观多头 1020-股票多空 1030-量化多头 2010-宏观策略 3010-主观趋势 3020-主观套利 3030-量化趋势 3040-量化套利 3050-管理期货复合 4010-并购重组 4020-定向增发 4030-大宗交易 4040-事件驱动复合 5010-股票市场中性 5020-套利 5030-相对价值复合 6010-纯债策略 6020-强债策略 6030-固收复合 7010-MOM 7020-FOF 8010-主观多策略 8020-量化多策略 -1-其他策略'")
# Column('transfer_comment', Text, comment='调仓点评'),
# risk_level = Column(INTEGER(1), comment='风险等级')
# Column('desc_info', String(512), comment='基金描述'),
# create_by = Column(String(64))
# Column('strategy', INTEGER(4),
# create_time = Column(DateTime)
# comment='融智策略分类,1-股票策略,2-宏观策略,3-管理期货,4-事件驱动,5-相对价值策略,6-固定收益策略,7-组合基金,8-复合策略,-1-其它策略'),
# update_by = Column(String(64))
# Column('substrategy', INTEGER(4),
# update_time = Column(DateTime)
# comment="融智子策略分类:1010-主观多头 1020-股票多空 1030-量化多头 2010-宏观策略 3010-主观趋势 3020-主观套利 3030-量化趋势 3040-量化套利 3050-管理期货复合 4010-并购重组 4020-定向增发 4030-大宗交易 4040-事件驱动复合 5010-股票市场中性 5020-套利 5030-相对价值复合 6010-纯债策略 6020-强债策略 6030-固收复合 7010-MOM 7020-FOF 8010-主观多策略 8020-量化多策略 -1-其他策略'"),
# data_sources = Column(INTEGER(5), nullable=False, server_default=text("'1'"), comment='数据来源 1:tanpu,2:私募排排')
# Column('risk_level', INTEGER(1), comment='风险等级'),
# status = Column(INTEGER(1), comment='0:待上架 1:已上架 2:已下架')
# Column('create_by', String(64)),
# delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"), comment='删除标识 0:否 1:是')
# Column('create_time', DateTime),
# sort = Column(INTEGER(10), nullable=False, server_default=text("'0'"), comment='排序')
# Column('update_by', String(64)),
# Column('update_time', DateTime),
# Column('data_sources', INTEGER(5), nullable=False, server_default=text("'1'"), comment='数据来源 1:tanpu,2:私募排排'),
t_fund_info
=
Table
(
# Column('status', INTEGER(1), comment='0:待上架 1:已上架 2:已下架'),
'fund_info'
,
metadata
,
# Column('delete_tag', INTEGER(3), nullable=False, server_default=text("'0'"), comment='删除标识 0:否 1:是'),
Column
(
'id'
,
String
(
64
),
primary_key
=
True
,
comment
=
'基金id'
),
# Column('sort', INTEGER(10), nullable=False, server_default=text("'0'"), comment='排序'),
Column
(
'p_fund_id'
,
String
(
64
),
comment
=
'父级产品ID'
),
# )
Column
(
'fund_name'
,
String
(
255
),
nullable
=
False
,
comment
=
'基金中文全称'
),
Column
(
'fund_short_name'
,
String
(
80
),
nullable
=
False
,
comment
=
'基金中文简称'
),
Column
(
'fund_structure'
,
INTEGER
(
11
),
comment
=
'基金形式:1-公司型,2-合伙型,3-契约型,-1-其他'
),
Column
(
'fund_type'
,
INTEGER
(
4
),
comment
=
'私募基金类型:1-信托计划,2-有限合伙,3-券商资管,4-公募专户,5-单账户,6-证券投资基金,7-海外基金,8-期货资管,9-保险资管、10-创业投资基金、11-股权投资基金、12-银行理财、13-类固收信托、-1其他投资基金
\t\t\\
n公募基金类型:1-混合型、2-债券型、3-定开债券、4-联接基金、5-货币型、6-债券指数、7-保本型、8-理财型、9-QDII、10-股票指数、11-QDII-指数、12-股票型、13-固定收益、14-分级杠杆、15-ETF-场内、16-QDII-ETF、17-债券创新-场内、18-封闭式'
),
Column
(
'type'
,
INTEGER
(
3
),
nullable
=
False
,
server_default
=
text
(
"'0'"
),
comment
=
'是否可预约 0:不可预约 1:可预约'
),
Column
(
'raise_type'
,
INTEGER
(
4
),
comment
=
'募集方式:1-私募,2-公募'
),
Column
(
'fund_characteristic'
,
Text
,
comment
=
'券商资管产品特点'
),
Column
(
'base_currency'
,
INTEGER
(
11
),
comment
=
'基础货币,1-人民币,2-港币,3-美元,4-份,-1-其他'
),
Column
(
'inception_date'
,
Date
,
comment
=
'成立日期'
),
Column
(
'domicile'
,
INTEGER
(
4
),
comment
=
'注册国家,1-中国大陆、2-香港、3-新加坡、4-开曼群岛、5-台湾、6-英属维尔京群岛BVI、-1-其他'
),
Column
(
'primary_benchmark_id'
,
String
(
64
),
comment
=
"指数id,以'IN'开头(后加36进制编码格式,不足8位长度左补零) 例:IN00000001"
),
Column
(
'lockup_period'
,
INTEGER
(
4
),
comment
=
'封闭期 (排排数据:单位:月,-1:不确定,0:无封闭期)'
),
Column
(
'open_day'
,
String
(
400
),
comment
=
'开放日'
),
Column
(
'apply_day'
,
DateTime
,
comment
=
'预约开放日'
),
Column
(
'redeem_day'
,
DateTime
,
comment
=
'赎回开放日'
),
Column
(
'duration'
,
INTEGER
(
11
),
comment
=
'产品存续期,单位:月。-1,不确定,0,无固定期限,999999永续'
),
Column
(
'investment_scope'
,
Text
,
comment
=
'基金投资范围'
),
Column
(
'investment_restriction'
,
Text
,
comment
=
'投资限制'
),
Column
(
'fund_investment_philosophy'
,
Text
,
comment
=
'投资理念'
),
Column
(
'fund_strategy_description'
,
Text
,
comment
=
'投资策略'
),
Column
(
'advisor_id'
,
String
(
64
),
comment
=
'投资顾问id'
),
Column
(
'custodian_id'
,
String
(
64
),
comment
=
'托管银行Id'
),
Column
(
'broker_id'
,
String
(
64
),
comment
=
'证券经纪人Id'
),
Column
(
'broker_future_id'
,
String
(
64
),
comment
=
'期货经纪人id'
),
Column
(
'liquidation_agency_id'
,
String
(
64
),
comment
=
'外包机构Id'
),
Column
(
'trust_id'
,
String
(
64
),
comment
=
'基金管理公司Id'
),
Column
(
'investment_consultant_id'
,
String
(
64
),
comment
=
'投资顾问Id'
),
Column
(
'administrator_id'
,
String
(
64
),
comment
=
'行政管理人Id'
),
Column
(
'legal_counsel_id'
,
String
(
64
),
comment
=
'法律顾问Id'
),
Column
(
'auditor_id'
,
String
(
64
),
comment
=
'审计机构'
),
Column
(
'nav_frequency'
,
INTEGER
(
3
),
comment
=
'净值披露频率 1:天 2:周 3:月 4:半月 5:季度'
),
Column
(
'performance_disclosure_mark'
,
INTEGER
(
4
),
comment
=
'产品业绩披露标识:1-AAA,2-AA,3-A,4-A-,5-A+'
),
Column
(
'register_number'
,
String
(
20
),
comment
=
'备案编码'
),
Column
(
'register_date'
,
Date
,
comment
=
'备案日期'
),
Column
(
'isvisible'
,
INTEGER
(
4
),
comment
=
'基金在前台是否可见:1-可见 0-不可见'
),
Column
(
'istiered'
,
INTEGER
(
4
),
comment
=
'是否分级:1-分级,0-不分级;'
),
Column
(
'is_ranking'
,
INTEGER
(
4
),
comment
=
'是否参与排名,1-参与排名 0-不参与排名
\t
'
),
Column
(
'is_rating'
,
INTEGER
(
4
),
comment
=
'是否参与评级,1-参与评级 0-不参与评级
\t
'
),
Column
(
'special_tips'
,
String
(
300
),
comment
=
'基金协会特别提示'
),
Column
(
'amac_url'
,
String
(
255
),
comment
=
'基金协会链接'
),
Column
(
'nav_source_type'
,
INTEGER
(
4
),
comment
=
'净值来源说明:1-托管外包、2-信托券商官网、3-私募机构'
),
Column
(
'combine_target'
,
Text
,
comment
=
'组合目标'
),
Column
(
'fit_group'
,
Text
,
comment
=
'适合群体'
),
Column
(
'combine_comment'
,
Text
,
comment
=
'组合点评'
),
Column
(
'transfer_comment'
,
Text
,
comment
=
'调仓点评'
),
Column
(
'desc_info'
,
String
(
512
),
comment
=
'基金描述'
),
Column
(
'strategy'
,
INTEGER
(
4
),
comment
=
'融智策略分类,1-股票策略,2-宏观策略,3-管理期货,4-事件驱动,5-相对价值策略,6-固定收益策略,7-组合基金,8-复合策略,-1-其它策略'
),
Column
(
'substrategy'
,
INTEGER
(
4
),
comment
=
"融智子策略分类:1010-主观多头 1020-股票多空 1030-量化多头 2010-宏观策略 3010-主观趋势 3020-主观套利 3030-量化趋势 3040-量化套利 3050-管理期货复合 4010-并购重组 4020-定向增发 4030-大宗交易 4040-事件驱动复合 5010-股票市场中性 5020-套利 5030-相对价值复合 6010-纯债策略 6020-强债策略 6030-固收复合 7010-MOM 7020-FOF 8010-主观多策略 8020-量化多策略 -1-其他策略'"
),
Column
(
'risk_level'
,
INTEGER
(
1
),
comment
=
'风险等级'
),
Column
(
'create_by'
,
String
(
64
)),
Column
(
'create_time'
,
DateTime
),
Column
(
'update_by'
,
String
(
64
)),
Column
(
'update_time'
,
DateTime
),
Column
(
'data_sources'
,
INTEGER
(
5
),
nullable
=
False
,
server_default
=
text
(
"'1'"
),
comment
=
'数据来源 1:tanpu,2:私募排排'
),
Column
(
'status'
,
INTEGER
(
1
),
comment
=
'0:待上架 1:已上架 2:已下架'
),
Column
(
'delete_tag'
,
INTEGER
(
3
),
nullable
=
False
,
server_default
=
text
(
"'0'"
),
comment
=
'删除标识 0:否 1:是'
),
Column
(
'sort'
,
INTEGER
(
10
),
nullable
=
False
,
server_default
=
text
(
"'0'"
),
comment
=
'排序'
),
)
class
FundManagerMapping
(
Base
,
BaseModel
):
class
FundManagerMapping
(
Base
,
BaseModel
):
...
...
app/model/tamp_user_models.py
View file @
1f273295
...
@@ -3,7 +3,7 @@ from sqlalchemy import Column, DECIMAL, Date, DateTime, ForeignKeyConstraint, In
...
@@ -3,7 +3,7 @@ from sqlalchemy import Column, DECIMAL, Date, DateTime, ForeignKeyConstraint, In
from
sqlalchemy.dialects.mysql
import
BIGINT
,
INTEGER
,
MEDIUMTEXT
,
SMALLINT
,
VARCHAR
from
sqlalchemy.dialects.mysql
import
BIGINT
,
INTEGER
,
MEDIUMTEXT
,
SMALLINT
,
VARCHAR
from
sqlalchemy.orm
import
relationship
from
sqlalchemy.orm
import
relationship
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy.ext.declarative
import
declarative_base
from
app.model.base
import
Base
,
BaseModel
,
metadata
from
app.model.base
import
Base
,
BaseModel
class
Account
(
Base
,
BaseModel
):
class
Account
(
Base
,
BaseModel
):
...
@@ -997,19 +997,19 @@ class CurriculumRe(Base, BaseModel):
...
@@ -997,19 +997,19 @@ class CurriculumRe(Base, BaseModel):
info
=
Column
(
String
(
255
),
server_default
=
text
(
"''"
),
comment
=
'简介'
)
info
=
Column
(
String
(
255
),
server_default
=
text
(
"''"
),
comment
=
'简介'
)
cover
=
Column
(
String
(
255
),
nullable
=
False
,
server_default
=
text
(
"''"
),
comment
=
'封面'
)
cover
=
Column
(
String
(
255
),
nullable
=
False
,
server_default
=
text
(
"''"
),
comment
=
'封面'
)
#
t_curriculum_share_config
=
Table
(
#
t_curriculum_share_config = Table(
'curriculum_share_config'
,
metadata
,
#
'curriculum_share_config', metadata,
Column
(
'id'
,
String
(
64
),
nullable
=
False
,
comment
=
'主键'
),
#
Column('id', String(64), nullable=False, comment='主键'),
Column
(
'title'
,
String
(
50
),
nullable
=
False
,
comment
=
'分享标题'
),
#
Column('title', String(50), nullable=False, comment='分享标题'),
Column
(
'content'
,
String
(
100
),
nullable
=
False
,
comment
=
'分享内容'
),
#
Column('content', String(100), nullable=False, comment='分享内容'),
Column
(
'cover'
,
String
(
100
),
nullable
=
False
,
comment
=
'封面'
),
#
Column('cover', String(100), nullable=False, comment='封面'),
Column
(
'rel_id'
,
String
(
64
),
nullable
=
False
,
comment
=
'关联id'
),
#
Column('rel_id', String(64), nullable=False, comment='关联id'),
Column
(
'create_time'
,
DateTime
,
nullable
=
False
,
comment
=
'创建内容'
),
#
Column('create_time', DateTime, nullable=False, comment='创建内容'),
Column
(
'update_time'
,
DateTime
,
nullable
=
False
,
comment
=
'更新时间'
),
#
Column('update_time', DateTime, nullable=False, comment='更新时间'),
Column
(
'create_by'
,
String
(
64
),
nullable
=
False
,
comment
=
'创建人'
),
#
Column('create_by', String(64), nullable=False, comment='创建人'),
comment
=
'课程分享配置'
#
comment='课程分享配置'
)
#
)
class
CurriculumSubject
(
Base
,
BaseModel
):
class
CurriculumSubject
(
Base
,
BaseModel
):
...
@@ -1078,31 +1078,31 @@ class CurriculumTeacher(Base, BaseModel):
...
@@ -1078,31 +1078,31 @@ class CurriculumTeacher(Base, BaseModel):
ct_user_id
=
Column
(
String
(
64
),
comment
=
'关联用户'
)
ct_user_id
=
Column
(
String
(
64
),
comment
=
'关联用户'
)
t_customer_ifa_rel
=
Table
(
#
t_customer_ifa_rel = Table(
'customer_ifa_rel'
,
metadata
,
#
'customer_ifa_rel', metadata,
Column
(
'id'
,
String
(
64
),
nullable
=
False
,
comment
=
'主键'
),
#
Column('id', String(64), nullable=False, comment='主键'),
Column
(
'user_id'
,
String
(
64
),
nullable
=
False
,
comment
=
'理财师id'
),
#
Column('user_id', String(64), nullable=False, comment='理财师id'),
Column
(
'customer_id'
,
String
(
64
),
nullable
=
False
,
comment
=
'客户id'
),
#
Column('customer_id', String(64), nullable=False, comment='客户id'),
Column
(
'create_time'
,
DateTime
,
nullable
=
False
,
comment
=
'创建时间'
),
#
Column('create_time', DateTime, nullable=False, comment='创建时间'),
Column
(
'create_by'
,
String
(
64
),
nullable
=
False
,
comment
=
'创建人'
),
#
Column('create_by', String(64), nullable=False, comment='创建人'),
Column
(
'update_time'
,
DateTime
,
comment
=
'更时间'
),
#
Column('update_time', DateTime, comment='更时间'),
Column
(
'update_by'
,
String
(
64
),
comment
=
' 更新人'
),
#
Column('update_by', String(64), comment=' 更新人'),
Column
(
'delete_id'
,
INTEGER
(
1
),
nullable
=
False
,
server_default
=
text
(
"'0'"
),
comment
=
'删除标识'
),
#
Column('delete_id', INTEGER(1), nullable=False, server_default=text("'0'"), comment='删除标识'),
comment
=
'客户理财师关联表'
#
comment='客户理财师关联表'
)
#
)
t_customer_info
=
Table
(
#
t_customer_info = Table(
'customer_info'
,
metadata
,
#
'customer_info', metadata,
Column
(
'id'
,
String
(
64
),
nullable
=
False
,
comment
=
'主键'
),
#
Column('id', String(64), nullable=False, comment='主键'),
Column
(
'customer_name'
,
String
(
50
),
server_default
=
text
(
"''"
),
comment
=
'客户姓名'
),
#
Column('customer_name', String(50), server_default=text("''"), comment='客户姓名'),
Column
(
'create_time'
,
DateTime
,
comment
=
'创建时间'
),
#
Column('create_time', DateTime, comment='创建时间'),
Column
(
'create_by'
,
String
(
64
),
server_default
=
text
(
"''"
),
comment
=
'创建人'
),
#
Column('create_by', String(64), server_default=text("''"), comment='创建人'),
Column
(
'update_time'
,
DateTime
,
comment
=
'更新时间'
),
#
Column('update_time', DateTime, comment='更新时间'),
Column
(
'update_by'
,
String
(
64
),
comment
=
'更新人'
),
#
Column('update_by', String(64), comment='更新人'),
Column
(
'delete_tag'
,
INTEGER
(
1
),
server_default
=
text
(
"'0'"
),
comment
=
'删除标识'
),
#
Column('delete_tag', INTEGER(1), server_default=text("'0'"), comment='删除标识'),
comment
=
'客户表'
#
comment='客户表'
)
#
)
class
CustomerInfo
(
Base
,
BaseModel
):
class
CustomerInfo
(
Base
,
BaseModel
):
...
@@ -1117,27 +1117,27 @@ class CustomerInfo(Base, BaseModel):
...
@@ -1117,27 +1117,27 @@ class CustomerInfo(Base, BaseModel):
delete_tag
=
Column
(
INTEGER
(
1
),
server_default
=
text
(
"'0'"
),
comment
=
'删除标识'
)
delete_tag
=
Column
(
INTEGER
(
1
),
server_default
=
text
(
"'0'"
),
comment
=
'删除标识'
)
t_customer_order
=
Table
(
#
t_customer_order = Table(
'customer_order'
,
metadata
,
#
'customer_order', metadata,
Column
(
'id'
,
String
(
64
),
nullable
=
False
,
comment
=
'主键id'
),
#
Column('id', String(64), nullable=False, comment='主键id'),
Column
(
'user_id'
,
String
(
64
),
server_default
=
text
(
"''"
),
comment
=
'理财师id'
),
#
Column('user_id', String(64), server_default=text("''"), comment='理财师id'),
Column
(
'customer_id'
,
String
(
64
),
server_default
=
text
(
"''"
),
comment
=
'客户id'
),
#
Column('customer_id', String(64), server_default=text("''"), comment='客户id'),
Column
(
'folio_name'
,
VARCHAR
(
64
),
server_default
=
text
(
"'default'"
),
comment
=
'组合名称,默认default,可以单用户多组合'
),
#
Column('folio_name', VARCHAR(64), server_default=text("'default'"), comment='组合名称,默认default,可以单用户多组合'),
Column
(
'fund_id'
,
String
(
64
),
server_default
=
text
(
"''"
),
comment
=
'产品id'
),
#
Column('fund_id', String(64), server_default=text("''"), comment='产品id'),
Column
(
'order_type'
,
INTEGER
(
1
),
comment
=
'1:申购 2:赎回'
),
#
Column('order_type', INTEGER(1), comment='1:申购 2:赎回'),
Column
(
'pay_date'
,
Date
,
comment
=
'打款日期'
),
#
Column('pay_date', Date, comment='打款日期'),
Column
(
'subscription_fee'
,
DECIMAL
(
22
,
6
),
comment
=
'申购费'
),
#
Column('subscription_fee', DECIMAL(22, 6), comment='申购费'),
Column
(
'confirm_share_date'
,
Date
,
comment
=
'份额确认日期'
),
#
Column('confirm_share_date', Date, comment='份额确认日期'),
Column
(
'confirm_share'
,
DECIMAL
(
22
,
6
),
comment
=
'确认份额'
),
#
Column('confirm_share', DECIMAL(22, 6), comment='确认份额'),
Column
(
'confirm_amount'
,
DECIMAL
(
22
,
6
),
comment
=
'确认金额'
),
#
Column('confirm_amount', DECIMAL(22, 6), comment='确认金额'),
Column
(
'nav'
,
DECIMAL
(
22
,
6
),
comment
=
'净值'
),
#
Column('nav', DECIMAL(22, 6), comment='净值'),
Column
(
'remark'
,
String
(
255
),
comment
=
'备注'
),
#
Column('remark', String(255), comment='备注'),
Column
(
'create_time'
,
DateTime
,
comment
=
'创建时间'
),
#
Column('create_time', DateTime, comment='创建时间'),
Column
(
'create_by'
,
String
(
64
),
comment
=
'创建时间'
),
#
Column('create_by', String(64), comment='创建时间'),
Column
(
'update_time'
,
DateTime
,
comment
=
'更新时间'
),
#
Column('update_time', DateTime, comment='更新时间'),
Column
(
'update_by'
,
String
(
64
),
comment
=
'更新人'
),
#
Column('update_by', String(64), comment='更新人'),
comment
=
'客户订单'
#
comment='客户订单'
)
#
)
class
CustomerOrder
(
Base
,
BaseModel
):
class
CustomerOrder
(
Base
,
BaseModel
):
...
@@ -2281,19 +2281,19 @@ class SystemNotice(Base, BaseModel):
...
@@ -2281,19 +2281,19 @@ class SystemNotice(Base, BaseModel):
delete_tag
=
Column
(
INTEGER
(
1
),
comment
=
'删除标识'
)
delete_tag
=
Column
(
INTEGER
(
1
),
comment
=
'删除标识'
)
t_system_switch
=
Table
(
#
t_system_switch = Table(
'system_switch'
,
metadata
,
#
'system_switch', metadata,
Column
(
'id'
,
String
(
64
),
nullable
=
False
,
server_default
=
text
(
"''"
),
comment
=
'唯一主键'
),
#
Column('id', String(64), nullable=False, server_default=text("''"), comment='唯一主键'),
Column
(
'ss_name'
,
String
(
64
),
comment
=
'名称'
),
#
Column('ss_name', String(64), comment='名称'),
Column
(
'ss_key'
,
String
(
64
),
comment
=
'key'
),
#
Column('ss_key', String(64), comment='key'),
Column
(
'ss_value'
,
String
(
64
),
comment
=
'value'
),
#
Column('ss_value', String(64), comment='value'),
Column
(
'ss_desc'
,
String
(
256
),
comment
=
'描述'
),
#
Column('ss_desc', String(256), comment='描述'),
Column
(
'createtime'
,
DateTime
,
comment
=
'创建时间'
),
#
Column('createtime', DateTime, comment='创建时间'),
Column
(
'createby'
,
String
(
64
),
comment
=
'创建人'
),
#
Column('createby', String(64), comment='创建人'),
Column
(
'updatetime'
,
DateTime
,
comment
=
'修改时间'
),
#
Column('updatetime', DateTime, comment='修改时间'),
Column
(
'updateby'
,
String
(
64
),
comment
=
'修改人'
),
#
Column('updateby', String(64), comment='修改人'),
Column
(
'deletetag'
,
String
(
3
),
comment
=
'删除标识'
)
#
Column('deletetag', String(3), comment='删除标识')
)
#
)
class
Tag
(
Base
,
BaseModel
):
class
Tag
(
Base
,
BaseModel
):
...
@@ -2323,16 +2323,16 @@ class TagCategory(Base, BaseModel):
...
@@ -2323,16 +2323,16 @@ class TagCategory(Base, BaseModel):
delete_tag
=
Column
(
INTEGER
(
1
),
comment
=
'删除标识'
)
delete_tag
=
Column
(
INTEGER
(
1
),
comment
=
'删除标识'
)
t_tag_rel
=
Table
(
#
t_tag_rel = Table(
'tag_rel'
,
metadata
,
#
'tag_rel', metadata,
Column
(
'id'
,
String
(
64
),
nullable
=
False
,
comment
=
'主键id'
),
#
Column('id', String(64), nullable=False, comment='主键id'),
Column
(
'tag_id'
,
String
(
64
),
nullable
=
False
,
index
=
True
,
comment
=
'标签id'
),
#
Column('tag_id', String(64), nullable=False, index=True, comment='标签id'),
Column
(
'rel_id'
,
String
(
64
),
nullable
=
False
,
index
=
True
,
comment
=
'关联id'
),
#
Column('rel_id', String(64), nullable=False, index=True, comment='关联id'),
Column
(
'rel_type'
,
INTEGER
(
1
),
nullable
=
False
,
comment
=
'关联类型'
),
#
Column('rel_type', INTEGER(1), nullable=False, comment='关联类型'),
Column
(
'tag_category_id'
,
String
(
64
),
nullable
=
False
,
comment
=
'标签分类'
),
#
Column('tag_category_id', String(64), nullable=False, comment='标签分类'),
Column
(
'tag_category_name'
,
String
(
64
),
nullable
=
False
,
comment
=
'标签分类'
),
#
Column('tag_category_name', String(64), nullable=False, comment='标签分类'),
Column
(
'create_time'
,
DateTime
,
nullable
=
False
,
comment
=
'创建时间'
)
#
Column('create_time', DateTime, nullable=False, comment='创建时间')
)
#
)
class
TaskSchedule
(
Base
,
BaseModel
):
class
TaskSchedule
(
Base
,
BaseModel
):
...
@@ -2406,12 +2406,12 @@ class TeamProduct(Base, BaseModel):
...
@@ -2406,12 +2406,12 @@ class TeamProduct(Base, BaseModel):
delete_tag
=
Column
(
INTEGER
(
1
),
comment
=
'删除标识'
)
delete_tag
=
Column
(
INTEGER
(
1
),
comment
=
'删除标识'
)
t_test
=
Table
(
#
t_test = Table(
'test'
,
metadata
,
#
'test', metadata,
Column
(
'id'
,
INTEGER
(
11
)),
#
Column('id', INTEGER(11)),
Column
(
'createby'
,
String
(
12
)),
#
Column('createby', String(12)),
Column
(
'faid'
,
String
(
12
))
#
Column('faid', String(12))
)
#
)
class
ThreadTask
(
Base
,
BaseModel
):
class
ThreadTask
(
Base
,
BaseModel
):
...
@@ -3091,44 +3091,44 @@ class UserInfoExt(Base, BaseModel):
...
@@ -3091,44 +3091,44 @@ class UserInfoExt(Base, BaseModel):
weshop_poster_new
=
Column
(
Text
,
comment
=
'微店模版(新版)'
)
weshop_poster_new
=
Column
(
Text
,
comment
=
'微店模版(新版)'
)
t_user_info_history
=
Table
(
#
t_user_info_history = Table(
'user_info_history'
,
metadata
,
#
'user_info_history', metadata,
Column
(
'id'
,
String
(
128
),
comment
=
'唯一主键'
),
#
Column('id', String(128), comment='唯一主键'),
Column
(
'ui_openid'
,
String
(
128
),
comment
=
'微信openId'
),
#
Column('ui_openid', String(128), comment='微信openId'),
Column
(
'ui_telphone'
,
String
(
16
),
comment
=
'手机号'
),
#
Column('ui_telphone', String(16), comment='手机号'),
Column
(
'ui_nickname'
,
String
(
64
),
comment
=
'昵称'
),
#
Column('ui_nickname', String(64), comment='昵称'),
Column
(
'ui_headimg'
,
String
(
256
),
comment
=
'头像'
),
#
Column('ui_headimg', String(256), comment='头像'),
Column
(
'ui_username'
,
String
(
64
),
comment
=
'姓名'
),
#
Column('ui_username', String(64), comment='姓名'),
Column
(
'ui_sex'
,
String
(
3
),
comment
=
'性别'
),
#
Column('ui_sex', String(3), comment='性别'),
Column
(
'ui_birthday'
,
DateTime
,
comment
=
'生日'
),
#
Column('ui_birthday', DateTime, comment='生日'),
Column
(
'ui_introduction'
,
String
(
256
),
comment
=
'个人介绍'
),
#
Column('ui_introduction', String(256), comment='个人介绍'),
Column
(
'ui_type_mp'
,
String
(
3
),
comment
=
'名片样式'
),
#
Column('ui_type_mp', String(3), comment='名片样式'),
Column
(
'ui_headimg_mp'
,
String
(
256
),
comment
=
'名片头像'
),
#
Column('ui_headimg_mp', String(256), comment='名片头像'),
Column
(
'ui_username_mp'
,
String
(
32
),
comment
=
'名片姓名'
),
#
Column('ui_username_mp', String(32), comment='名片姓名'),
Column
(
'ui_telphone_mp'
,
String
(
16
),
comment
=
'名片电话'
),
#
Column('ui_telphone_mp', String(16), comment='名片电话'),
Column
(
'ui_mobilephone_mp'
,
String
(
16
),
comment
=
'名片手机'
),
#
Column('ui_mobilephone_mp', String(16), comment='名片手机'),
Column
(
'ui_company_mp'
,
String
(
128
),
comment
=
'名片公司'
),
#
Column('ui_company_mp', String(128), comment='名片公司'),
Column
(
'ui_company_address_mp'
,
String
(
128
),
comment
=
'名片公司地址'
),
#
Column('ui_company_address_mp', String(128), comment='名片公司地址'),
Column
(
'ui_position_mp'
,
String
(
128
),
comment
=
'名片职位'
),
#
Column('ui_position_mp', String(128), comment='名片职位'),
Column
(
'ui_email_mp'
,
String
(
128
),
comment
=
'名片邮箱'
),
#
Column('ui_email_mp', String(128), comment='名片邮箱'),
Column
(
'ui_introduction_mp'
,
String
(
256
),
comment
=
'名片个人介绍'
),
#
Column('ui_introduction_mp', String(256), comment='名片个人介绍'),
Column
(
'ui_wechat_qrcode'
,
String
(
256
),
comment
=
'微信个人二维码'
),
#
Column('ui_wechat_qrcode', String(256), comment='微信个人二维码'),
Column
(
'ui_type'
,
String
(
3
),
comment
=
'类型'
),
#
Column('ui_type', String(3), comment='类型'),
Column
(
'ui_shenfen'
,
String
(
3
),
comment
=
'用户身份'
),
#
Column('ui_shenfen', String(3), comment='用户身份'),
Column
(
'ui_rzstatus'
,
INTEGER
(
3
),
comment
=
'用户认证状态'
),
#
Column('ui_rzstatus', INTEGER(3), comment='用户认证状态'),
Column
(
'org_id'
,
String
(
64
),
comment
=
'机构Id'
),
#
Column('org_id', String(64), comment='机构Id'),
Column
(
'team_id'
,
String
(
64
),
comment
=
'团队Id'
),
#
Column('team_id', String(64), comment='团队Id'),
Column
(
'join_time'
,
DateTime
,
comment
=
'加入团队时间'
),
#
Column('join_time', DateTime, comment='加入团队时间'),
Column
(
'staff_no'
,
String
(
128
),
comment
=
'员工工号'
),
#
Column('staff_no', String(128), comment='员工工号'),
Column
(
'investor_certified_status'
,
INTEGER
(
1
),
comment
=
'合格投资者认证状态'
),
#
Column('investor_certified_status', INTEGER(1), comment='合格投资者认证状态'),
Column
(
'investor_certified_time'
,
DateTime
,
comment
=
'合格投资者认证时间'
),
#
Column('investor_certified_time', DateTime, comment='合格投资者认证时间'),
Column
(
'createtime'
,
DateTime
,
comment
=
'创建时间'
),
#
Column('createtime', DateTime, comment='创建时间'),
Column
(
'createby'
,
String
(
64
),
comment
=
'创建人'
),
#
Column('createby', String(64), comment='创建人'),
Column
(
'updatetime'
,
DateTime
,
comment
=
'修改时间'
),
#
Column('updatetime', DateTime, comment='修改时间'),
Column
(
'updateby'
,
String
(
64
),
comment
=
'修改人'
),
#
Column('updateby', String(64), comment='修改人'),
Column
(
'deletetag'
,
String
(
3
),
comment
=
'删除标识'
),
#
Column('deletetag', String(3), comment='删除标识'),
Column
(
'version_time'
,
DateTime
,
comment
=
'版本时间'
)
#
Column('version_time', DateTime, comment='版本时间')
)
#
)
class
UserInvestorRz
(
Base
,
BaseModel
):
class
UserInvestorRz
(
Base
,
BaseModel
):
...
...
app/service/data_service.py
View file @
1f273295
...
@@ -12,19 +12,23 @@ from sqlalchemy import and_
...
@@ -12,19 +12,23 @@ from sqlalchemy import and_
import
tushare
as
ts
import
tushare
as
ts
import
datetime
import
datetime
from
app.api.engine
import
tamp_user_session
,
tamp_product_session
from
app.api.engine
import
tamp_user_session
,
tamp_product_session
from
app.model.tamp_user_models
import
t_customer_order
,
t_customer_info
#
from app.model.tamp_user_models import t_customer_order, t_customer_info
from
app.model.tamp_product_models
import
t_fund_info
#
from app.model.tamp_product_models import t_fund_info
class
UserCustomerDataAdaptor
:
class
UserCustomerDataAdaptor
:
user_id
=
""
user_id
=
""
customer_id
=
""
customer_id
=
""
start_date
=
""
start_date
=
""
end_date
=
""
group_data
=
{}
group_data
=
{}
def
__init__
(
self
,
user_id
,
customer_id
):
def
__init__
(
self
,
user_id
,
customer_id
,
end_date
=
str
(
datetime
.
date
.
today
())
):
self
.
user_id
=
user_id
self
.
user_id
=
user_id
self
.
customer_id
=
customer_id
self
.
customer_id
=
customer_id
p_end_date
=
pd
.
to_datetime
(
end_date
)
.
date
()
p_end_date
=
datetime
.
date
(
year
=
p_end_date
.
year
,
month
=
p_end_date
.
month
,
day
=
1
)
-
datetime
.
timedelta
(
days
=
1
)
self
.
end_date
=
pd
.
to_datetime
(
str
(
p_end_date
))
self
.
user_customer_order_df
=
self
.
get_user_customer_order_data
()
self
.
user_customer_order_df
=
self
.
get_user_customer_order_data
()
self
.
fund_nav_total
=
self
.
get_customer_fund_nav_data
()
self
.
fund_nav_total
=
self
.
get_customer_fund_nav_data
()
self
.
get_customer_index_nav_data
()
self
.
get_customer_index_nav_data
()
...
@@ -69,7 +73,6 @@ class UserCustomerDataAdaptor:
...
@@ -69,7 +73,6 @@ class UserCustomerDataAdaptor:
# 获取客户持有的基金净值数据
# 获取客户持有的基金净值数据
def
get_customer_fund_nav_data
(
self
):
def
get_customer_fund_nav_data
(
self
):
now_date
=
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y
%
m
%
d"
)
now_date
=
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y
%
m
%
d"
)
# trade_date_df = self.get_trade_cal(str(self.start_date).replace("-", ""), now_date)
trade_date_df
=
self
.
get_trade_cal
(
"20000101"
,
now_date
)
trade_date_df
=
self
.
get_trade_cal
(
"20000101"
,
now_date
)
all_fund_nav
=
pd
.
DataFrame
(
index
=
trade_date_df
[
"datetime"
])
all_fund_nav
=
pd
.
DataFrame
(
index
=
trade_date_df
[
"datetime"
])
...
@@ -88,9 +91,10 @@ class UserCustomerDataAdaptor:
...
@@ -88,9 +91,10 @@ class UserCustomerDataAdaptor:
# cur_fund_distribution_df = pd.DataFrame(list(data), columns=['price_date', 'distribution'])
# cur_fund_distribution_df = pd.DataFrame(list(data), columns=['price_date', 'distribution'])
cur_fund_nav_df
[
"price_date"
]
=
pd
.
to_datetime
(
cur_fund_nav_df
[
"price_date"
])
cur_fund_nav_df
[
"price_date"
]
=
pd
.
to_datetime
(
cur_fund_nav_df
[
"price_date"
])
cur_fund_nav_df
.
set_index
(
"price_date"
,
inplace
=
True
)
cur_fund_nav_df
.
set_index
(
"price_date"
,
inplace
=
True
)
all_fund_nav
[
cur_fund_id
]
=
cur_fund_nav_df
[
"cnav"
]
all_fund_nav
[
cur_fund_id
]
=
cur_fund_nav_df
[
"cnav"
]
all_fund_nav
=
all_fund_nav
[
all_fund_nav
.
index
<=
self
.
end_date
]
return
all_fund_nav
return
all_fund_nav
# 获取客户对比指数净值数据
# 获取客户对比指数净值数据
...
@@ -114,6 +118,34 @@ class UserCustomerDataAdaptor:
...
@@ -114,6 +118,34 @@ class UserCustomerDataAdaptor:
fund_id_list
=
list
(
self
.
user_customer_order_df
[
"fund_id"
]
.
unique
())
fund_id_list
=
list
(
self
.
user_customer_order_df
[
"fund_id"
]
.
unique
())
fund_id_list
.
append
(
"index"
)
fund_id_list
.
append
(
"index"
)
cur_folio_nav_df
=
self
.
fund_nav_total
[
fund_id_list
]
cur_folio_nav_df
=
self
.
fund_nav_total
[
fund_id_list
]
self
.
signal_folio_operate
(
folio
,
cur_folio_order_df
,
cur_folio_nav_df
)
continue
continue
# 单个组合数据操作
def
signal_folio_operate
(
self
,
p_folio
,
p_order_df
,
p_nav_df
):
start_date
=
pd
.
to_datetime
(
p_order_df
[
"confirm_share_date"
]
.
min
())
nav_df
=
p_nav_df
[
p_nav_df
.
index
>=
start_date
]
.
copy
()
for
index
,
row
in
p_order_df
.
iterrows
():
cur_fund_id
=
str
(
row
[
"fund_id"
])
confirm_share_date
=
pd
.
to_datetime
(
row
[
"confirm_share_date"
])
if
cur_fund_id
+
"_amount"
not
in
nav_df
:
nav_df
[
cur_fund_id
+
"_profit"
]
=
(
nav_df
[
cur_fund_id
]
.
dropna
()
-
nav_df
[
cur_fund_id
]
.
dropna
()
.
shift
(
1
))
nav_df
[
cur_fund_id
+
"_amount"
]
=
0
nav_df
[
cur_fund_id
+
"_earn"
]
=
0
nav_df
[
cur_fund_id
+
"_share"
]
=
0
# buy
if
row
[
'order_type'
]
==
1
:
nav_df
.
loc
[
confirm_share_date
:,
cur_fund_id
+
"_amount"
]
+=
row
[
"confirm_amount"
]
nav_df
.
loc
[
confirm_share_date
:,
cur_fund_id
+
"_share"
]
+=
row
[
"confirm_share"
]
# sell
elif
row
[
'order_type'
]
==
2
:
nav_df
.
loc
[
confirm_share_date
:,
cur_fund_id
+
"_amount"
]
-=
row
[
"confirm_amount"
]
nav_df
.
loc
[
confirm_share_date
:,
cur_fund_id
+
"_share"
]
-=
row
[
"confirm_share"
]
nav_df
[
cur_fund_id
+
"_earn"
]
=
nav_df
[
cur_fund_id
+
"_profit"
]
*
nav_df
[
cur_fund_id
+
"_share"
]
self
.
group_data
[
p_folio
]
=
{
"basic_data"
:
nav_df
}
return
nav_df
app/service/result_service.py
0 → 100644
View file @
1f273295
#!/usr/bin/python3.6
# -*- coding: utf-8 -*-
# @Time : 2020/11/23 15:29
# @Author : Jie. Z
# @Email : zhaojiestudy@163.com
# @File : result_service.py
# @Software: PyCharm
import
pandas
as
pd
import
numpy
as
np
import
datetime
from
app.service.data_service
import
UserCustomerDataAdaptor
class
UserCustomerResultAdaptor
(
UserCustomerDataAdaptor
):
def
__init__
(
self
,
user_id
,
customer_id
,
end_date
=
str
(
datetime
.
date
.
today
())):
UserCustomerDataAdaptor
.
__init__
(
user_id
,
customer_id
,
end_date
)
# 综述数据
def
get_total_data
(
self
):
pass
# 组合数据
def
get_group_data
(
self
):
pass
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