akfamily / akshare

AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库
https://akshare.akfamily.xyz
MIT License
9.28k stars 1.88k forks source link

ak.match_main_contract(symbol="ine") 不支持ine #5229

Closed JumpWill closed 2 weeks ago

JumpWill commented 2 weeks ago
def match_main_contract(symbol: str = "cffex") -> str:
    """
    新浪财经-期货-主力合约
    https://vip.stock.finance.sina.com.cn/quotes_service/view/qihuohangqing.html#titlePos_1
    :param symbol: choice of {'czce', 'dce', 'shfe', 'cffex', 'gfex'}
    :type symbol: str
    :return: 主力合约的字符串
    :rtype: str
    """
    subscribe_exchange_list = []
    exchange_symbol_list = zh_subscribe_exchange_symbol(symbol).iloc[:, 1].tolist()
    for item in exchange_symbol_list:

不支持上海国际能源交易中心

交易所名称 交易所代码 合约后缀 首页地址
中国金融期货交易所 CFFEX .CFX http://www.cffex.com.cn
上海期货交易所 SHFE .SHF https://www.shfe.com.cn
上海国际能源交易中心 INE .INE https://www.ine.cn
郑州商品交易所 CZCE .ZCE http://www.czce.com.cn
大连商品交易所 DCE .DCE http://www.dce.com.cn
广州期货交易所 GFEX .GFEX http://www.gfex.com.cn

error code

aceback (most recent call last):
  File "/Users/will/doc/code/python/2.py", line 17, in <module>
    ak.match_main_contract(symbol="ine")
  File "/Users/will/doc/code/python/.venv/lib/python3.9/site-packages/akshare/futures/futures_zh_sina.py", line 181, in match_main_contract
    exchange_symbol_list = zh_subscribe_exchange_symbol(symbol).iloc[:, 1].tolist()
AttributeError: 'NoneType' object has no attribute 'iloc'

环境: macos python 3.9.6 akshare. == 1.14.93

albertandking commented 2 weeks ago
match_main_contract

新浪默认将 INE 划分到 SHFE