Ejemplo n.º 1
0
    )
    return pd.DataFrame(res.json())


def jyfm_data_sugar(indicator="白糖产区库存", headers=""):
    res = requests.get(
        jyfm_data_sugar_name_url_dict[indicator],
        headers=headers,
    )
    return pd.DataFrame(res.json())


def jyfm_data_usa_bean(indicator="白糖产区库存", headers=""):
    res = requests.get(
        jyfm_data_usa_bean_name_url_dict[indicator],
        headers=headers,
    )
    return pd.DataFrame(res.json())


if __name__ == "__main__":
    headers = jyfm_login(account="", password="")
    df = jyfm_data_palm(indicator="马棕月度出口", headers=headers)
    print(df)
    df = jyfm_data_soybean_meal(indicator="大豆月度进口", headers=headers)
    print(df)
    df = jyfm_data_sugar(indicator="白糖产区库存", headers=headers)
    print(df)
    df = jyfm_data_usa_bean(indicator="美豆优良率", headers=headers)
    print(df)
Ejemplo n.º 2
0
    交易法门-工具-交易规则-品种手册
    :param headers: headers with cookies
    :type headers: dict
    :return: all history data
    :rtype: pandas.DataFrame
    """
    res = requests.get(
        "https://www.jiaoyifamen.com/tools/receipt-expire-info/variety",
        headers=headers)
    temp_df = pd.DataFrame(res.json()["data"])
    return temp_df


if __name__ == "__main__":
    # 如果要测试函数, 请先在交易法门网站: https://www.jiaoyifamen.com/ 注册帐号密码, 在下面输入对应的帐号和密码后再运行 jyfm_login 函数!
    headers = jyfm_login(account="link", password="******")

    # 交易法门-工具-套利分析
    jyfm_tools_futures_spread_df = jyfm_tools_futures_spread(type_1="RB",
                                                             type_2="RB",
                                                             code_1="01",
                                                             code_2="05",
                                                             headers=headers,
                                                             plot=True)
    print(jyfm_tools_futures_spread_df)
    jyfm_tools_futures_ratio_df = jyfm_tools_futures_ratio(type_1="RB",
                                                           type_2="RB",
                                                           code_1="01",
                                                           code_2="05",
                                                           headers=headers,
                                                           plot=True)