from langgraph.graph import MessagesState


from pydantic import BaseModel, Field
from typing import Optional,List
from datetime import datetime

from elasticsearch_dsl import connections,Document, Date, Nested, Boolean, \
    analyzer, InnerDoc, Completion, Keyword, Text,Integer,Long,Double,Float,\
    DateRange,IntegerRange,FloatRange,IpRange,Ip,Range

class HSLT_LIST(BaseModel):
    '''沪深两市的公司列表'''
    t: str = Field(..., description="服务器更新时间yyyy-MM-dd HH:mm:ss")
    dm: str = Field(description="股票的代码为交易所+六位交易代码，例如：sh601398")
    mc: str = Field(description="股票名称，例如：工商银行")
    jys: str = Field(description="交易所，'sh'表示上证，'sz'表示深证")    
class HSCP_GSJJ(BaseModel):
    '''某只股票的基本信息和上市信息'''
    t: str = Field(..., description="服务器更新时间yyyy-MM-dd HH:mm:ss")
    mr_code: str = Field(..., description="股票代码")
    name: str = Field(..., description="公司名称")
    ename: str = Field(..., description="公司英文名称")
    market: str = Field(..., description="上市市场")
    idea: str = Field(..., description="概念及板块，多个概念由英文逗号分隔")
    ldate: datetime = Field(..., description="上市日期，格式yyyy-MM-dd")
    sprice: str = Field(..., description="发行价格（元）")
    principal: str = Field(..., description="主承销商")
    rdate: str = Field(..., description="成立日期")
    rprice: str = Field(..., description="注册资本")
    instype: str = Field(..., description="机构类型")
    organ: str = Field(..., description="组织形式")
    secre: str = Field(..., description="董事会秘书")
    phone: str = Field(..., description="公司电话")
    sphone: str = Field(..., description="董秘电话")
    fax: str = Field(..., description="公司传真")
    sfax: str = Field(..., description="董秘传真")
    email: str = Field(..., description="公司电子邮箱")
    semail: str = Field(..., description="董秘电子邮箱")
    site: str = Field(..., description="公司网站")
    post: str = Field(..., description="邮政编码")
    infosite: str = Field(..., description="信息披露网址")
    oname: str = Field(..., description="证券简称更名历史")
    addr: str = Field(..., description="注册地址")
    oaddr: str = Field(..., description="办公地址")
    desc: str = Field(..., description="公司简介")
    bscope: str = Field(..., description="经营范围")
    printype: str = Field(..., description="承销方式")
    referrer: str = Field(..., description="上市推荐人")
    putype: str = Field(..., description="发行方式")
    pe: str = Field(..., description="发行市盈率（按发行后总股本）")
    firgu: str = Field(..., description="首发前总股本（万股）")
    lastgu: str = Field(..., description="首发后总股本（万股）")
    realgu: str = Field(..., description="实际发行量（万股）")
    planm: str = Field(..., description="预计募集资金（万元）")
    realm: str = Field(..., description="实际募集资金合计（万元）")
    pubfee: str = Field(..., description="发行费用总额（万元）")
    collect: str = Field(..., description="募集资金净额（万元）")
    signfee: str = Field(..., description="承销费用（万元）")
    pdate: datetime = Field(..., description="招股公告日")

class HSZG_ZG(BaseModel):
    mr_code:str = Field(description="股票代码")
    t: str = Field(..., description="服务器更新时间yyyy-MM-dd HH:mm:ss")
    code:str = Field(description="指数、行业、概念代码，如：sw2_650300")
    name:str = Field(description="指数、行业、概念名称，如：沪深股市-申万二级-国防军工-地面兵装")

class CWZB(BaseModel):
    '''某只股票的财务指标信息'''
    date: str = Field(..., description="报告日期yyyy-MM-dd")
    tbmg: Optional[float|str] = Field(None, description="摊薄每股收益(元)")
    jqmg: Optional[float|str] = Field(None, description="加权每股收益(元)")
    mgsy: Optional[float|str] = Field(None, description="每股收益_调整后(元)")
    kfmg: Optional[float|str] = Field(None, description="扣除非经常性损益后的每股收益(元)")
    mgjz: Optional[float|str] = Field(None, description="每股净资产_调整前(元)")
    mgjzad: Optional[float|str] = Field(None, description="每股净资产_调整后(元)")
    mgjy: Optional[float|str] = Field(None, description="每股经营性现金流(元)")
    mggjj: Optional[float|str] = Field(None, description="每股资本公积金(元)")
    mgwly: Optional[float|str] = Field(None, description="每股未分配利润(元)")
    zclr: Optional[float|str] = Field(None, description="总资产利润率(%)")
    zylr: Optional[float|str] = Field(None, description="主营业务利润率(%)")
    zzlr: Optional[float|str] = Field(None, description="总资产净利润率(%)")
    cblr: Optional[float|str] = Field(None, description="成本费用利润率(%)")
    yylr: Optional[float|str] = Field(None, description="营业利润率(%)")
    zycb: Optional[float|str] = Field(None, description="主营业务成本率(%)")
    xsjl: Optional[float|str] = Field(None, description="销售净利率(%)")
    gbbc: Optional[float|str] = Field(None, description="股本报酬率(%)")
    jzbc: Optional[float|str] = Field(None, description="净资产报酬率(%)")
    zcbc: Optional[float|str] = Field(None, description="资产报酬率(%)")
    xsml: Optional[float|str] = Field(None, description="销售毛利率(%)")
    xxbz: Optional[float|str] = Field(None, description="三项费用比重")
    fzy: Optional[float|str] = Field(None, description="非主营比重")
    zybz: Optional[float|str] = Field(None, description="主营利润比重")
    gxff: Optional[float|str] = Field(None, description="股息发放率(%)")
    tzsy: Optional[float|str] = Field(None, description="投资收益率(%)")
    zyyw: Optional[float|str] = Field(None, description="主营业务利润(元)")
    jzsy: Optional[float|str] = Field(None, description="净资产收益率(%)")
    jqjz: Optional[float|str] = Field(None, description="加权净资产收益率(%)")
    kflr: Optional[float|str] = Field(None, description="扣除非经常性损益后的净利润(元)")
    zysr: Optional[float|str] = Field(None, description="主营业务收入增长率(%)")
    jlzz: Optional[float|str] = Field(None, description="净利润增长率(%)")
    jzzz: Optional[float|str] = Field(None, description="净资产增长率(%)")
    zzzz: Optional[float|str] = Field(None, description="总资产增长率(%)")
    ysz: Optional[float|str] = Field(None, description="应收账款周转率(次)")
    yszzt: Optional[float|str] = Field(None, description="应收账款周转天数(天)")
    chzz: Optional[float|str] = Field(None, description="存货周转天数(天)")
    chzzl: Optional[float|str] = Field(None, description="存货周转率(次)")
    gzzz: Optional[float|str] = Field(None, description="固定资产周转率(次)")
    zzzzl: Optional[float|str] = Field(None, description="总资产周转率(次)")
    zzzzt: Optional[float|str] = Field(None, description="总资产周转天数(天)")
    ldzz: Optional[float|str] = Field(None, description="流动资产周转率(次)")
    ldzzt: Optional[float|str] = Field(None, description="流动资产周转天数(天)")
    gdzz: Optional[float|str] = Field(None, description="股东权益周转率(次)")
    ldb: Optional[float|str] = Field(None, description="流动比率")
    sdbl: Optional[float|str] = Field(None, description="速动比率")
    xjbl: Optional[float|str] = Field(None, description="现金比率(%)")
    lxzf: Optional[float|str] = Field(None, description="利息支付倍数")
    zjbl: Optional[float|str] = Field(None, description="长期债务与营运资金比率(%)")
    gdqy: Optional[float|str] = Field(None, description="股东权益比率(%)")
    cqfz: Optional[float|str] = Field(None, description="长期负债比率(%)")
    gdgd: Optional[float|str] = Field(None, description="股东权益与固定资产比率(%)")
    fzqy: Optional[float|str] = Field(None, description="负债与所有者权益比率(%)")
    zczjbl: Optional[float|str] = Field(None, description="长期资产与长期资金比率(%)")
    zblv: Optional[float|str] = Field(None, description="资本化比率(%)")
    gdzcjz: Optional[float|str] = Field(None, description="固定资产净值率(%)")
    zbgdh: Optional[float|str] = Field(None, description="资本固定化比率(%)")
    cqbl: Optional[float|str] = Field(None, description="产权比率(%)")
    qxjzb: Optional[float|str] = Field(None, description="清算价值比率(%)")
    gdzcbz: Optional[float|str] = Field(None, description="固定资产比重(%)")
    zcfzl: Optional[float|str] = Field(None, description="资产负债率(%)")
    zzc: Optional[float|str] = Field(None, description="总资产(元)")
    jyxj: Optional[float|str] = Field(None, description="经营现金净流量对销售收入比率(%)")
    zcjyxj: Optional[float|str] = Field(None, description="资产的经营现金流量回报率(%)")
    jylrb: Optional[float|str] = Field(None, description="经营现金净流量与净利润的比率(%)")
    jyfzl: Optional[float|str] = Field(None, description="经营现金净流量对负债比率(%)")
    xjlbl: Optional[float|str] = Field(None, description="现金流量比率(%)")
    dqgptz: Optional[float|str] = Field(None, description="短期股票投资(元)")
    dqzctz: Optional[float|str] = Field(None, description="短期债券投资(元)")
    dqjytz: Optional[float|str] = Field(None, description="短期其它经营性投资(元)")
    qcgptz: Optional[float|str] = Field(None, description="长期股票投资(元)")
    cqzqtz: Optional[float|str] = Field(None, description="长期债券投资(元)")
    cqjyxtz: Optional[float|str] = Field(None, description="长期其它经营性投资(元)")
    yszk1: Optional[float|str] = Field(None, description="1年以内应收帐款(元)")
    yszk12: Optional[float|str] = Field(None, description="1-2年以内应收帐款(元)")
    yszk23: Optional[float|str] = Field(None, description="2-3年以内应收帐款(元)")
    yszk3: Optional[float|str] = Field(None, description="3年以内应收帐款(元)")
    yfhk1: Optional[float|str] = Field(None, description="1年以内预付货款(元)")
    yfhk12: Optional[float|str] = Field(None, description="1-2年以内预付货款(元)")
    yfhk23: Optional[float|str] = Field(None, description="2-3年以内预付货款(元)")
    yfhk3: Optional[float|str] = Field(None, description="3年以内预付货款(元)")
    ysk1: Optional[float|str] = Field(None, description="1年以内其它应收款(元)")
    ysk12: Optional[float|str] = Field(None, description="1-2年以内其它应收款(元)")
    ysk23: Optional[float|str] = Field(None, description="2-3年以内其它应收款(元)")
    ysk3: Optional[float|str] = Field(None, description="3年以内其它应收款(元)")

class JDLR(BaseModel):
    '''某只股票各季度的利润情况'''
    date:str = Field(description="截止日期yyyy-MM-dd")
    income:str = Field(description="营业收入（万元）")
    expend:str = Field(description="营业支出（万元）")
    profit:str = Field(description="营业利润（万元）")
    totalp:str = Field(description="利润总额（万元）")
    reprofit:str = Field(description="净利润（万元）")
    basege:str = Field(description="基本每股收益(元/股)")
    ettege:str = Field(description="稀释每股收益(元/股)")
    otherp:str = Field(description="其他综合收益（万元）")
    totalcp:str = Field(description="综合收益总额（万元）")

class JDXJ(BaseModel):
    '''某只股票各季度的现金流情况'''
    date: str = Field(..., description="截止日期yyyy-MM-dd")
    jyin: Optional[float|str] = Field(None, description="经营活动现金流入小计（万元）")
    jyout: Optional[float|str] = Field(None, description="经营活动现金流出小计（万元）")
    jyfinal: Optional[float|str] = Field(None, description="经营活动产生的现金流量净额（万元）")
    tzin: Optional[float|str] = Field(None, description="投资活动现金流入小计（万元）")
    tzout: Optional[float|str] = Field(None, description="投资活动现金流出小计（万元）")
    tzfinal: Optional[float|str] = Field(None, description="投资活动产生的现金流量净额（万元）")
    czin: Optional[float|str] = Field(None, description="筹资活动现金流入小计（万元）")
    czout: Optional[float|str] = Field(None, description="筹资活动现金流出小计（万元）")
    czfinal: Optional[float|str] = Field(None, description="筹资活动产生的现金流量净额（万元）")
    hl: Optional[float|str] = Field(None, description="汇率变动对现金及现金等价物的影响（万元）")
    cashinc: Optional[float|str] = Field(None, description="现金及现金等价物净增加额（万元）")
    cashs: Optional[float|str] = Field(None, description="期初现金及现金等价物余额（万元）")
    cashe: Optional[float|str] = Field(None, description="期末现金及现金等价物余额（万元）")

class SSJY(BaseModel):
    '''某只股票实时的交易信息'''
    fm: Optional[float] = Field(None, description="五分钟涨跌幅（%）")
    h: Optional[float] = Field(None, description="最高价（元）")
    hs: Optional[float] = Field(None, description="换手（%）")
    lb: Optional[float] = Field(None, description="量比（%）")
    l: Optional[float] = Field(None, description="最低价（元）")
    lt: Optional[float] = Field(None, description="流通市值（元）")
    o: Optional[float] = Field(None, description="开盘价（元）")
    pe: Optional[float] = Field(None, description="市盈率（动态，总市值除以预估全年净利润）")
    pc: Optional[float] = Field(None, description="涨跌幅（%）")
    p: Optional[float] = Field(None, description="当前价格（元）")
    sz: Optional[float] = Field(None, description="总市值（元）")
    cje: Optional[float] = Field(None, description="成交额（元）")
    ud: Optional[float] = Field(None, description="涨跌额（元）")
    v: Optional[float] = Field(None, description="成交量（手）")
    yc: Optional[float] = Field(None, description="昨日收盘价（元）")
    zf: Optional[float] = Field(None, description="振幅（%）")
    zs: Optional[float] = Field(None, description="涨速（%）")
    sjl: Optional[float] = Field(None, description="市净率")
    zdf60: Optional[float] = Field(None, description="60日涨跌幅（%）")
    zdfnc: Optional[float] = Field(None, description="年初至今涨跌幅（%）")
    t: str = Field(..., description="更新时间YYYY-MM-DD HH:MM")

class HSRL_MMWP(BaseModel):
    '''某只股票当前的5档盘口信息'''
    t: str = Field(..., description="更新时间YYYY-MM-DD HH:MM")
    mr_code: str = Field(...,description="股票代码")
    vc: Optional[float] = Field(None, description="委差（股）")
    vb: Optional[float] = Field(None, description="委比（%）")
    
    # 买入报价和买入量
    pb1: Optional[float] = Field(None, description="买1价（元）")
    vb1: Optional[float] = Field(None, description="买1量（股）")
    pb2: Optional[float] = Field(None, description="买2价（元）")
    vb2: Optional[float] = Field(None, description="买2量（股）")
    pb3: Optional[float] = Field(None, description="买3价（元）")
    vb3: Optional[float] = Field(None, description="买3量（股）")
    pb4: Optional[float] = Field(None, description="买4价（元）")
    vb4: Optional[float] = Field(None, description="买4量（股）")
    pb5: Optional[float] = Field(None, description="买5价（元）")
    vb5: Optional[float] = Field(None, description="买5量（股）")
    
    # 卖出报价和卖出量
    ps1: Optional[float] = Field(None, description="卖1价（元）")
    vs1: Optional[float] = Field(None, description="卖1量（股）")
    ps2: Optional[float] = Field(None, description="卖2价（元）")
    vs2: Optional[float] = Field(None, description="卖2量（股）")
    ps3: Optional[float] = Field(None, description="卖3价（元）")
    vs3: Optional[float] = Field(None, description="卖3量（股）")
    ps4: Optional[float] = Field(None, description="卖4价（元）")
    vs4: Optional[float] = Field(None, description="卖4量（股）")
    ps5: Optional[float] = Field(None, description="卖5价（元）")
    vs5: Optional[float] = Field(None, description="卖5量（股）")
class HSRL_ZBJY(BaseModel):
    '''当天的股票逐笔交易'''
    mr_code:str = Field(description="股票代码")
    d:str = Field(description="数据归属日期（yyyy-MM-dd）")
    t:str = Field(description="数据归属日期下的时间（HH:mm:dd）")
    v:float = Field(description="成交量（股）")
    p:float = Field(description="成交价")
    ts:float = Field(description="交易方向（0：中性盘，1：买入，2：卖出）")
class HSRL_ZBDD(BaseModel):
    '''当天的股票逐笔大单交易'''
    mr_code:str = Field(description="股票代码")
    d:str = Field(description="数据归属日期（yyyy-MM-dd）")
    t:str = Field(description="数据归属日期下的时间（HH:mm:dd）")
    v:float = Field(description="成交量（股）")
    p:float = Field(description="成交价")
    ts:float = Field(description="交易方向（0：中性盘，1：买入，2：卖出）")

class JRTS(BaseModel):
    '''今日提示'''
    t: str = Field(..., description="日期yyyy-MM-dd")
    tp: Optional[List[str]] = Field(None, description="停牌。格式：tp:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：停牌说明”")
    zfssr: Optional[List[str]] = Field(None, description="转增上市日。格式：zfssr:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    gddh: Optional[List[str]] = Field(None, description="召开股东大会。格式：gddh:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    zqdjr: Optional[List[str]] = Field(None, description="债权登记日。格式：zqdjr:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    jjfp: Optional[List[str]] = Field(None, description="基金收益分配款发放日。格式：jjfp:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    jjcx: Optional[List[str]] = Field(None, description="基金收益分配除息日。格式：jjcx:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    jjdj: Optional[List[str]] = Field(None, description="基金权益登记日。格式：jjdj:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    szgg: Optional[List[str]] = Field(None, description="深交所公告。格式：szgg:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    shgg: Optional[List[str]] = Field(None, description="上交所公告。格式：shgg:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    jjfx: Optional[List[str]] = Field(None, description="开放式基金发行起始日。格式：jjfx:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    jjjz: Optional[List[str]] = Field(None, description="开放式基金发行截止日。格式：jjjz:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    gpgk: Optional[List[str]] = Field(None, description="股票交易公开信息。格式：gpgk:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    obsh: Optional[List[str]] = Field(None, description="货币型基金结转份额可赎回起始日。格式：obsh:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    cqcx: Optional[List[str]] = Field(None, description="恢复交易日。格式：cqcx:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")
    djr: Optional[List[str]] = Field(None, description="股票登记日。格式：djr:[xxx,xxx,...]，其中xxx格式为“(股票代码) 股票名称：说明”")

class ZJHHY(BaseModel):
    '''证监会行业板块数据'''
    t: str = Field(..., description="服务器更新时间yyyy-MM-dd HH:mm:ss")
    mc: str = Field(..., description="行业名称")
    dm: str = Field(..., description="行业代码")
    jj: float = Field(..., description="均价（元）")
    zdf: float = Field(..., description="涨跌幅（%）")
    lrzj: float = Field(..., description="流入资金（元）")
    lczj: float = Field(..., description="流出资金（元）")
    jlr: float = Field(..., description="净流入（元）")
    jlrl: float = Field(..., description="净流入率（%）")
    lzgmc: str = Field(..., description="领涨股名称")
    lzgdm: str = Field(..., description="领涨股代码")
    lzgjlrl: float = Field(..., description="领涨股净流入率（%）")

class GNBK(BaseModel):
    '''概念板块数据'''
    t: str = Field(..., description="服务器更新时间yyyy-MM-dd HH:mm:ss")
    mc: str = Field(..., description="概念板块名称")
    dm: str = Field(..., description="概念板块代码")
    jj: float = Field(..., description="均价（元）")
    zdf: float = Field(..., description="涨跌幅（%）")
    lrzj: float = Field(..., description="流入资金（元）")
    lczj: float = Field(..., description="流出资金（元）")
    jlr: float = Field(..., description="净流入（元）")
    jlrl: float = Field(..., description="净流入率（%）")
    lzgmc: str = Field(..., description="领涨股名称")
    lzgdm: str = Field(..., description="领涨股代码")
    lzgjlrl: float = Field(..., description="领涨股净流入率（%）")

class DZJY(BaseModel):
    '''大宗交易'''
    t: str = Field(..., description="日期yyyy-MM-dd")
    dm: str = Field(..., description="股票代码")
    mc: str = Field(..., description="股票名称")
    p: float = Field(..., description="成交价格(元)")
    v: float = Field(..., description="成交量(万股)")
    dp: float = Field(..., description="成交金额(万元)")
    buyi: str = Field(..., description="买方营业部")
    selli: str = Field(..., description="卖方营业部")
    type: str = Field(..., description="证券类型")

class JLR(BaseModel):
    ''''所有股票近一个交易日的资金净流入情况，也包括对应的涨跌幅、换手率、成交额等信息'''
    t: str = Field(..., description="服务器更新时间yyyy-MM-dd HH:mm:ss")
    mc: Optional[str] = Field(None, description="股票名称")
    dm: Optional[str] = Field(None, description="股票代码")
    zxj: Optional[float] = Field(None, description="最新价（元）")
    zdf: Optional[float] = Field(None, description="涨跌幅（%）")
    hsl: Optional[float] = Field(None, description="换手率（%）")
    cje: Optional[float] = Field(None, description="成交额（元）")
    lczj: Optional[float] = Field(None, description="流出资金（元）")
    lrzj: Optional[float] = Field(None, description="流入资金（元）")
    jlr: Optional[float|str] = Field(None, description="净流入（元）")
    jlrl: Optional[float|str] = Field(None, description="净流入率（%）")

class ZLJLR(BaseModel):
    ''''所有股票近一个交易日主力资金的净流入情况，也包括对应的涨跌幅、换手率、成交额等信息'''
    t: str = Field(..., description="服务器更新时间yyyy-MM-dd HH:mm:ss")
    mc: Optional[str] = Field(None, description="名称")
    dm: Optional[str] = Field(None, description="代码")
    zxj: Optional[float] = Field(None, description="最新价（元）")
    zdf: Optional[float] = Field(None, description="涨跌幅（%）")
    hsl: Optional[float] = Field(None, description="换手率（%）")
    cje: Optional[float] = Field(None, description="成交额（元）")
    zllczj: Optional[float] = Field(None, description="主力流出资金（元）")
    zllrzj: Optional[float] = Field(None, description="主力流入资金（元）")
    zljlr: Optional[float|str] = Field(None, description="主力净流入（元）")
    zljlrl: Optional[float|str] = Field(None, description="主力净流入率（%）")

class SHJLR(BaseModel):
    ''''所有股票近一个交易日散户资金的净流入情况，也包括对应的涨跌幅、换手率、成交额等信息'''
    t: str = Field(..., description="服务器更新时间yyyy-MM-dd HH:mm:ss")
    mc: Optional[str] = Field(None, description="名称")
    dm: Optional[str] = Field(None, description="代码")
    zxj: Optional[float] = Field(None, description="最新价（元）")
    zdf: Optional[float] = Field(None, description="涨跌幅（%）")
    hsl: Optional[float] = Field(None, description="换手率（%）")
    cje: Optional[float] = Field(None, description="成交额（元）")
    shlczj: Optional[float] = Field(None, description="散户流出资金（元）")
    shlrzj: Optional[float] = Field(None, description="散户流入资金（元）")
    shjlr: Optional[float|str] = Field(None, description="散户净流入（元）")
    shjlrl: Optional[float|str] = Field(None, description="散户净流入率（%）")
    
class JDDXT(BaseModel):
    '''
    近十个交易日内的阶段资金动向。近3日、5日、10日是指对应天数的累积量或累计率。
    '''
    t:str = Field(...,description="时间yyyy-MM-dd")
    jlr3:float = Field(...,description="近3日主力净流入(元）")
    jlr5:float = Field(...,description="近5日主力净流入(元）")
    jlr10:float = Field(...,description="近10日主力净流入(元）")
    jlrl3:float = Field(...,description="近3日主力净流入率(%）")
    jlrl5:float = Field(...,description="近5日主力净流入率(%）")
    jlrl10:float = Field(...,description="近10日主力净流入率(%）")

class ZS_LSGL(BaseModel):
    '''沪深两市涨跌幅数量统计'''
    t: str = Field(..., description="服务器更新时间yyyy-MM-dd HH:mm:ss")
    totalUp: int = Field(..., description="上涨总数")
    totalDown: int = Field(..., description="下跌总数")
    zt: int = Field(..., description="涨停总数")
    dt: int = Field(..., description="跌停总数")
    up8ToZt: int = Field(..., description="上涨8%~涨停的数量")
    up6To8: int = Field(..., description="上涨6%~8%的数量")
    up4To6: int = Field(..., description="上涨4%~6%的数量")
    up2To4: int = Field(..., description="上涨2%~4%的数量")
    up0To2: int = Field(..., description="上涨0%~2%的数量")
    down0To2: int = Field(..., description="下跌0%~-2%的数量")
    down2To4: int = Field(..., description="下跌-2%~-4%的数量")
    down4To6: int = Field(..., description="下跌-4%~-6%的数量")
    down6To8: int = Field(..., description="下跌-6%~-8%的数量")
    down8ToDt: int = Field(..., description="下跌-8%~跌停的数量")

class HSZBC_FSJY(BaseModel):
    mr_code: str = Field(...,description="股票代码")
    d: str = Field(..., description="交易时间，短分时级别格式为YYYY-MM-DD HH:MM，日线级别为yyyy-MM-dd")
    o: float = Field(..., description="开盘价（元）")
    h: float = Field(..., description="最高价（元）")
    l: float = Field(..., description="最低价（元）")
    c: float = Field(..., description="收盘价（元）")
    v: float = Field(..., description="成交量（手）")
    e: float = Field(..., description="成交额（元）")
    zf: float = Field(..., description="振幅（%）")
    hs: float = Field(..., description="换手率（%）")
    zd: float = Field(..., description="涨跌幅（%）")
    zde: float = Field(..., description="涨跌额（元）")
    ud: str = Field(...,description="系统更新的时间，格式为YYYY-MM-DD HH:MM:SS")

class ES_HSZBC_FSJY(Document):
    mr_code = Text()
    d = Date()
    o = Float()
    h = Float()
    l = Float()
    c = Float()
    v = Float()
    e = Float()
    zf = Float()
    hs = Float()
    zd = Float()
    zde = Float()
    ud = Text()
    class Index:
        name = 'hszbc_fsjy'

class NewState(MessagesState):
    summary:str
    mmwp:dict
