How to use the akshare.futures.cons.get_pk_data function in akshare

To help you get started, we’ve selected a few akshare examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jindaxiang / akshare / akshare / futures / futures_inventory.py View on Github external
'上海国际能源交易中心': {'102': '原油'}}
    'LME': {'18': 'LME铜', '19': 'LME铝', '25': 'LME镍', '26': 'LME铅', '27': 'LME锌', '45': 'LME锡', '50': 'LME铝合金'},
    'NYMEX': {'20': 'COMEX铜', '31': 'COMEX金', '32': 'COMEX银'},
    'CBOT': {'22': 'CBOT大豆', '46': 'CBOT小麦', '47': 'CBOT玉米', '48': 'CBOT燕麦', '49': 'CBOT糙米'},
    'NYBOT': {'30': 'NYBOT2号棉'}, 'TOCOM': {'44': 'TOCOM橡胶'}

    :param exchange: int 交易所, 请对照 __doc__ 中的代码输入
    :param symbol: int 品种, 请对照 __doc__ 中的代码输入对应交易所的品种
    # :param dir_path: str 存放图片的目录
    :param plot: Bool 画出历史库存曲线图
    :return: pandas.DataFrame and picture
    """
    while True:
        try:
            data_code = get_pk_data("exchange_symbol_value_list.pk")
            data_name = get_pk_data("exchange_symbol_list.pk")
            out_exchange_name = get_pk_data("code_exchange_name_dict.pk")
            name_temp_dict = {}
            code_temp_dict = {}
            for num in data_code.keys():
                name_temp_dict[out_exchange_name[num]] = dict(zip(data_code[num], data_name[num]))
                code_temp_dict[num] = dict(zip(data_code[num], data_name[num]))
            # print(name_temp_dict)
            # print(out_exchange_name)
            url = "http://service.99qh.com/Storage/Storage.aspx?page=99qh"
            # print(exchange)
            res = requests.get(url, headers=sample_headers)
            soup = BeautifulSoup(res.text, "lxml")
            view_state = soup.find_all(attrs={"id": "__VIEWSTATE"})[0]["value"]
            even_validation = soup.find_all(attrs={"id": "__EVENTVALIDATION"})[0]["value"]
            # print(symbol)
            if exchange != 1:
github jindaxiang / akshare / akshare / futures / futures_inventory.py View on Github external
'LME': {'18': 'LME铜', '19': 'LME铝', '25': 'LME镍', '26': 'LME铅', '27': 'LME锌', '45': 'LME锡', '50': 'LME铝合金'},
    'NYMEX': {'20': 'COMEX铜', '31': 'COMEX金', '32': 'COMEX银'},
    'CBOT': {'22': 'CBOT大豆', '46': 'CBOT小麦', '47': 'CBOT玉米', '48': 'CBOT燕麦', '49': 'CBOT糙米'},
    'NYBOT': {'30': 'NYBOT2号棉'}, 'TOCOM': {'44': 'TOCOM橡胶'}

    :param exchange: int 交易所, 请对照 __doc__ 中的代码输入
    :param symbol: int 品种, 请对照 __doc__ 中的代码输入对应交易所的品种
    # :param dir_path: str 存放图片的目录
    :param plot: Bool 画出历史库存曲线图
    :return: pandas.DataFrame and picture
    """
    while True:
        try:
            data_code = get_pk_data("exchange_symbol_value_list.pk")
            data_name = get_pk_data("exchange_symbol_list.pk")
            out_exchange_name = get_pk_data("code_exchange_name_dict.pk")
            name_temp_dict = {}
            code_temp_dict = {}
            for num in data_code.keys():
                name_temp_dict[out_exchange_name[num]] = dict(zip(data_code[num], data_name[num]))
                code_temp_dict[num] = dict(zip(data_code[num], data_name[num]))
            # print(name_temp_dict)
            # print(out_exchange_name)
            url = "http://service.99qh.com/Storage/Storage.aspx?page=99qh"
            # print(exchange)
            res = requests.get(url, headers=sample_headers)
            soup = BeautifulSoup(res.text, "lxml")
            view_state = soup.find_all(attrs={"id": "__VIEWSTATE"})[0]["value"]
            even_validation = soup.find_all(attrs={"id": "__EVENTVALIDATION"})[0]["value"]
            # print(symbol)
            if exchange != 1:
                payload = {
github jindaxiang / akshare / akshare / futures / futures_inventory.py View on Github external
'大连商品交易所': {'11': '豆一', '12': '豆二', '16': '豆粕', '24': '玉米', '52': '豆油', '56': '聚乙烯', '57': '棕榈油', '61': '聚氯乙烯', '65': '焦炭', '75': '焦煤', '79': '铁矿石', '80': '鸡蛋', '82': '中密度纤维板', '83': '细木工板', '84': '聚丙烯', '92': '玉米淀粉', '104': '乙二醇'},
    '上海国际能源交易中心': {'102': '原油'}}
    'LME': {'18': 'LME铜', '19': 'LME铝', '25': 'LME镍', '26': 'LME铅', '27': 'LME锌', '45': 'LME锡', '50': 'LME铝合金'},
    'NYMEX': {'20': 'COMEX铜', '31': 'COMEX金', '32': 'COMEX银'},
    'CBOT': {'22': 'CBOT大豆', '46': 'CBOT小麦', '47': 'CBOT玉米', '48': 'CBOT燕麦', '49': 'CBOT糙米'},
    'NYBOT': {'30': 'NYBOT2号棉'}, 'TOCOM': {'44': 'TOCOM橡胶'}

    :param exchange: int 交易所, 请对照 __doc__ 中的代码输入
    :param symbol: int 品种, 请对照 __doc__ 中的代码输入对应交易所的品种
    # :param dir_path: str 存放图片的目录
    :param plot: Bool 画出历史库存曲线图
    :return: pandas.DataFrame and picture
    """
    while True:
        try:
            data_code = get_pk_data("exchange_symbol_value_list.pk")
            data_name = get_pk_data("exchange_symbol_list.pk")
            out_exchange_name = get_pk_data("code_exchange_name_dict.pk")
            name_temp_dict = {}
            code_temp_dict = {}
            for num in data_code.keys():
                name_temp_dict[out_exchange_name[num]] = dict(zip(data_code[num], data_name[num]))
                code_temp_dict[num] = dict(zip(data_code[num], data_name[num]))
            # print(name_temp_dict)
            # print(out_exchange_name)
            url = "http://service.99qh.com/Storage/Storage.aspx?page=99qh"
            # print(exchange)
            res = requests.get(url, headers=sample_headers)
            soup = BeautifulSoup(res.text, "lxml")
            view_state = soup.find_all(attrs={"id": "__VIEWSTATE"})[0]["value"]
            even_validation = soup.find_all(attrs={"id": "__EVENTVALIDATION"})[0]["value"]
            # print(symbol)