# coding: utf-8
from sqlalchemy import Column, DECIMAL, Date, DateTime, String, TIMESTAMP, 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.ext.declarative import declarative_base
from app.model.base import Base, BaseModel


class CompanyInfo(Base, BaseModel):
    __tablename__ = 'company_info'
    __table_args__ = {'comment': '公司基本信息表'}

    id = Column(String(64), primary_key=True)
    p_company_id = Column(String(64), comment='公司id')
    company_name = Column(String(255), comment='公司中文全称')
    company_short_name = Column(String(80), comment='公司中文简称')
    company_english_name = Column(String(255), comment='基金管理人全称（英文）')
    company_type = Column(INTEGER(11), comment='公司类型：1-私募证券投资、2-公募基金公司、3-银行、4-证券公司、5-信托公司、6-审计机构，7-法律顾问，8-投资顾问，9-行政管理人,10-上市公司，11-期货公司，12-基金公司子公司，13工作室，14-私募股权投资，15-证券公司子公司，16-期货公司子公司，17-私募创业投资，-1-私募其他投资')
    organization_number = Column(String(20), comment='组织机构代码')
    establish_date = Column(Date, comment='公司成立日期')
    domicile_id = Column(INTEGER(11), comment='公司注册国家：1-中国大陆、2-香港、3-新加坡、4-开曼群岛、5-台湾、6-英属维尔京群岛BVI、-1-其他')
    company_address = Column(String(255), comment='公司注册地址')
    company_address2 = Column(String(255), comment='办公地址')
    city = Column(String(100), comment='城市')
    province = Column(String(100), comment='省')
    country = Column(String(100), comment='国家')
    reg_city = Column(String(100), comment='注册城市')
    reg_province = Column(String(100), comment='注册省')
    reg_country = Column(String(100), comment='注册国家')
    contact_phone = Column(String(20), comment='联系电话')
    post_code = Column(String(40), comment='邮政编码')
    fax = Column(String(20), comment='传真')
    email = Column(String(40), comment='邮箱')
    website = Column(String(255), comment='公司网址')
    registered_capital = Column(DECIMAL(22, 6), comment='公司注册资本，<量纲：万元>\t')
    company_profile = Column(Text, comment='公司简介')
    offshore_fund = Column(INTEGER(11), comment='是否有海外基金，0-否，1-是，-1-其他')
    philosopy = Column(Text, comment='投资理念')
    company_status = Column(INTEGER(11), comment='公司状态：1-运行；2-注销')
    base_currency_crc = Column(INTEGER(11), comment='公司注册资本货币单位：1-人民币，2-港币，3-美元，-1-其他')
    register_number = Column(String(20), comment='备案编码')
    register_status = Column(INTEGER(4), comment='备案状态：0-未备案,1-备案注销,2-备案存续')
    register_date = Column(Date, comment='备案日期')
    register_number_address = Column(String(255), comment='备案地址')
    is_member = Column(TINYINT(4), comment='是否会员：1-是，0-否')
    join_date = Column(Date, comment='入会时间')
    member_type = Column(INTEGER(4), comment='会员类型：1-普通会员、2-联席会员、3-观察会员、4-特别会员')
    fund_category_ori = Column(String(50), comment='管理基金主要类别（与中基协同步）')
    business_type = Column(String(50), comment='业务类型')
    nature_business_type = Column(INTEGER(4), comment='企业性质:1 中外合作企业 2中外合资企业 3内资企业 4境外机构 5外商独资企业 6政府机构')
    capital_paid_rate = Column(DECIMAL(22, 6), comment='注册资本实缴比例')
    logo = Column(String(255), comment='公司logo')
    isvisible = Column(INTEGER(11), comment='公司是否在前台可见')
    paid_capital = Column(DECIMAL(22, 6), comment='实缴资本(万元)(人民币)')
    company_asset_size = Column(INTEGER(4), comment='公司资产规模 1:0-1亿 2:1-10亿 3:10-20亿 4:20-50亿 5:50-100亿 6:100亿以上')
    legal_representative = Column(String(100), comment='法人代表')
    representative_experience = Column(MEDIUMTEXT, comment='法人代表履历')
    is_qualify = Column(INTEGER(11), comment='是否认证 0:否 1:是')
    get_qualify_method = Column(String(50), comment='法人从业资格获得方式')
    employee_cnts = Column(INTEGER(11), comment='员工人数')
    integrity_info = Column(String(500), comment='信信息')
    special_tips = Column(String(300), comment='提示信息')
    amac_link = Column(String(200), comment='协会网站链接')
    create_time = Column(DateTime, comment='创建时间')
    create_by = Column(String(64), comment='创建人')
    update_time = Column(DateTime, comment='修改时间')
    update_by = Column(String(64), comment='修改人')
    delete_tag = Column(INTEGER(1), nullable=False, server_default=text("'0'"), comment='删除标识')


class CompanyTnaPersonnel(Base, BaseModel):
    __tablename__ = 'company_tna_personnel'
    __table_args__ = {'comment': '公司管理资产及人员变动统计'}

    id = Column(String(64), primary_key=True, comment='主键ID')
    company_id = Column(String(64), nullable=False, comment='公司id')
    stat_date = Column(Date, nullable=False, comment='统计日期')
    trust_fund_asset_size = Column(DECIMAL(22, 6), comment='信托管理总资产规模，<量纲：亿元>')
    special_account_asset_size = Column(DECIMAL(22, 6), comment='专户管理总资产规模，<量纲：亿元>')
    ltdco_fund_asset_size = Column(DECIMAL(22, 6), comment='有限合伙管理总资产规模，<量纲：亿元>')
    offshore_fund_asset_size = Column(DECIMAL(22, 6), comment='海外基金管理总资产规模，<量纲：亿元>')
    fund_num = Column(INTEGER(11), comment='基金总数')
    staff_num = Column(INTEGER(11), comment='公司人数')
    analyst_num = Column(INTEGER(11), comment='投研人员数')
    total_asset_size = Column(DECIMAL(22, 6), comment='管理总资产规模，<量纲：亿元>\t')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(11), nullable=False, server_default=text("'0'"))


class ConfidenceIndex(Base, BaseModel):
    __tablename__ = 'confidence_index'
    __table_args__ = {'comment': '对冲基金经理信心指数'}

    id = Column(String(64), primary_key=True)
    index_id = Column(String(64), nullable=False, index=True, comment='指数id')
    index_name = Column(String(50), nullable=False, comment='指数全称')
    index_date = Column(Date, nullable=False, comment='指数日期')
    index_value = Column(DECIMAL(22, 6), nullable=False, comment='信心指数值')
    market_estimation_index = Column(DECIMAL(22, 6), nullable=False, comment='A股市场趋势预期信心指标值')
    position_plan_index = Column(DECIMAL(22, 6), nullable=False, comment='仓位增减持投资计划指标值')
    me_extrem_optimistic = Column(DECIMAL(22, 6), nullable=False, comment='市场趋势预期信心极度乐观人数百分比例；<量纲：%>')
    me_optimistic = Column(DECIMAL(22, 6), nullable=False, comment='市场趋势预期信乐观人数百分比例；<量纲：%>')
    me_netural = Column(DECIMAL(22, 6), nullable=False, comment='市场趋势预期信乐观人数百分比例；<量纲：%>')
    me_pessimistic = Column(DECIMAL(22, 6), nullable=False, comment='市场趋势预期信心悲观人数百分比例；<量纲：%>')
    me_extrem_pessimistic = Column(DECIMAL(22, 6), nullable=False, comment='市场趋势预期信心极度悲观人数百分比例；<量纲：%>')
    pp_increase_significant = Column(DECIMAL(22, 6), nullable=False, comment='计划大幅增仓人数百分比例；<量纲：%>')
    pp_increase = Column(DECIMAL(22, 6), nullable=False, comment='计划增仓人数百分比例；<量纲：%>')
    pp_unchange = Column(DECIMAL(22, 6), nullable=False, comment='计划仓位不变人数百分比例；<量纲：%>')
    pp_reduce = Column(DECIMAL(22, 6), nullable=False, comment='计划减仓人数百分比例；<量纲：%>')
    pp_reduce_significant = Column(DECIMAL(22, 6), nullable=False, comment='计划大幅减仓人数百分比例；<量纲：%>')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(11), nullable=False, server_default=text("'0'"))


class ContractTemplateManage(Base, BaseModel):
    __tablename__ = 'contract_template_manage'
    __table_args__ = {'comment': '合同及指南管理'}

    id = Column(String(64), primary_key=True, comment='唯一主键')
    fund_id = Column(String(64), nullable=False, comment='产品id')
    trading_rules = Column(String(255), comment='交易规则')
    expense_subscription = Column(String(255), comment='基金总费用-认/申购费')
    expense_ratio = Column(DECIMAL(22, 6), comment='认购费用')
    expense_manage = Column(String(255), comment='基金总费用-管理费')
    expense_manage_ratio = Column(DECIMAL(22, 6), comment='基金管理费用')
    expense_achievement = Column(String(255), comment='基金总费用-业绩报酬')
    expense_achievement_ratio = Column(DECIMAL(22, 6), comment='基金总费用-业绩报酬比例')
    ifa_subscription = Column(String(255), comment='理财师分成-认/申购费')
    ifa_subscription_ratio = Column(DECIMAL(22, 6), comment='理财师分成-认/申购费比例')
    ifa_manage = Column(String(255), comment='理财师分成-管理费')
    ifa_manage_ratio = Column(DECIMAL(22, 6), comment='理财师分成-管理费比例')
    ifa_achievement = Column(String(255), comment='理财师分成-业绩报酬')
    ifa_achievement_ratio = Column(DECIMAL(22, 6), comment='理财师分成-业绩报酬比例')
    create_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    creart_by = Column(String(64))
    update_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    update_by = Column(String(64))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"), comment='删除标志位:0:未删除,1:已删除')


class FileDesc(Base, BaseModel):
    __tablename__ = 'file_desc'
    __table_args__ = {'comment': '文件描述'}

    id = Column(String(64), primary_key=True)
    rel_id = Column(String(64), nullable=False, index=True, server_default=text("''"), comment='文件id')
    info = Column(MEDIUMTEXT, nullable=False)
    create_by = Column(String(64), nullable=False, server_default=text("''"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    update_by = Column(String(64))
    update_time = Column(TIMESTAMP)
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundAssetSize(Base, BaseModel):
    __tablename__ = 'fund_asset_size'
    __table_args__ = {'comment': '基金资产规模'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64))
    fund_asset_size_date = Column(Date, comment='规模日期')
    fund_asset_size = Column(DECIMAL(22, 6), comment='基金资产规模')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(TINYINT(3), nullable=False, server_default=text("'0'"))


class FundAttribute(Base, BaseModel):
    __tablename__ = 'fund_attributes'
    __table_args__ = {'comment': '基金属性'}

    id = Column(String(64), primary_key=True, comment='基金id')
    master_feeder_fund = Column(INTEGER(11), comment='是否为master feeder fund:1-是')
    target_return_fund = Column(INTEGER(11), comment='是否为目标回报型基金：1-是')
    risk_buffer_fund = Column(INTEGER(11), comment='是否为风险缓冲型基金：1-是')
    umbrella_fund = Column(INTEGER(11), comment='是否为伞形产品，1-是')
    share_class = Column(INTEGER(11), comment='分级基金份额标识：1-是')
    multi_advisor = Column(INTEGER(11), comment='多投顾：1-是')
    pro_class_m = Column(INTEGER(11), comment='是否为分级母基金：1-是')
    pro_class_s = Column(INTEGER(11), comment='是否为分级子基金：1-是')
    tot_sign = Column(TINYINT(4), comment='是否信托中类型TOT(一对一）:1-是;0-否')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(TINYINT(4))


class FundBank(Base, BaseModel):
    __tablename__ = 'fund_bank'
    __table_args__ = {'comment': '基金托管银行信息'}

    fund_id = Column(String(64), primary_key=True)
    bank_code = Column(String(32), comment='银行code')
    bank_id = Column(String(32))
    bank_name = Column(String(64), nullable=False, comment='银行名称')
    fund_account = Column(String(64), nullable=False, comment='账号id')
    account_name = Column(String(32), nullable=False, comment='户名')
    create_by = Column(String(64), nullable=False)
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    update_by = Column(String(64), nullable=False)
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundCombineInfo(Base, BaseModel):
    __tablename__ = 'fund_combine_info'
    __table_args__ = {'comment': '组合基金'}

    id = Column(String(64), primary_key=True)
    p_fund_id = Column(String(64), nullable=False, comment='组合基金id')
    fund_id = Column(String(64), nullable=False, comment='基金id')
    change_date = Column(Date, comment='最新变动日期')
    proportion_ratio = Column(DECIMAL(22, 6), comment='占比')
    compare_last = Column(DECIMAL(22, 6), comment='较上次推荐持仓变动')
    flag = Column(INTEGER(3), comment='组合基金标识 0：当前组合 1：历史组合')
    create_time = Column(DateTime)
    create_by = Column(String(64))
    update_time = Column(DateTime)
    update_by = Column(String(64))
    delete_tag = Column(INTEGER(3), server_default=text("'0'"))


class FundCombineInfoLog(Base, BaseModel):
    __tablename__ = 'fund_combine_info_log'
    __table_args__ = {'comment': '组合基金变更记录表'}

    id = Column(String(64), primary_key=True)
    p_fund_id = Column(String(64), nullable=False, comment='组合基金id')
    fund_id = Column(String(64), nullable=False, comment='基金id')
    change_date = Column(Date, comment='变动日期')
    proportion_ratio = Column(DECIMAL(22, 6), comment='占比')
    compare_last = Column(DECIMAL(22, 6), comment='较上次持仓变动')
    create_time = Column(DateTime)
    create_by = Column(String(64))
    update_time = Column(DateTime)
    update_by = Column(String(64))
    delete_tag = Column(INTEGER(3), server_default=text("'0'"))


class FundCount(Base, BaseModel):
    __tablename__ = 'fund_count'
    __table_args__ = {'comment': '基金历史业绩'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False, unique=True, comment='基金id')
    strategy = Column(INTEGER(4), index=True, 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-其他策略'")
    type = Column(INTEGER(3), nullable=False, server_default=text("'0'"), comment='是否可预约 0:不可预约 1:可预约')
    end_date = Column(Date, comment='截至日期')
    price_date = Column(Date, comment='最近累计净值日期')
    net_nav = Column(DECIMAL(22, 6), comment='单位净值')
    cumulative_nav = Column(DECIMAL(22, 6), comment='最近累计净值')
    ret_1day = Column(DECIMAL(22, 6), comment='最近一天收益率')
    ret_1day_bm1 = Column(DECIMAL(22, 6), comment='最近一天基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_1w = Column(DECIMAL(22, 6), comment='最近一个周收益率')
    ret_1w_bm1 = Column(DECIMAL(22, 6), comment='最近一个周基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_1m = Column(DECIMAL(22, 6), comment='最近一个月收益率')
    ret_1m_bm1 = Column(DECIMAL(22, 6), comment='最近一个月基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_3m = Column(DECIMAL(22, 6), comment='最近三个月收益率')
    ret_3m_bm1 = Column(DECIMAL(22, 6), comment='最近三个月基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_6m = Column(DECIMAL(22, 6), comment='最近半年收益率')
    ret_6m_bm1 = Column(DECIMAL(22, 6), comment='最近半年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_1y = Column(DECIMAL(22, 6), comment='最近一年收益率')
    ret_1y_bm1 = Column(DECIMAL(22, 6), comment='最近一年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_2y = Column(DECIMAL(22, 6), comment='最近两年收益率')
    ret_2y_bm1 = Column(DECIMAL(22, 6), comment='最近两年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_2y_a = Column(DECIMAL(22, 6), comment='最近两年收益率（年化）')
    ret_2y_bm1_a = Column(DECIMAL(22, 6), comment='最近两年基准指数收益率（年化），基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_3y = Column(DECIMAL(22, 6), comment='最近三年收益率')
    ret_3y_bm1 = Column(DECIMAL(22, 6), comment='最近三年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_3y_a = Column(DECIMAL(22, 6), comment='最近三年收益率（年化）')
    ret_3y_bm1_a = Column(DECIMAL(22, 6), comment='最近三年基准指数收益率（年化），基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_4y = Column(DECIMAL(22, 6), comment='最近四年收益率')
    ret_4y_bm1 = Column(DECIMAL(22, 6), comment='最近四年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_4y_a = Column(DECIMAL(22, 6), comment='最近四年收益率（年化）')
    ret_4y_bm1_a = Column(DECIMAL(22, 6), comment='最近四年基准指数收益率（年化），基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_5y = Column(DECIMAL(22, 6), comment='最近五年收益率')
    ret_5y_bm1 = Column(DECIMAL(22, 6), comment='最近五年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_5y_a = Column(DECIMAL(22, 6), comment='最近五年收益率（年化）')
    ret_5y_bm1_a = Column(DECIMAL(22, 6), comment='最近五年基准指数收益率（年化），基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_ytd = Column(DECIMAL(22, 6), comment='今年以来收益率')
    ret_ytd_bm1 = Column(DECIMAL(22, 6), comment='今年以来基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_incep = Column(DECIMAL(22, 6), comment='成立以来收益率')
    ret_incep_bm1 = Column(DECIMAL(22, 6), comment='成立以来基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_incep_a = Column(DECIMAL(22, 6), comment='成立以来收益率（年化）')
    ret_incep_bm1_a = Column(DECIMAL(22, 6), comment='成立以来基准指数收益率（年化），基准指数bm1=沪深300（取决于基金设定的基准指数）')
    sharperatio_1y = Column(DECIMAL(22, 6), comment='最近一年的夏普比率')
    sharperatio_2y = Column(DECIMAL(22, 6), comment='最近两年的夏普比率')
    sharperatio_3y = Column(DECIMAL(22, 6), comment='最近三年的夏普比率')
    sharperatio_4y = Column(DECIMAL(22, 6), comment='最近四年的夏普比率')
    sharperatio_5y = Column(DECIMAL(22, 6), comment='最近五年的夏普比率')
    sharperatio_incep = Column(DECIMAL(22, 6), comment='成立以来的夏普比率')
    stddev_1y = Column(DECIMAL(22, 6), comment='最近一年的年化波动率')
    stddev_2y = Column(DECIMAL(22, 6), comment='最近两年的年化波动率')
    stddev_3y = Column(DECIMAL(22, 6), comment='最近三年的年化波动率')
    stddev_4y = Column(DECIMAL(22, 6), comment='最近四年的年化波动率')
    stddev_5y = Column(DECIMAL(22, 6), comment='最近五年的年化波动率')
    stddev_10y = Column(DECIMAL(22, 6), comment='最近十年的年化波动率')
    stddev_incep = Column(DECIMAL(22, 6), comment='成立以来的年化波动率')
    stddev_ytd = Column(DECIMAL(22, 6), comment='今年以来的年化波动率')
    maxdrawdown_1y = Column(DECIMAL(22, 6), comment='最近一年的最大回撤')
    maxdrawdown_2y = Column(DECIMAL(22, 6), comment='最近两年的最大回撤')
    maxdrawdown_3y = Column(DECIMAL(22, 6), comment='最近四年的最大回撤')
    maxdrawdown_4y = Column(DECIMAL(22, 6), comment='最近四年的最大回撤')
    maxdrawdown_5y = Column(DECIMAL(22, 6), comment='最近五年的最大回撤')
    maxdrawdown_10y = Column(DECIMAL(22, 6), comment='最近十年的最大回撤')
    maxdrawdown_incep = Column(DECIMAL(22, 6), comment='成立以来的最大回撤')
    data_sources = Column(INTEGER(3), nullable=False, server_default=text("'1'"), comment='数据来源 1:tanpu，2:私募排排 3:指数')
    update_time = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    status = Column(INTEGER(3), nullable=False, server_default=text("'0'"), comment='0:待上架  1：已上架 2：已下架')
    sort = Column(INTEGER(11), server_default=text("'0'"), comment='排序')
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundDistribution(Base, BaseModel):
    __tablename__ = 'fund_distribution'
    __table_args__ = {'comment': '基金分红'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False, index=True, comment='基金Id')
    distribute_date = Column(Date, nullable=False, comment='分配日期')
    distribute_type = Column(INTEGER(11), nullable=False, comment='基金分配类型标志：-1-其他，1-分红，2-拆分 3-业绩报酬 -1-其他')
    distribution = Column(DECIMAL(22, 6), comment='分红/拆分比例')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(11), nullable=False, server_default=text("'0'"))


class FundExplain(Base, BaseModel):
    __tablename__ = 'fund_explain'
    __table_args__ = {'comment': '产品解读'}

    id = Column(String(64), primary_key=True, comment='主键id')
    fund_id = Column(String(64), nullable=False, comment='基金id')
    title = Column(String(128), nullable=False, comment='标题')
    content = Column(String(2000), nullable=False, comment='解读内容')
    sort = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment='排序')
    create_by = Column(String(64), nullable=False, comment='创建人')
    create_time = Column(DateTime, nullable=False, comment='创建时间')
    update_by = Column(String(64), comment='更新人')
    update_time = Column(DateTime, comment='更新时间')
    delete_tag = Column(INTEGER(1), nullable=False, server_default=text("'0'"), comment='删除标识')


class FundFileRecord(Base, BaseModel):
    __tablename__ = 'fund_file_record'

    id = Column(String(64), primary_key=True, server_default=text("''"), comment='唯一主键')
    ref_id = Column(String(64), index=True, comment='关联数据ID')
    file_name = Column(String(128), comment='文件原始名称')
    original_url = Column(String(256), comment='文件原链接')
    type = Column(INTEGER(5), nullable=False, server_default=text("'1'"), comment='1:公告,2:附件,3:探普研报')
    file_suffix = Column(String(128), comment='文件后缀名')
    logical_name = Column(String(128), comment='文件逻辑名')
    logical_path = Column(String(256), index=True, comment='文件存放路径')
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
    create_by = Column(String(64), comment='创建人')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"), comment='修改时间')
    update_by = Column(String(64), comment='修改人')
    delete_tag = Column(INTEGER(1), nullable=False, server_default=text("'0'"), comment='删除标识')
    task_id = Column(String(100), comment='任务id')
    status = Column(INTEGER(1), comment='状态 0 ：待转换  1：已经转换  2：转换失败')


class FundFuturestypeMapping(Base, BaseModel):
    __tablename__ = 'fund_futurestype_mapping'
    __table_args__ = {'comment': '基金投资品种信息'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False)
    futures_type = Column(TINYINT(4), comment='投资品种:1-商品期货、2-金融期货、3-股票、4-债券型、5-指数型、6-期权型、7-基金型、8-新三板、-1-其他;')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(TINYINT(3), nullable=False)


class FundInfo(Base, BaseModel):
    __tablename__ = 'fund_info'
    __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='排序')

#
# t_fund_info = Table(
#     'fund_info', metadata,
#     Column('id', String(64), primary_key=True, comment='基金id'),
#     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):
    __tablename__ = 'fund_manager_mapping'
    __table_args__ = {'comment': '基金与基金经理关联'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False, index=True, comment='基金id')
    fund_manager_id = Column(String(64), index=True, comment='基金经理id，即人员id')
    management_start_date = Column(Date, comment='基金管理开始时间')
    management_end_date = Column(Date, comment='基金管理结束时间')
    isvisible = Column(INTEGER(11), comment='前台是否可见,1-可见 0-不可见')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(11), nullable=False, server_default=text("'0'"))


class FundMarketIndex(Base, BaseModel):
    __tablename__ = 'fund_market_indexes'
    __table_args__ = {'comment': '指数'}

    id = Column(String(64), primary_key=True)
    index_id = Column(String(10), nullable=False)
    index_code = Column(String(20), nullable=False, comment='指数代码')
    price_date = Column(Date, comment='更新日期')
    preclose = Column(DECIMAL(22, 6))
    open = Column(DECIMAL(22, 6))
    high = Column(DECIMAL(22, 6))
    low = Column(DECIMAL(22, 6))
    close = Column(DECIMAL(22, 6))
    trade_volumen = Column(DECIMAL(22, 6))
    trade_amount = Column(DECIMAL(22, 6))
    wave_range = Column(DECIMAL(22, 6))
    day_price_limit = Column(DECIMAL(22, 6))
    duration = Column(DECIMAL(22, 6))
    convexity = Column(String(22))
    create_time = Column(DateTime)
    create_by = Column(String(64))
    update_time = Column(DateTime)
    update_by = Column(String(64))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundNav(Base, BaseModel):
    __tablename__ = 'fund_nav'
    __table_args__ = {'comment': '基金净值'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False, index=True, comment="基金id，'HF'开头(后加36进制编码格式,不足8位长度左补零） 例：HF00000001")
    price_date = Column(Date, nullable=False, comment='净值日期')
    nav = Column(DECIMAL(22, 6), nullable=False, comment='单位净值')
    cumulative_nav = Column(DECIMAL(22, 6), comment='考虑分红再投资的单位累计净值')
    cumulative_nav_withdrawal = Column(DECIMAL(22, 6), comment='分红不投资的单位累计净值')
    ishigh_or_low = Column(INTEGER(11), comment='净值创新高或新低标志；1-创历史新高；2-创历史新低；3-既没有创历史新高也没有创历史新低;-1-其他')
    tohigh_nav_ratio = Column(DECIMAL(22, 6), comment='距离历史新高的距离，（历史最高累计净值-最新累计净值）*100%/最新累计净值')
    create_by = Column(String(64), server_default=text("'admin'"))
    create_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    update_by = Column(String(64), nullable=False, server_default=text("'admin'"))
    update_time = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundPerformance(Base, BaseModel):
    __tablename__ = 'fund_performance'
    __table_args__ = {'comment': '基金历史业绩'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False, index=True, comment='基金id')
    end_date = Column(Date, nullable=False, comment='截至日期')
    price_date = Column(Date, comment='最近累计净值日期')
    cumulative_nav = Column(DECIMAL(22, 6), comment='最近累计净值')
    ret_1day = Column(DECIMAL(22, 6), comment='最近一天收益率')
    ret_1day_bm1 = Column(DECIMAL(22, 6), comment='最近一天基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_1w = Column(DECIMAL(22, 6), comment='最近一个周收益率')
    ret_1w_bm1 = Column(DECIMAL(22, 6), comment='最近一个周基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_1m = Column(DECIMAL(22, 6), comment='最近一个月收益率')
    ret_cum_1m = Column(DECIMAL(22, 6), comment='最近一个月累计收益率')
    ret_1m_bm1 = Column(DECIMAL(22, 6), comment='最近一个月基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_cum_1m_bm1 = Column(DECIMAL(22, 6), comment='最近一个月累计基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_3m = Column(DECIMAL(22, 6), comment='最近三个月收益率')
    ret_3m_bm1 = Column(DECIMAL(22, 6), comment='最近三个月基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_cum_3m = Column(DECIMAL(22, 6), comment='最近三个月累计收益率')
    ret_cum_3m_bm1 = Column(DECIMAL(22, 6), nullable=False, comment='最近三个月累计基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_6m = Column(DECIMAL(22, 6), comment='最近半年收益率')
    ret_cum_6m = Column(DECIMAL(22, 6), comment='最近半年累计收益率')
    ret_6m_bm1 = Column(DECIMAL(22, 6), comment='最近半年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_cum_6m_bm1 = Column(DECIMAL(22, 6), comment='最近半年累计基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_1y = Column(DECIMAL(22, 6), comment='最近一年收益率')
    ret_cum_1y = Column(DECIMAL(22, 6), comment='最近一年累计收益率')
    ret_1y_bm1 = Column(DECIMAL(22, 6), comment='最近一年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_cum_1y_bm1 = Column(DECIMAL(22, 6), comment='最近一年累计基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_2y = Column(DECIMAL(22, 6), comment='最近两年收益率')
    ret_cum_2y = Column(DECIMAL(22, 6), comment='最近两年累计收益率')
    ret_2y_bm1 = Column(DECIMAL(22, 6), comment='最近两年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_cum_2y_bm1 = Column(DECIMAL(22, 6), comment='最近两年累计基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_2y_a = Column(DECIMAL(22, 6), comment='最近两年收益率（年化）')
    ret_2y_bm1_a = Column(DECIMAL(22, 6), comment='最近两年基准指数收益率（年化），基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_3y = Column(DECIMAL(22, 6), comment='最近三年收益率')
    ret_cum_3y = Column(DECIMAL(22, 6), comment='最近三年累计收益率')
    ret_3y_bm1 = Column(DECIMAL(22, 6), comment='最近三年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_cum_3y_bm1 = Column(DECIMAL(22, 6), comment='最近三年累计基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_3y_a = Column(DECIMAL(22, 6), comment='最近三年收益率（年化）')
    ret_3y_bm1_a = Column(DECIMAL(22, 6), comment='最近三年基准指数收益率（年化），基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_4y = Column(DECIMAL(22, 6), comment='最近四年收益率')
    ret_cum_4y = Column(DECIMAL(22, 6), comment='最近四年累计收益率')
    ret_4y_bm1 = Column(DECIMAL(22, 6), comment='最近四年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_cum_4y_bm1 = Column(DECIMAL(22, 6), comment='最近四年累计基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_4y_a = Column(DECIMAL(22, 6), comment='最近四年收益率（年化）')
    ret_4y_bm1_a = Column(DECIMAL(22, 6), comment='最近四年基准指数收益率（年化），基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_5y = Column(DECIMAL(22, 6), comment='最近五年收益率')
    ret_cum_5y = Column(DECIMAL(22, 6), comment='最近五年累计收益率')
    ret_5y_bm1 = Column(DECIMAL(22, 6), comment='最近五年基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_cum_5y_bm1 = Column(DECIMAL(22, 6), comment='最近五年累计基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_5y_a = Column(DECIMAL(22, 6), comment='最近五年收益率（年化）')
    ret_5y_bm1_a = Column(DECIMAL(22, 6), comment='最近五年基准指数收益率（年化），基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_ytd = Column(DECIMAL(22, 6), comment='今年以来收益率')
    ret_cum_ytd = Column(DECIMAL(22, 6), comment='今年以来累计收益率')
    ret_ytd_bm1 = Column(DECIMAL(22, 6), comment='今年以来基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_cum_ytd_bm1 = Column(DECIMAL(22, 6), comment='今年以来累计基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_incep = Column(DECIMAL(22, 6), comment='成立以来收益率')
    ret_cum_incep = Column(DECIMAL(22, 6), comment='成立以来累计收益率')
    ret_incep_bm1 = Column(DECIMAL(22, 6), comment='成立以来基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_cum_incep_bm1 = Column(DECIMAL(22, 6), comment='成立以来累计基准指数收益率，基准指数bm1=沪深300（取决于基金设定的基准指数）')
    ret_incep_a = Column(DECIMAL(22, 6), comment='成立以来收益率（年化）')
    ret_incep_bm1_a = Column(DECIMAL(22, 6), comment='成立以来基准指数收益率（年化），基准指数bm1=沪深300（取决于基金设定的基准指数）')
    update_time = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundPerformanceRanking(Base, BaseModel):
    __tablename__ = 'fund_performance_ranking'
    __table_args__ = {'comment': '基金业绩排名'}

    id = Column(String(64), primary_key=True)
    class_id = Column(INTEGER(11), nullable=False, comment='排名分类,1:产品类型，2：投资策略')
    fund_id = Column(String(64), nullable=False, index=True, comment='基金id')
    end_date = Column(String(10), nullable=False, comment='截至日期')
    absrank_ret_1m = Column(INTEGER(11), comment='最近一个月收益率的绝对排名')
    perrank_ret_1m = Column(INTEGER(11), comment='最近一个月收益率的相对排名(%)')
    absrank_ret_3m = Column(INTEGER(11), comment='最近三个月收益率的绝对排名')
    perrank_ret_3m = Column(INTEGER(11), comment='最近三个月收益率的相对排名(%)')
    absrank_ret_6m = Column(INTEGER(11), comment='最近六个月收益率的绝对排名')
    perrank_ret_6m = Column(INTEGER(11), comment='最近六个月收益率的相对排名(%)')
    absrank_ret_1y = Column(INTEGER(11), comment='最近一年收益率的绝对排名')
    perrank_ret_1y = Column(INTEGER(11), comment='最近一年收益率的相对排名(%)')
    absrank_ret_2y = Column(INTEGER(11), comment='最近两年收益率的绝对排名')
    perrank_ret_2y = Column(INTEGER(11), comment='最近两年收益率的相对排名(%)')
    absrank_ret_3y = Column(INTEGER(11), comment='最近三年收益率的绝对排名')
    perrank_ret_3y = Column(INTEGER(11), comment='最近三年收益率的相对排名(%)')
    absrank_ret_4y = Column(INTEGER(11), comment='最近四年收益率的绝对排名')
    perrank_ret_4y = Column(INTEGER(11), comment='最近四年收益率的相对排名(%)')
    absrank_ret_5y = Column(INTEGER(11), comment='最近五年收益率的绝对排名')
    perrank_ret_5y = Column(INTEGER(11), comment='最近五年收益率的相对排名(%)')
    absrank_ret_ytd = Column(INTEGER(11), comment='今年以来收益率的绝对排名')
    perrank_ret_ytd = Column(INTEGER(11), comment='今年以来收益率的相对排名(%)')
    absrank_ret_incep = Column(INTEGER(11), comment='成立以来绝对排名')
    perrank_ret_incep = Column(INTEGER(11), comment='成立以来相对排名(%)')
    absrank_maxdrawdown_1y = Column(INTEGER(11), comment='最近一年最大回撤的绝对排名')
    perrank_maxdrawdown_1y = Column(INTEGER(11), comment='最近一年最大回撤的相对排名')
    absrank_maxdrawdown_2y = Column(INTEGER(11), comment='最近两年最大回撤的绝对排名')
    perrank_maxdrawdown_2y = Column(INTEGER(11), comment='最近两年最大回撤的相对排名')
    absrank_maxdrawdown_3y = Column(INTEGER(11), comment='最近三年最大回撤的绝对排名')
    perrank_maxdrawdown_3y = Column(INTEGER(11), comment='最近三年最大回撤的相对排名')
    absrank_maxdrawdown_4y = Column(INTEGER(11), comment='最近四年最大回撤的绝对排名')
    perrank_maxdrawdown_4y = Column(INTEGER(11), comment='最近四年最大回撤的相对排名')
    absrank_maxdrawdown_5y = Column(INTEGER(11), comment='最近五年最大回撤的绝对排名')
    perrank_maxdrawdown_5y = Column(INTEGER(11), comment='最近五年最大回撤的相对排名')
    absrank_adjret_1y = Column(INTEGER(11), comment='最近一年风险调整收益的绝对排名')
    perrank_adjret_1y = Column(INTEGER(11), comment='最近一年风险调整收益的相对排名')
    absrank_adjret_2y = Column(INTEGER(11), comment='最近两年风险调整收益的绝对排名')
    perrank_adjret_2y = Column(INTEGER(11), comment='最近两年风险调整收益的相对排名')
    absrank_adjret_3y = Column(INTEGER(11), comment='最近三年风险调整收益的绝对排名')
    perrank_adjret_3y = Column(INTEGER(11), comment='最近三年风险调整收益的相对排名')
    absrank_adjret_4y = Column(INTEGER(11), comment='最近四年风险调整收益的绝对排名')
    perrank_adjret_4y = Column(INTEGER(11), comment='最近四年风险调整收益的相对排名')
    absrank_adjret_5y = Column(INTEGER(11), comment='最近五年风险调整收益的绝对排名')
    perrank_adjret_5y = Column(INTEGER(11), comment='最近五年风险调整收益的相对排名')
    absrank_upsidecaptureratio_1y = Column(INTEGER(11), comment='最近一年上行捕获率的绝对排名')
    perrank_upsidecaptureratio_1y = Column(INTEGER(11), comment='最近一年上行捕获率的相对排名')
    absrank_upsidecaptureratio_2y = Column(INTEGER(11), comment='最近两年上行捕获率的绝对排名')
    perrank_upsidecaptureratio_2y = Column(INTEGER(11), comment='最近两年上行捕获率的相对排名')
    absrank_upsidecaptureratio_3y = Column(INTEGER(11), comment='最近三年上行捕获率的绝对排名')
    perrank_upsidecaptureratio_3y = Column(INTEGER(11), comment='最近三年上行捕获率的相对排名')
    absrank_upsidecaptureratio_4y = Column(INTEGER(11), comment='最近四年上行捕获率的绝对排名')
    perrank_upsidecaptureratio_4y = Column(INTEGER(11), comment='最近四年上行捕获率的相对排名')
    absrank_upsidecaptureratio_5y = Column(INTEGER(11), comment='最近五年上行捕获率的绝对排名')
    perrank_upsidecaptureratio_5y = Column(INTEGER(11), comment='最近五年上行捕获率的相对排名')
    absrank_downsidecaptureratio_1y = Column(INTEGER(11), comment='最近一年下行捕获率的绝对排名')
    perrank_downsidecaptureratio_1y = Column(INTEGER(11), comment='最近一年下行捕获率的相对排名')
    absrank_downsidecaptureratio_2y = Column(INTEGER(11), comment='最近两年下行捕获率的绝对排名')
    perRank_downsidecaptureratio_2y = Column(INTEGER(11), comment='最近两年下行捕获率的相对排名')
    absrank_downsidecaptureratio_3y = Column(INTEGER(11), comment='最近三年下行捕获率的绝对排名')
    perrank_downsidecaptureratio_3y = Column(INTEGER(11), comment='最近三年下行捕获率的相对排名')
    absrank_downsidecaptureratio_4y = Column(INTEGER(11), comment='最近四年下行捕获率的绝对排名')
    perrank_downsidecaptureratio_4y = Column(INTEGER(11), comment='最近四年下行捕获率的相对排名')
    absrank_downsidecaptureratio_5y = Column(INTEGER(11), comment='最近五年下行捕获率的绝对排名')
    perrank_downsidecaptureratio_5y = Column(INTEGER(11), comment='最近五年下行捕获率的相对排名')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundPerformanceStrategyRating(Base, BaseModel):
    __tablename__ = 'fund_performance_strategy_rating'
    __table_args__ = {'comment': '基金评级'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False, index=True, comment='基金id')
    class_id = Column(String(64), nullable=False, index=True, comment='类型id')
    end_date = Column(String(10), nullable=False, comment='评级日期')
    strategy = Column(INTEGER(11), nullable=False, server_default=text("'-1'"), comment='融智策略分类，1-股票策略，2-宏观策略，3-管理期货，4-事件驱动，5-相对价值策略，6-债券策略，7-组合基金，8-复合策略，-1-其它策略')
    substrategy = Column(INTEGER(11), nullable=False, server_default=text("'-1'"), comment='旧：（融智子策略分类：   ')
    rating_1y = Column(INTEGER(11), comment='一年评级')
    ret_rating_1y = Column(String(20), comment='一年收益等级')
    risk_rating_1y = Column(String(20), comment='一年风险等级')
    style_1y = Column(String(20), comment='一年风格类别')
    rating_2y = Column(INTEGER(11), comment='两年评级')
    ret_rating_2y = Column(String(20), comment='两年收益等级')
    risk_rating_2y = Column(String(20), comment='两年风险等级')
    style_2y = Column(String(20), comment='两年风格类别')
    rating_3y = Column(INTEGER(11), comment='三年评级')
    ret_rating_3y = Column(String(20), comment='三年收益等级')
    risk_rating_3y = Column(String(20), comment='三年风险等级')
    style_3y = Column(String(20), comment='三年风格类别')
    rating_4y = Column(INTEGER(11), comment='四年评级')
    ret_rating_4y = Column(String(20), comment='四年收益等级')
    risk_rating_4y = Column(String(20), comment='四年风险等级')
    style_4y = Column(String(20), comment='四年风格类别')
    rating_5y = Column(INTEGER(11), comment='五年评级')
    ret_rating_5y = Column(String(20), comment='五年收益等级')
    risk_rating_5y = Column(String(20), comment='五年风险等级')
    style_5y = Column(String(20), comment='五年风格类别')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundPortfolio(Base, BaseModel):
    __tablename__ = 'fund_portfolio'
    __table_args__ = {'comment': '基金重仓统计'}

    id = Column(String(64), primary_key=True, comment='主键id')
    fund_id = Column(String(64), nullable=False, index=True, comment='基金id')
    portfolio_date = Column(Date, nullable=False, comment='统计日期')
    sec_code = Column(String(64), nullable=False, index=True, comment='证券代码')
    sec_type = Column(INTEGER(11), nullable=False, server_default=text("'1'"), comment='证券类型：1-股票，2-基金，3-债券，4-权证，-1-其他')
    sec_market_value = Column(DECIMAL(22, 6), comment='单只证券市值,<量纲：万元>')
    net_value_ratio = Column(DECIMAL(22, 6), comment='占净值比例,<量纲:%>')
    holding_num = Column(DECIMAL(22, 6), comment='持仓量,<量纲：万股>')
    holding_ratio = Column(DECIMAL(22, 6), comment='占流通比例,<量纲:%> 此字段只有信托类产品有数据，即fund_type=2 or 3')
    uni_code = Column(String(64), index=True, comment='标的代码(base_underlying_information)')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"), comment='修改时间;第一次创建时与CreatTime值相同，修改时与修改时间相同')
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间,默认第一次创建的getdate()时间')
    delete_tag = Column(INTEGER(3), server_default=text("'0'"))


class FundPosition(Base, BaseModel):
    __tablename__ = 'fund_position'
    __table_args__ = {'comment': '基金资产配置'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False, index=True, comment='基金id')
    position_date = Column(Date, nullable=False, comment='基金仓位统计日期')
    sec_type = Column(TINYINT(4), comment='证券类型：1-股票，2-基金，3-债券，4-权证，5-货币资金，-1-其他(券商资管产品特有)')
    market_valule = Column(DECIMAL(22, 6), comment='市值，<量纲：万元>')
    position = Column(DECIMAL(22, 6), comment='基金仓位比例，<量纲：%>')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_by = Column(String(64), index=True, comment='创建者Id,默认第一次创建者名称，创建后不变更')
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间,默认第一次创建的getdate()时间')
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundQa(Base, BaseModel):
    __tablename__ = 'fund_qa'
    __table_args__ = {'comment': '产品QA'}

    id = Column(String(64), primary_key=True)
    qa_type = Column(INTEGER(1), nullable=False, comment='问题类型  1：提问 2回答')
    fund_id = Column(String(64), nullable=False, comment='产品ID')
    content = Column(Text, nullable=False, comment='问题/回答内容')
    ask_id = Column(String(64), comment='问题ID')
    status = Column(INTEGER(1), comment='0 :未回答  1已回答')
    verify_status = Column(INTEGER(1), nullable=False, comment='审批状态 0：待审批  1：审批通过  2：未通过')
    user_head = Column(String(255), comment='用户头像')
    user_nickname = Column(String(50), comment='用户昵称')
    qa_source = Column(String(50), comment='1：运营 2：平台用户')
    sort = Column(INTEGER(3), nullable=False, server_default=text("'0'"))
    create_by = Column(String(64), nullable=False, comment='提问/回答人ID')
    create_time = Column(DateTime, nullable=False, comment='提问/回答时间')
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundRateMapping(Base, BaseModel):
    __tablename__ = 'fund_rate_mapping'
    __table_args__ = {'comment': '基金费率'}

    fund_id = Column(String(64), primary_key=True, comment="基金id(私募排排：'HF'开头(后加36进制编码格式,不足8位长度左补零） 例：HF00000001)")
    initial_unit_value = Column(String(255), comment='位面值')
    initial_size = Column(DECIMAL(22, 6), comment='初始规模,<量纲：万>')
    min_investment_share = Column(DECIMAL(22, 6), comment='最低认购额,<量纲：万> 券商资管产品量纲为<万元>')
    subsequent_investment_share = Column(DECIMAL(22, 6), comment='最低追加额,<量纲：万> 券商资管产品量纲为<万元>')
    subscription_fee = Column(DECIMAL(22, 6), comment='最高认购费，量纲<%>')
    subscription_fee_note = Column(String(255), comment='认（申）购费说明')
    redemption_fee = Column(DECIMAL(22, 6), comment='最高赎回费，量纲<%>')
    redemption_fee_note = Column(String(255), comment='最高赎回费，量纲<%>')
    managementfee_deduction_frequency = Column(String(255), comment='管理费计提周期，<量纲：月>')
    managementfee_consult = Column(DECIMAL(22, 6), comment='投资顾问管理费，<量纲：%>')
    managementfee_trust = Column(DECIMAL(22, 6), comment='受托人管理费，<量纲：%>')
    managementfee_bank = Column(DECIMAL(22, 6), comment='银行托管费，<量纲：%>')
    performance_fee = Column(DECIMAL(22, 6), comment='最高绩效费，量纲<%>')
    performance_fee_deduction_method = Column(INTEGER(11), comment='业绩报酬计提方式:0-未设 1-份额计提 2-净值计提 3-混合')
    performance_fee_note = Column(Text, comment='绩效费说明')
    dividend_rule = Column(Text, comment='分红规则')
    other_fee_note = Column(String(255), comment='其他费用说明')
    guard_line = Column(DECIMAL(22, 6), comment='警戒线，<量纲：%>')
    stop_loss_line = Column(DECIMAL(22, 6), comment='止损线，<量纲：%>')
    return_guarantees = Column(DECIMAL(22, 6), comment='保底收益率，<量纲：%>')
    expected_return = Column(DECIMAL(22, 6), comment='预计收益率')
    hurdle_rate = Column(DECIMAL(22, 6), comment='费前收益率（业绩提成前最低收益率），量纲<%>')
    leverage = Column(String(10), comment='融资杠杆比率')
    manager_participate_asset = Column(String(255), comment='基金管理人参与资产比例')
    posterior = Column(DECIMAL(22, 6), comment='劣后级杠杆比率')
    intermediate = Column(DECIMAL(22, 6), comment='中间级杠杆比率')
    priority = Column(DECIMAL(22, 6), comment='优先级杠杆比率')
    outsourcing_fee = Column(DECIMAL(22, 6), comment='外包管理费，量纲<%>')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundRiskStat(Base, BaseModel):
    __tablename__ = 'fund_risk_stats'
    __table_args__ = {'comment': '基金风险指标'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False, index=True, comment='基金id')
    end_date = Column(Date, nullable=False, comment='截至日期')
    stddev_1y = Column(DECIMAL(22, 6), comment='最近一年的年化波动率')
    stddev_2y = Column(DECIMAL(22, 6), comment='最近两年的年化波动率')
    stddev_3y = Column(DECIMAL(22, 6), comment='最近三年的年化波动率')
    stddev_4y = Column(DECIMAL(22, 6), comment='最近四年的年化波动率')
    stddev_5y = Column(DECIMAL(22, 6), comment='最近五年的年化波动率')
    stddev_10y = Column(DECIMAL(22, 6), comment='最近十年的年化波动率')
    stddev_incep = Column(DECIMAL(22, 6), comment='成立以来的年化波动率')
    stddev_ytd = Column(DECIMAL(22, 6), comment='今年以来的年化波动率')
    downsidedev_1y = Column(DECIMAL(22, 6), comment='最近一年的下行风险')
    downsidedev_2y = Column(DECIMAL(22, 6), comment='最近两年的下行风险')
    downsidedev_3y = Column(DECIMAL(22, 6), comment='最近三年的下行风险')
    downsidedev_4y = Column(DECIMAL(22, 6), comment='最近四年的下行风险')
    downsidedev_5y = Column(DECIMAL(22, 6), comment='最近五年的下行风险')
    downsidedev_10y = Column(DECIMAL(22, 6), comment='最近十年的下行风险')
    downsidedev_incep = Column(DECIMAL(22, 6), comment='成立以来的下行风险')
    downsidedev_ytd = Column(DECIMAL(22, 6), comment='今年以来的下行风险')
    alpha_1y = Column(DECIMAL(22, 6), comment='最近一年的阿尔法')
    alpha_2y = Column(DECIMAL(22, 6), comment='最近两年的阿尔法')
    alpha_3y = Column(DECIMAL(22, 6), comment='最近三年的阿尔法')
    alpha_4y = Column(DECIMAL(22, 6), comment='最近四年的阿尔法')
    alpha_5y = Column(DECIMAL(22, 6), comment='最近五年的阿尔法')
    alpha_10y = Column(DECIMAL(22, 6), comment='最近十年的阿尔法')
    alpha_incep = Column(DECIMAL(22, 6), comment='成立以来的阿尔法')
    alpha_ytd = Column(DECIMAL(22, 6), comment='今年以来的阿尔法')
    beta_1y = Column(DECIMAL(22, 6), comment='最近一年的贝塔')
    beta_2y = Column(DECIMAL(22, 6), comment='最近两年的贝塔')
    beta_3y = Column(DECIMAL(22, 6), comment='最近三年的贝塔')
    beta_4y = Column(DECIMAL(22, 6), comment='最近四年的贝塔')
    beta_5y = Column(DECIMAL(22, 6), comment='最近五年的贝塔')
    beta_10y = Column(DECIMAL(22, 6), comment='最近十年的贝塔')
    beta_incep = Column(DECIMAL(22, 6), comment='成立以来的贝塔')
    beta_ytd = Column(DECIMAL(22, 6), comment='今年以来的贝塔')
    r2_1y = Column(DECIMAL(22, 6), comment='最近一年的拟合优度')
    r2_2y = Column(DECIMAL(22, 6), comment='最近两年的拟合优度')
    r2_3y = Column(DECIMAL(22, 6), comment='最近三年的拟合优度')
    r2_4y = Column(DECIMAL(22, 6), comment='最近四年的拟合优度')
    r2_5y = Column(DECIMAL(22, 6), comment='最近五年的拟合优度')
    r2_10y = Column(DECIMAL(22, 6), comment='最近十年的拟合优度')
    r2_incep = Column(DECIMAL(22, 6), comment='成立以来的拟合优度')
    r2_ytd = Column(DECIMAL(22, 6), comment='今年以来的拟合优度')
    skewness_1y = Column(DECIMAL(22, 6), comment='最近一年的偏度')
    skewness_2y = Column(DECIMAL(22, 6), comment='最近两年的偏度')
    skewness_3y = Column(DECIMAL(22, 6), comment='最近三年的偏度')
    skewness_4y = Column(DECIMAL(22, 6), comment='最近四年的偏度')
    skewness_5y = Column(DECIMAL(22, 6), comment='最近五年的偏度')
    skewness_10y = Column(DECIMAL(22, 6), comment='最近十年的偏度')
    skewness_incep = Column(DECIMAL(22, 6), comment='成立以来的偏度')
    skewness_ytd = Column(DECIMAL(22, 6), comment='今年以来的偏度')
    kurtosis_1y = Column(DECIMAL(22, 6), comment='最近一年的峰度')
    kurtosis_2y = Column(DECIMAL(22, 6), comment='最近两年的峰度')
    kurtosis_3y = Column(DECIMAL(22, 6), comment='最近三年的峰度')
    kurtosis_4y = Column(DECIMAL(22, 6), comment='最近四年的峰度')
    kurtosis_5y = Column(DECIMAL(22, 6), comment='最近五年的峰度')
    kurtosis_10y = Column(DECIMAL(22, 6), comment='最近十年的峰度')
    kurtosis_incep = Column(DECIMAL(22, 6), comment='成立以来的峰度')
    kurtosis_ytd = Column(DECIMAL(22, 6), comment='今年以来的峰度')
    worstmonth_1y = Column(DECIMAL(22, 6), comment='最近一年的单月最大下跌')
    worstmonth_2y = Column(DECIMAL(22, 6), comment='最近两年的单月最大下跌')
    worstmonth_3y = Column(DECIMAL(22, 6), comment='最近三年的单月最大下跌')
    worstmonth_4y = Column(DECIMAL(22, 6), comment='最近四年的单月最大下跌')
    worstmonth_5y = Column(DECIMAL(22, 6), comment='最近五年的单月最大下跌')
    worstmonth_10y = Column(DECIMAL(22, 6), comment='最近十年的单月最大下跌')
    worstmonth_incep = Column(DECIMAL(22, 6), comment='成立以来的单月最大下跌')
    worstmonth_ytd = Column(DECIMAL(22, 6), comment='今年以来的单月最大下跌')
    downmonth_percent_1y = Column(DECIMAL(22, 6), comment='最近一年的下跌月份比')
    downmonth_percent_2y = Column(DECIMAL(22, 6), comment='最近两年的下跌月份比')
    downmonth_percent_3y = Column(DECIMAL(22, 6), comment='最近三年的下跌月份比')
    downmonth_percent_4y = Column(DECIMAL(22, 6), comment='最近四年的下跌月份比')
    downmonth_percent_5y = Column(DECIMAL(22, 6), comment='最近五年的下跌月份比')
    downmonth_percent_10y = Column(DECIMAL(22, 6), comment='最近十年的下跌月份比')
    downmonth_percent_incep = Column(DECIMAL(22, 6), comment='成立以来的下跌月份比')
    downmonth_percent_ytd = Column(DECIMAL(22, 6), comment='今年以来的下跌月份比')
    battingaverage_1y = Column(DECIMAL(22, 6), comment='最近一年的跑赢指数月份比')
    battingaverage_2y = Column(DECIMAL(22, 6), comment='最近两年的跑赢指数月份比')
    battingaverage_3y = Column(DECIMAL(22, 6), comment='最近三年的跑赢指数月份比')
    battingaverage_4y = Column(DECIMAL(22, 6), comment='最近四年的跑赢指数月份比')
    battingaverage_5y = Column(DECIMAL(22, 6), comment='最近五年的跑赢指数月份比')
    battingaverage_10y = Column(DECIMAL(22, 6), comment='最近五年的跑赢指数月份比')
    battingaverage_incep = Column(DECIMAL(22, 6), comment='成立以来的跑赢指数月份比')
    battingaverage_ytd = Column(DECIMAL(22, 6), comment='今年以来的跑赢指数月份比')
    gainloss_ratio_1y = Column(DECIMAL(22, 6), comment='最近一年的盈利/亏损比')
    gainloss_ratio_2y = Column(DECIMAL(22, 6), comment='最近两年的盈利/亏损比')
    gainloss_ratio_3y = Column(DECIMAL(22, 6), comment='最近三年的盈利/亏损比')
    gainloss_ratio_4y = Column(DECIMAL(22, 6), comment='最近四年的盈利/亏损比')
    gainloss_ratio_5y = Column(DECIMAL(22, 6), comment='最近五年的最长连续下跌月份数')
    gainloss_ratio_10y = Column(DECIMAL(22, 6), comment='最近十年的最长连续下跌月份数')
    gainloss_ratio_incep = Column(DECIMAL(22, 6), comment='成立以来的最长连续下跌月份数')
    gainloss_ratio_ytd = Column(DECIMAL(22, 6), comment='今年以来的最长连续下跌月份数')
    longestdown_months_1y = Column(INTEGER(11), comment='最近一年的最长连续下跌月份数')
    longestdown_months_2y = Column(INTEGER(11), comment='最近两年的最长连续下跌月份数')
    longestdown_months_3y = Column(INTEGER(11), comment='最近三年的最长连续下跌月份数')
    longestdown_months_4y = Column(INTEGER(11), comment='最近四年的最长连续下跌月份数')
    longestdown_months_5y = Column(INTEGER(11), comment='最近五年的最长连续下跌月份数')
    longestdown_months_10y = Column(INTEGER(11), comment='最近十年的最长连续下跌月份数')
    longestdown_months_incep = Column(INTEGER(11), comment='成立以来的最长连续下跌月份数')
    longestdown_months_ytd = Column(INTEGER(11), comment='今年以来的最长连续下跌月份数')
    maxdrawdown_3m = Column(DECIMAL(22, 6), comment='最近一年的最大回撤')
    maxdrawdown_ytd = Column(DECIMAL(22, 6))
    maxdrawdown_months_ytd = Column(DECIMAL(22, 6))
    maxdrawdown_peakdate_ytd = Column(DECIMAL(22, 6))
    maxdrawdown_valleydate_ytd = Column(DECIMAL(22, 6))
    maxdrawdown_1y = Column(DECIMAL(22, 6), comment='最近一年的最大回撤')
    maxdrawdown_months_1y = Column(INTEGER(11), comment='最近一年的最大回撤区间月份数')
    maxdrawdown_peakdate_1y = Column(String(10), comment='最近一年的最大回撤的峰值值起始日期')
    maxdrawdown_valleydate_1y = Column(String(10), comment='最近一年的最大回撤的谷值截止日期')
    maxdrawdown_recoverydate_1y = Column(String(10), comment='最近一年的最大回撤修复日期')
    maxdrawdown_recoverymonths_1y = Column(INTEGER(11), comment='最近一年的最大回撤修复区间月份数')
    maxdrawdown_2y = Column(DECIMAL(22, 6), comment='最近两年的最大回撤')
    maxdrawdown_months_2y = Column(INTEGER(11), comment='最近两年的最大回撤区间月份数')
    maxdrawdown_peakdate_2y = Column(String(11), comment='最近两年的最大回撤的峰值值起始日期')
    maxdrawdown_valleydate_2y = Column(String(11), comment='最近两年的最大回撤的谷值截止日期')
    maxdrawdown_recoverydate_2y = Column(INTEGER(11), comment='最近两年的最大回撤修复日期')
    maxdrawdown_recoverymonths_2y = Column(INTEGER(11), comment='最近两年的最大回撤修复区间月份数')
    maxdrawdown_3y = Column(DECIMAL(22, 6), comment='最近三年的最大回撤')
    maxdrawdown_months_3y = Column(INTEGER(11), comment='最近四年的最大回撤区间月份数')
    maxdrawdown_peakdate_3y = Column(String(10), comment='最近四年的最大回撤的峰值值起始日期')
    maxdrawdown_valleydate_3y = Column(String(10), comment='最近五年的最大回撤的谷值截止日期')
    maxdrawdown_recoverydate_3y = Column(String(10), comment='最近三年的最大回撤的谷值截止日期')
    maxdrawdown_recoverymonths_3y = Column(INTEGER(11), comment='最近三年的最大回撤修复区间月份数')
    maxdrawdown_4y = Column(DECIMAL(22, 6), comment='最近四年的最大回撤')
    maxdrawdown_months_4y = Column(INTEGER(11), comment='最近四年的最大回撤区间月份数')
    maxdrawdown_peakdate_4y = Column(String(10), comment='最近四年的最大回撤的峰值值起始日期')
    maxdrawdown_valleydate_4y = Column(String(10), comment='最近四年的最大回撤的谷值截止日期')
    maxdrawdown_recoverydate_4y = Column(String(10), comment='最近四年的最大回撤修复日期')
    maxdrawdown_recoverymonths_4y = Column(INTEGER(11), comment='最近四年的最大回撤修复区间月份数')
    maxdrawdown_5y = Column(DECIMAL(22, 6), comment='最近五年的最大回撤')
    maxdrawdown_10y = Column(DECIMAL(22, 6), comment='最近十年的最大回撤')
    maxdrawdown_months_5y = Column(INTEGER(11), comment='最近五年的最大回撤区间月份数')
    maxdrawdown_peakdate_5y = Column(String(10), comment='最近五年的最大回撤的峰值值起始日期')
    maxdrawdown_valleydate_5y = Column(String(10), comment='最近五年的最大回撤的谷值截止日期')
    maxdrawdown_recoverydate_5y = Column(String(10), comment='最近五年的最大回撤修复日期')
    maxdrawdown_recoverymonths_5y = Column(INTEGER(11), comment='最近五年的最大回撤修复区间月份数')
    maxdrawdown_months_10y = Column(INTEGER(11), comment='最近十年的最大回撤区间月份数')
    maxdrawdown_peakdate_10y = Column(String(10), comment='最近十年的最大回撤的峰值值起始日期')
    maxdrawdown_valleydate_10y = Column(String(10), comment='最近十年的最大回撤的谷值截止日期')
    maxdrawdown_recoverydate_10y = Column(String(10), comment='最近十年的最大回撤修复日期')
    maxdrawdown_recoverymonths_10y = Column(INTEGER(11), comment='最近十年的最大回撤修复区间月份数')
    maxdrawdown_incep = Column(DECIMAL(22, 6), comment='成立以来的最大回撤')
    maxdrawdown_months_incep = Column(INTEGER(11), comment='成立以来的最大回撤区间月份数')
    maxdrawdown_peakdate_incep = Column(String(10), comment='成立以来的最大回撤的峰值值起始日期')
    maxdrawdown_valleydate_incep = Column(String(10), comment='成立以来的最大回撤的谷值截止日期')
    maxdrawdown_recoverydate_incep = Column(String(10), comment='成立以来的最大回撤修复日期')
    maxdrawdown_recoverymonths_incep = Column(INTEGER(11), comment='成立以来的最大回撤修复区间月份数')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundRiskadjretStat(Base, BaseModel):
    __tablename__ = 'fund_riskadjret_stats'
    __table_args__ = {'comment': '基金风险调整收益指标'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False, index=True, comment='基金id')
    end_date = Column(Date, nullable=False, comment='截至日期')
    sharperatio_1y = Column(DECIMAL(22, 6), comment='最近一年的夏普比率')
    sharperatio_2y = Column(DECIMAL(22, 6), comment='最近两年的夏普比率')
    sharperatio_3y = Column(DECIMAL(22, 6), comment='最近三年的夏普比率')
    sharperatio_4y = Column(DECIMAL(22, 6), comment='最近四年的夏普比率')
    sharperatio_5y = Column(DECIMAL(22, 6), comment='最近五年的夏普比率')
    sharperatio_incep = Column(DECIMAL(22, 6), comment='成立以来的夏普比率')
    sortinoratio_1y = Column(DECIMAL(22, 6), comment='最近一年的索提诺比率')
    sortinoratio_2y = Column(DECIMAL(22, 6), comment='最近两年的索提诺比率')
    sortinoratio_3y = Column(DECIMAL(22, 6), comment='最近三年的索提诺比率')
    sortinoratio_4y = Column(DECIMAL(22, 6), comment='最近四年的索提诺比率')
    sortinoratio_5y = Column(DECIMAL(22, 6), comment='最近五年的索提诺比率')
    sortinoratio_incep = Column(DECIMAL(22, 6), comment='成立以来的索提诺比率')
    sortinoratio_MAR_1y = Column(DECIMAL(22, 6), comment='最近一年的索提诺比率(MAR)')
    sortinoratio_MAR_2y = Column(DECIMAL(22, 6), comment='最近两年的索提诺比率(MAR)')
    sortinoratio_MAR_3y = Column(DECIMAL(22, 6), comment='最近三年的索提诺比率(MAR)')
    sortinoratio_MAR_4y = Column(DECIMAL(22, 6), comment='最近四年的索提诺比率(MAR)')
    sortinoratio_MAR_5y = Column(DECIMAL(22, 6), comment='最近五年的索提诺比率(MAR)')
    sortinoratio_MAR_incep = Column(DECIMAL(22, 6), comment='成立以来的索提诺比率(MAR)')
    treynorratio_1y = Column(DECIMAL(22, 6), comment='最近一年的特雷诺比率')
    treynorratio_2y = Column(DECIMAL(22, 6), comment='最近两年的特雷诺比率')
    treynorratio_3y = Column(DECIMAL(22, 6), comment='最近三年的特雷诺比率')
    treynorratio_4y = Column(DECIMAL(22, 6), comment='最近四年的特雷诺比率')
    treynorratio_5y = Column(DECIMAL(22, 6), comment='最近五年的特雷诺比率')
    treynorratio_incep = Column(DECIMAL(22, 6), comment='成立以来的特雷诺比率')
    jensen_1y = Column(DECIMAL(22, 6), comment='最近一年的詹森指数')
    jensen_2y = Column(DECIMAL(22, 6), comment='最近两年的詹森指数')
    jensen_3y = Column(DECIMAL(22, 6), comment='最近三年的詹森指数')
    jensen_4y = Column(DECIMAL(22, 6), comment='最近四年的詹森指数')
    jensen_5y = Column(DECIMAL(22, 6), comment='最近五年的詹森指数')
    jensen_incep = Column(DECIMAL(22, 6), comment='成立以来的詹森指数')
    calmarratio_1y = Column(DECIMAL(22, 6), comment='最近一年的卡玛比率')
    calmarratio_2y = Column(DECIMAL(22, 6), comment='最近两年的卡玛比率')
    calmarratio_3y = Column(DECIMAL(22, 6), comment='最近三年的卡玛比率')
    calmarratio_4y = Column(DECIMAL(22, 6), comment='最近四年的卡玛比率')
    calmarratio_5y = Column(DECIMAL(22, 6), comment='最近五年的卡玛比率')
    calmarratio_incep = Column(DECIMAL(22, 6), comment='成立以来的卡玛比率')
    omegaratio_1y = Column(DECIMAL(22, 6), comment='最近一年的欧米茄比率')
    omegaratio_2y = Column(DECIMAL(22, 6), comment='最近两年的欧米茄比率')
    omegaratio_3y = Column(DECIMAL(22, 6), comment='最近三年的欧米茄比率')
    omegaratio_4y = Column(DECIMAL(22, 6), comment='最近四年的欧米茄比率')
    omegaratio_5y = Column(DECIMAL(22, 6), comment='最近五年的欧米茄比率')
    omegaratio_incep = Column(DECIMAL(22, 6), comment='成立以来的欧米茄比率')
    kapparatio_1y = Column(DECIMAL(22, 6), comment='最近一年的卡帕比率')
    kapparatio_2y = Column(DECIMAL(22, 6), comment='最近两年的卡帕比率')
    kapparatio_3y = Column(DECIMAL(22, 6), comment='最近三年的卡帕比率')
    kapparatio_4y = Column(DECIMAL(22, 6), comment='最近四年的卡帕比率')
    kapparatio_5y = Column(DECIMAL(22, 6), comment='最近五年的卡帕比率')
    kapparatio_incep = Column(DECIMAL(22, 6), comment='成立以来的卡帕比率')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundStatu(Base, BaseModel):
    __tablename__ = 'fund_status'
    __table_args__ = {'comment': '基金状态'}

    id = Column(String(64), primary_key=True, comment='基金Id')
    fund_status = Column(String(10), comment='基金运行状态：1-募集中、2-开放运行、3-封闭运行、4-提前清算、5-到期清算、6-发行失败、7-更换管理人、-1-其他')
    status_start_date = Column(Date, comment='募集开始时间')
    status_end_date = Column(Date, comment='募集结束时间')
    liquidate_date = Column(Date, comment='清算日期')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(3), nullable=False)


class FundStrategyRanknum(Base, BaseModel):
    __tablename__ = 'fund_strategy_ranknum'
    __table_args__ = {'comment': '策略排名基金总数'}

    id = Column(String(64), primary_key=True)
    strategy = Column(INTEGER(11), comment='基金策略')
    end_date = Column(String(10), nullable=False, comment='截至日期')
    rankfunds_1m = Column(INTEGER(11), comment='参与排名基金数目（最近一个月）')
    rankfunds_3m = Column(INTEGER(11))
    rankfunds_6m = Column(INTEGER(11))
    rankfunds_1y = Column(INTEGER(11))
    rankfunds_2y = Column(INTEGER(11))
    rankfunds_3y = Column(INTEGER(11))
    rankfunds_4y = Column(INTEGER(11))
    rankfunds_5y = Column(INTEGER(11))
    rankfunds_ytd = Column(INTEGER(11))
    ratingnum_1y = Column(INTEGER(11))
    ratingnum_2y = Column(INTEGER(11))
    ratingnum_3y = Column(INTEGER(11))
    ratingnum_4y = Column(INTEGER(11))
    ratingnum_5y = Column(INTEGER(11))
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class FundStyleStat(Base, BaseModel):
    __tablename__ = 'fund_style_stats'
    __table_args__ = {'comment': '基金风格指标'}

    id = Column(String(64), primary_key=True)
    fund_id = Column(String(64), nullable=False, index=True, comment='基金id')
    end_date = Column(String(10), nullable=False, comment='截至日期')
    upsidecapture_ret_1y = Column(DECIMAL(22, 6), comment='最近一年的上行捕获收益率')
    upsidecapture_ret_2y = Column(DECIMAL(22, 6), comment='最近两年的上行捕获收益率')
    upsidecapture_ret_3y = Column(DECIMAL(22, 6), comment='最近三年的上行捕获收益率')
    upsidecapture_ret_4y = Column(DECIMAL(22, 6), comment='最近四年的上行捕获收益率')
    upsidecapture_ret_5y = Column(DECIMAL(22, 6), comment='最近五年的上行捕获收益率')
    upsidecapture_ret_incep = Column(DECIMAL(22, 6), comment='成立以来的上行捕获收益率')
    downsidecapture_ret_1y = Column(DECIMAL(22, 6), comment='最近一年的下行捕获收益率')
    downsidecapture_ret_2y = Column(DECIMAL(22, 6), comment='最近两年的下行捕获收益率')
    downsidecapture_ret_3y = Column(DECIMAL(22, 6), comment='最近三年的下行捕获收益率')
    downsidecapture_ret_4y = Column(DECIMAL(22, 6), comment='最近四年的下行捕获收益率')
    downsidecapture_ret_5y = Column(DECIMAL(22, 6), comment='最近五年的下行捕获收益率')
    downsidecapture_ret_incep = Column(DECIMAL(22, 6), comment='成立以来的下行捕获收益率')
    upsidecapture_ratio_1y = Column(DECIMAL(22, 6), comment='最近一年的上行捕获率')
    upsidecapture_ratio_2y = Column(DECIMAL(22, 6), comment='最近两年的上行捕获率')
    upsidecapture_ratio_3y = Column(DECIMAL(22, 6), comment='最近三年的上行捕获率')
    upsidecapture_ratio_4y = Column(DECIMAL(22, 6), comment='最近四年的上行捕获率')
    upsidecapture_ratio_5y = Column(DECIMAL(22, 6), comment='最近五年的上行捕获率')
    upsidecapture_ratio_incep = Column(DECIMAL(22, 6), comment='成立以来的上行捕获率')
    downsidecapture_ratio_1y = Column(DECIMAL(22, 6), comment='最近一年的下行捕获率')
    downsidecapture_ratio_2y = Column(DECIMAL(22, 6), comment='最近两年的下行捕获率')
    downsidecapture_ratio_3y = Column(DECIMAL(22, 6), comment='最近三年的下行捕获率')
    downsidecapture_ratio_4y = Column(DECIMAL(22, 6), comment='最近四年的下行捕获率')
    downsidecapture_ratio_5y = Column(DECIMAL(22, 6), comment='最近五年的下行捕获率')
    downsidecapture_ratio_incep = Column(DECIMAL(22, 6), comment='成立以来的下行捕获率')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class IndexesProfile(Base, BaseModel):
    __tablename__ = 'indexes_profile'
    __table_args__ = {'comment': '指数基本信息'}

    id = Column(String(64), primary_key=True, comment='指数Id')
    index_id = Column(String(10), comment='指数ID')
    index_type_id = Column(INTEGER(11), comment='指数类型：1-对冲基金指数、2-信心指数、3-公募基金指数、4-沪深港股票指数、5-全球股票指数、6-金汇期指、7-无风险利率、-1-其他')
    index_code = Column(String(60), comment='指数代码')
    index_name = Column(String(255), comment='指数中文全称')
    index_short_name = Column(String(80), comment='指数中文简称')
    index_area_flag = Column(INTEGER(11), comment='1-中国，2-全球')
    index_family_id = Column(String(64), comment='指数提供机构ID')
    pricing_frequency = Column(INTEGER(11), comment='指数发布周期，1-日度、2-周、3-月度、4-季度、5-半年度、6-年度')
    inception_date = Column(Date, comment='指数基期，指数开始日期')
    index_initial_value = Column(DECIMAL(22, 6), comment='指数基点')
    base_currency = Column(INTEGER(11), comment='计算指数所使用的货币，1-人民币，2-港币，3-美元，4-新加坡元、-1-其他')
    calculation_method = Column(String(80), comment='编制指数所使用的计算方法')
    weighting_scheme = Column(String(80), comment='计算成份基金权重的方法')
    selection_scheme = Column(String(80), comment='成份基金筛选方法')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class PersonnelCompanyMapping(Base, BaseModel):
    __tablename__ = 'personnel_company_mapping'
    __table_args__ = {'comment': '人员公司匹配表'}

    id = Column(String(62), primary_key=True)
    personnel_id = Column(String(64), nullable=False)
    company_id = Column(String(64), nullable=False, comment='任职公司id')
    company_order = Column(INTEGER(11), comment='公司次序')
    personnel_order = Column(INTEGER(11), comment='人物次序')
    address = Column(String(80), comment='联系地址')
    is_keyfigure = Column(INTEGER(11), comment='是否为核心人物标志，1-是，0-否，-1-其他')
    is_include = Column(INTEGER(11), comment='是否纳入团队信息')
    is_visible = Column(INTEGER(11), comment='人物是否在前台可见：1-可见，0-禁止显示')
    is_leave = Column(INTEGER(11), comment='人物是否离职：1-是，0-否')
    is_default = Column(INTEGER(11), comment='默认任职公司：1-是，0-否')
    is_senior = Column(TINYINT(4), comment='是否高管：1-是，0-否')
    is_represent = Column(TINYINT(4), comment='是否法人：1-是，0-否')
    start_date = Column(Date, comment='任职开始日期')
    end_date = Column(Date, comment='任职结束日期')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class PersonnelCompanyPositionMapping(Base, BaseModel):
    __tablename__ = 'personnel_company_position_mapping'
    __table_args__ = {'comment': '人员在公司职务信息'}

    id = Column(String(64), primary_key=True)
    personnel_id = Column(String(64), nullable=False, comment='人物id')
    company_id = Column(String(64), nullable=False, comment='公司id')
    personnel_type = Column(INTEGER(11), nullable=False, comment='人员类型:1-基金经理 2-投研 3-联系人 4-市场 5-合规风控 6-公司高管 7-公司法人 -1-其他')
    position = Column(String(40), nullable=False, comment='当前职位')
    department = Column(String(50), comment='任职部门')
    is_default = Column(INTEGER(11), comment='是否默认职位信息：1-是，0-否')
    start_date = Column(Date, comment='任职开始日期')
    end_date = Column(Date, comment='任职结束日期')
    position_order = Column(INTEGER(11), comment='职位次序')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class PersonnelInfo(Base, BaseModel):
    __tablename__ = 'personnel_info'
    __table_args__ = {'comment': '人物信息表'}

    id = Column(String(64), primary_key=True, comment='人员id')
    personnel_name = Column(String(40), nullable=False, comment='姓名')
    avatar = Column(String(255), comment='人员头像')
    personnel_type = Column(INTEGER(11), server_default=text("'-1'"), comment='人员类别，1-基金经理，2-研究员、3-联系人、-1-其他')
    profession_background = Column(TINYINT(4), server_default=text("'-1'"), comment='职业背景：1-券商，2-公募，3-其他金融机构，4-媒体，5-海外，6-民间，7-期货，8-实业、9-学者、10-银行、11-信托、12-保险、13-私募、-1-其他')
    key_figure = Column(INTEGER(11), server_default=text("'-1'"), comment='是否为核心人物标志，1-是，0-否，-1-其他')
    company_id = Column(String(64), index=True, comment='就职公司id')
    position = Column(String(64), comment='当前职位')
    career_start_year = Column(String(4), comment='从业开始年份')
    investment_experience = Column(INTEGER(11), nullable=False, server_default=text("'-1'"), comment='从业年限，<量纲：年>,-1:从业年限不详')
    sex = Column(INTEGER(11), comment='性别，1-男，2-女，-1-其他')
    graduateschool = Column(String(100), server_default=text("''"), comment='毕业院校')
    education = Column(INTEGER(11), server_default=text("'0'"), comment='最高学历：1-小学、2-中学、3-大专、4-本科，5-硕士，6-博士，7-博士后，-1-其他')
    major = Column(String(40), server_default=text("''"), comment='主修专业')
    profile = Column(Text, comment='人物简介')
    porder = Column(INTEGER(11), server_default=text("'0'"), comment='人物次序')
    ifinclude = Column(INTEGER(11), server_default=text("'0'"), comment='是否纳入团队信息')
    isvisible = Column(INTEGER(3), server_default=text("'1'"), comment='人物是否在前台可见：1-可见，0-禁止显示')
    is_qualify = Column(TINYINT(4), comment='是否有从业资格:1-是，2-否')
    topic = Column(Text, comment='荣誉名称')
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
    update_time = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"), comment='修改时间;第一次创建时与CreatTime值相同，修改时与修改时间相同')
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"), comment='记录的有效性；1-无效；0-有效；')


class QrQualitativeReport(Base, BaseModel):
    __tablename__ = 'qr_qualitative_report'
    __table_args__ = {'comment': '公司定性报告信息'}

    id = Column(String(64), primary_key=True, comment='定性报告ID，主键')
    company_id = Column(String(64), comment='公司id')
    organization_name = Column(String(80), nullable=False, comment='公司名称')
    report_name = Column(String(180), nullable=False, comment='报告名称')
    report_date = Column(Date, comment='报告日期')
    linkman = Column(String(50), comment='联系人')
    linkman_position = Column(String(30), comment='联系人职位')
    linkman_mobile = Column(String(20), comment='联系人电话')
    linkman_email = Column(String(50), comment='联系人邮箱')
    visiting_personnel = Column(String(50), comment='走访人员')
    visit_date = Column(Date, comment='走访时间')
    visit_way = Column(INTEGER(11), comment='走访方式：1-电话尽调 2-现场走访')
    report_source = Column(TINYINT(4), comment='报告来源：1-机构 2-组合大师')
    source_id = Column(INTEGER(11), comment='来源ID,组合大师用户打分模板ID. 0=模板')
    report_status = Column(TINYINT(4), comment='报告状态：0-草稿 1-发布')
    is_admin = Column(TINYINT(4), comment='是否管理员填写： 0-否， 1-是\t')
    completion_rate = Column(DECIMAL(22, 6), comment='完成比例')
    create_by = Column(String(64))
    create_time = Column(DateTime)
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class RzIndex(Base, BaseModel):
    __tablename__ = 'rz_index'
    __table_args__ = {'comment': '融智指数'}

    id = Column(String(64), primary_key=True)
    index_id = Column(String(64), nullable=False, index=True, comment='指数ID与index_profile的index_id关联')
    index_code = Column(String(64), nullable=False, index=True, comment='指数代码来源于indexes_profile')
    end_date = Column(Date, nullable=False, comment='指数截止月份')
    index_value = Column(DECIMAL(22, 0), nullable=False, comment='本期指数')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class StockIndustryType(Base, BaseModel):
    __tablename__ = 'stock_industry_type'
    __table_args__ = {'comment': '股票行业分类'}

    id = Column(String(64), primary_key=True)
    stock_industry_id = Column(INTEGER(11), nullable=False, server_default=text("'-1'"), comment='股票行业分类（申万行业分类）:1-农林牧渔、2-采掘、3-化工、4-黑色金属、5-有色金属、6-建筑建材、7-机械设备、8-电子元器件、9-交运设备、10-信息设备、11-家用电器、12-食品饮料、13-纺织服装、14-轻工制造、15-医药生物、16-公用事业、17-交通运输、18-房地产、19-金融服务、20-商业贸易、21-餐饮旅游、22-信息服务、23-综合、-1-其他')
    stock_industry_type = Column(String(64), nullable=False, comment='股票行业分类')
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间,默认第一次创建的getdate()时间')
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"), comment='修改时间;第一次创建时与CreatTime值相同，修改时与修改时间相同')
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class StockInfo(Base, BaseModel):
    __tablename__ = 'stock_info'
    __table_args__ = {'comment': '股票信息'}

    id = Column(String(64), primary_key=True)
    stock_code = Column(String(64), nullable=False, index=True, comment='股票代码')
    stock_type = Column(String(3), nullable=False, comment='股票类型')
    stock_name = Column(String(64), nullable=False, comment='股票简称')
    create_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
    update_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))


class UserComposeFundCount(Base, BaseModel):
    __tablename__ = 'user_compose_fund_count'
    __table_args__ = {'comment': '用户组合基金收益'}

    id = Column(String(64), primary_key=True)
    user_id = Column(String(255), nullable=False)
    fund_id = Column(String(255), nullable=False)
    profit_ratio = Column(String(255))
    profit_ratio_total = Column(DECIMAL(10, 0))
    fund_index = Column(DECIMAL(22, 6))
    create_time = Column(DateTime)
    create_by = Column(String(64))
    update_by = Column(String(64))
    update_time = Column(DateTime)
    delete_tag = Column(INTEGER(3), nullable=False)


class UserHoldFundInfo(Base, BaseModel):
    __tablename__ = 'user_hold_fund_info'
    __table_args__ = {'comment': '用户持仓信息'}

    id = Column(String(64), primary_key=True, comment='唯一主键')
    user_id = Column(String(64), nullable=False, comment='用户ID')
    p_fund_id = Column(String(64), comment='组合基金ID')
    fund_id = Column(String(64), nullable=False, comment='基金ID')
    buy_fee_ratio = Column(DECIMAL(22, 6), comment='申购费率')
    confirm_share = Column(DECIMAL(22, 6), comment='确认份额')
    confirm_share_date = Column(DateTime, comment='确认份额日期')
    confirm_amount = Column(INTEGER(11), comment='确认金额（单位：分）')
    fund_nav_id = Column(String(64), comment='确认单位净值')
    fund_nav = Column(DECIMAL(22, 6), comment='确认单位净值')
    init_weight = Column(DECIMAL(22, 6), comment='初始权重')
    cost_amount = Column(INTEGER(11), comment='成本(单位：分)')
    market_value = Column(INTEGER(11), comment='市值（单位：分）')
    profit_loss = Column(INTEGER(11), comment='盈亏（单位：分）')
    match_ratio = Column(DECIMAL(22, 6), comment='配比')
    create_time = Column(DateTime)
    create_by = Column(String(64))
    update_time = Column(DateTime)
    update_by = Column(String(64))
    delete_tag = Column(INTEGER(3), nullable=False)


class UserHoldFundInfoHistory(Base, BaseModel):
    __tablename__ = 'user_hold_fund_info_history'
    __table_args__ = {'comment': '用户历史持仓变动'}

    id = Column(String(64), primary_key=True, comment='唯一主键')
    user_id = Column(String(64), nullable=False, comment='用户ID')
    p_fund_id = Column(String(64), comment='组合基金ID')
    fund_id = Column(String(64), nullable=False, comment='基金ID')
    buy_fee_ratio = Column(DECIMAL(22, 6), comment='申购费率')
    confirm_share = Column(DECIMAL(22, 6), comment='确认份额')
    confirm_share_date = Column(DateTime, comment='确认份额日期')
    confirm_amount = Column(INTEGER(11), comment='确认金额（单位：分）')
    fund_nav_id = Column(String(64), comment='确认单位净值')
    fund_nav = Column(DECIMAL(22, 6), comment='确认单位净值')
    init_weight = Column(DECIMAL(22, 6), comment='初始权重')
    cost_amount = Column(INTEGER(11), comment='成本(单位：分)')
    market_value = Column(INTEGER(11), comment='市值（单位：分）')
    profit_loss = Column(INTEGER(11), comment='盈亏（单位：分）')
    match_ratio = Column(DECIMAL(22, 6), comment='配比')
    ratio_transfer = Column(DECIMAL(22, 6), comment='较上次调仓')
    create_time = Column(DateTime)
    create_by = Column(String(64))
    update_time = Column(DateTime)
    update_by = Column(String(64))
    delete_tag = Column(INTEGER(3), nullable=False)


class UserSingleFundCount(Base, BaseModel):
    __tablename__ = 'user_single_fund_count'
    __table_args__ = {'comment': '用户单只基金收益统计'}

    id = Column(String(64), primary_key=True)
    user_id = Column(String(64), nullable=False, comment='用户ID')
    fund_id = Column(String(64), nullable=False, comment='基金ID')
    count_date = Column(Date, nullable=False, comment='统计日期')
    profit_radio = Column(DECIMAL(22, 6), comment='收益率')
    retracement_radio = Column(DECIMAL(22, 6), comment='回撤率')
    create_time = Column(DateTime)
    create_by = Column(String(64))
    update_time = Column(DateTime)
    update_by = Column(String(64))
    delete_tag = Column(INTEGER(3), nullable=False, server_default=text("'0'"))
