+
    Ȝip                     8   R t ^ RIt^ RIHt ^ RIt^ RItR R ltRR R	 lltRR
 R llt	RR R llt
RR R llt]R8X  dY   ]! 4       t]! ]4       ]! RRRR7      t]! ]4       ]	! RR7      t]! ]4       ]
! RRR7      t]! ]4       ]! RR7      t]! ]4       R# R# )uP   
Date: 2026/1/12 15:00
Desc: 国证指数
https://www.cnindex.com.cn/index.html
N)BytesIOc                8    V ^8  d   QhR\         P                  /# )   return)pd	DataFrame)formats   "`/Users/mibo/.openclaw/workspace/.venv-ak/lib/python3.14/site-packages/akshare/index/index_cni.py__annotate__r
      s     = =r|| =    c                 p   Rp RRRRRR/p\         P                  ! WR7      pVP                  4       p\        P                  ! VR	,          R,          4      p. ROVn        V. RO,          pVR
,          R,          VR
&   VR,          R,          VR&   VR,          R,          VR&   VR,          R,          VR&   V# )u   
国证指数-最近交易日的所有指数
https://www.cnindex.com.cn/zh_indices/sese/index.html?act_menu=1&index_type=-1
:return: 国证指数-所有指数
:rtype: pandas.DataFrame
z*https://www.cnindex.com.cn/index/indexListchannelCodez-1rows2000pageNum1paramsdata	   成交量	   成交额	   总市值   自由流通市值i i )_r      指数代码r   r   r   r   r      指数简称r   r   r   	   样本数   收盘点位	   涨跌幅r      PE滚动r   r   r   r   r   r   r   r   )
r   r   r   r   r   r   r   r   r   r   )requestsgetjsonr   r   columns)urlr   r	data_jsontemp_dfs        r	   index_all_cnir(      s     7Ct3F
 	S(AIll9V,V45GGO6 	
G #;/&8GK";/);GK";/);GK$+,@$AI$MG !Nr   3990012023011420240114c                \    V ^8  d   QhR\         R\         R\         R\        P                  /# )r   symbol
start_dateend_dater   strr   r   )r   s   "r	   r
   r
   P   s6     @ @@(+@DG@\\@r   c                   RP                  VR,          VR,          VR,          .4      pRP                  VR,          VR,          VR,          .4      pRpRV RVRVR	R
/p\        P                  ! W4R7      pVP                  4       p\        P
                  ! VR,          R,          4      p. ROVn        V. RO,          pVR,          P                  P                  RR4      VR&   VR,          P                  R4      VR&   VR,          ^d,          VR&   VP                  R.RRR7       \        P                  ! VR,          RR7      P                  P                  VR&   \        P                  ! VR,          RR7      VR&   \        P                  ! VR,          RR7      VR&   \        P                  ! VR,          RR7      VR&   \        P                  ! VR,          RR7      VR&   \        P                  ! VR,          RR7      VR&   \        P                  ! VR,          RR7      VR&   \        P                  ! VR,          RR7      VR&   V# )u:  
指数历史行情数据
http://www.cnindex.com.cn/module/index-detail.html?act_menu=1&indexCode=399001
:param symbol: 指数代码
:type symbol: str
:param start_date: 开始时间
:type start_date: str
:param end_date: 结束时间
:type end_date: str
:return: 指数历史行情数据
:rtype: pandas.DataFrame
-:N   N:r4      N:r5   NNzFhttp://hq.cnindex.com.cn/market/market/getIndexDailyDataWithDataFormat	indexCode	startDateendDate	frequencydayr   r      日期	   最高价	   开盘价	   最低价	   收盘价r   r   r   % floatT)inplaceignore_indexcoerceerrors)r;   r   r<   r=   r>   r?   r   r   r   r   r   )r;   r=   r<   r>   r?   r   r   r   )joinr    r!   r"   r   r   r#   r1   replaceastypesort_valuesto_datetimedtdate
to_numeric)r-   r.   r/   r$   r   r%   r&   r'   s   &&&     r	   index_hist_cnirP   P   s    :b>:c?JrNKLJxx"x}hrlCDH
RCVZ8U	F 	S(AIll9V,V45GGO 		
G #;/33;;CDGK";/66w?GK";/#5GK
DtDwx'8JMMRRGH==)=hOGK==)=hOGK==)=hOGK==)=hOGK==)=hOGK==)=hOGK==)=hOGKNr   c                D    V ^8  d   QhR\         R\        P                  /# r   r-   r   r0   )r   s   "r	   r
   r
      s      S  r   c                   ^ RI pVP                  R\        R7       RpRV /p\        P                  ! W#R7      p\
        P                  ! \        VP                  4      4      pVR,          P                  \        4      P                  P                  ^4      VR&   . ROVn        \
        P                  ! VR,          R
R7      VR&   \
        P                  ! VR	,          R
R7      VR	&   V# )u   
国证指数-样本详情-指定日期的样本成份
https://www.cnindex.com.cn/module/index-detail.html?act_menu=1&indexCode=399001
:param symbol: 指数代码
:type symbol: str
:return: 指定日期的样本成份
:rtype: pandas.DataFrame
Nignoreactioncategory9https://www.cnindex.com.cn/sample-detail/download-history	indexcoder      样本代码r      权重rE   rF   r;   rZ   u   样本简称u   所属行业r   r[   )warningssimplefilterUserWarningr    r!   r   
read_excelr   contentrJ   r1   zfillr#   rO   )r-   r]   r$   r   r%   r'   s   &     r	   index_detail_cnirc      s     K@
EC6"FS(AmmGAII./G%n5<<SAEEKKANGNGO ==)=hOGKgh&7IGHNr   c                D    V ^8  d   QhR\         R\        P                  /# rR   r0   )r   s   "r	   r
   r
      s      # R\\ r   c                   RpRV /p\         P                  ! WR7      p\        P                  ! \	        VP
                  4      4      pVR,          P                  \        4      P                  P                  ^4      VR&   . ROVn	        \        P                  ! VR,          4      VR&   \        P                  ! VR,          4      VR&   V# )u   
国证指数-样本详情-历史样本
https://www.cnindex.com.cn/module/index-detail.html?act_menu=1&indexCode=399001
:param symbol: 指数代码; "399001"
:type symbol: str
:return: 历史样本
:rtype: pandas.DataFrame
rX   rY   r   rZ   r   r[   r\   )r    r!   r   r`   r   ra   rJ   r1   rb   r#   rO   )r-   r$   r   r%   r'   s   &    r	   index_detail_hist_cnirf      s     FC6"FS(AmmGAII./G%n5<<SAEEKKANGNGO ==)=>GKgh&78GHNr   399005c                D    V ^8  d   QhR\         R\        P                  /# rR   r0   )r   s   "r	   r
   r
      s       BLL r   c                   RpRV /p\         P                  ! WR7      p ^ RIpVP                  4       ;_uu_ 4        VP	                  R\
        R7       \        P                  ! \        VP                  4      RR7      pRRR4       XR	,          P                  \        4      P                  P                  ^4      TR	&   T#   + '       g   i     LJ; i  \        P                   d    \        P                  ! 4       u # i ; i)
u   
国证指数-样本详情-历史调样
http://www.cnindex.com.cn/module/index-detail.html?act_menu=1&indexCode=399005
:param symbol: 指数代码
:type symbol: str
:return: 历史调样
:rtype: pandas.DataFrame
z;http://www.cnindex.com.cn/sample-detail/download-adjustmentrY   r   NrT   rU   openpyxl)enginerZ   )r    r!   r]   catch_warningsr^   r_   r   r`   r   ra   zipfile
BadZipFiler   rJ   r1   rb   )r-   r$   r   r%   r]   r'   s   &     r	   index_detail_hist_adjust_cniro      s     HC6"FS(A$$&&!!K!HmmGAII$6zJG '
 &n5<<SAEEKKANGNN '&  ||~s/   C AC >C  C	C C *D ?D __main__)r-   r.   r/   )r-   399101202404)r-   rN   )r)   r*   r+   )r)   )rg   )__doc__rm   ior   pandasr   r    r(   rP   rc   rf   ro   __name__index_all_cni_dfprintindex_hist_cni_dfindex_detail_cni_dfindex_detail_hist_cni_dfindex_detail_hist_adjust_cni_df r   r	   <module>r~      s       =@@F<60 z$	
&J 

*(;	
4H8T	
"#&B(&S#	
)*! r   