Example #1
0
def get_contract_data_jisilu(contract_id):
    url = 'https://www.jisilu.cn/data/index_future/if_hist_list/' + contract_id
    json_data = get_data_from_jisilu(url)
    contract_ids = []
    rows = json_data['rows']
    for row in rows:
        contract_ids.append(util.json_object_to_convert(row['id']))
    return contract_ids
Example #2
0
def parse_jisilu_data(data):
    price_dt = []
    a_price = []
    a_price_increase_rt = []        # A涨幅
    a_profit_rt = []                # A收益率
    a_amount = []                   # A份额(万份)
    a_amount_increase = []          # A新增份额(万份)
    a_amount_increase_rt = []       # A份额增长率
    a_discount_rt = []              # A折价率
    b_discount_rt = []              # B溢价率
    b_net_leverage_rt = []          # b基净值杠杆率
    b_price_leverage_rt = []        # b基价格杠杆率
    base_discount_rt = []           # 合并溢价
    net_value = []                  # 母基净值
    base_est_val = []               # 母基估值
    est_err = []                    # 母基估值误差
    rows = data['rows']
    for row in rows:
        row_data = row['cell']
        price_dt.append(util.json_object_to_convert(row_data['price_dt']))
        a_price.append(util.json_object_to_convert(row_data['a_price']))
        a_price_increase_rt.append(util.json_object_to_convert(row_data['a_price_increase_rt']))
        a_profit_rt.append(util.json_object_to_convert(row_data['a_profit_rt']))
        a_amount.append(util.json_object_to_convert(row_data['a_amount']))
        a_amount_increase.append(util.json_object_to_convert(row_data['a_amount_increase']))
        a_amount_increase_rt.append(util.json_object_to_convert(row_data['a_amount_increase_rt']))
        a_discount_rt.append(util.json_object_to_convert(row_data['a_discount_rt']))
        b_discount_rt.append(util.json_object_to_convert(row_data['b_discount_rt']))
        b_net_leverage_rt.append(util.json_object_to_convert(row_data['b_net_leverage_rt']))
        b_price_leverage_rt.append(util.json_object_to_convert(row_data['b_price_leverage_rt']))
        base_discount_rt.append(util.json_object_to_convert(row_data['base_discount_rt']))
        net_value.append(util.json_object_to_convert(row_data['net_value']))
        base_est_val.append(util.json_object_to_convert(row_data['base_est_val']))
        est_err.append(util.json_object_to_convert(row_data['est_err']))

    d = {
        'price_dt': price_dt,
        'a_price': a_price,
        'a_price_increase_rt': a_price_increase_rt,
        'a_profit_rt': a_profit_rt,
        'a_amount': a_amount,
        'a_amount_increase': a_amount_increase,
        'a_amount_increase_rt': a_amount_increase_rt,
        'a_discount_rt': a_discount_rt,
        'b_discount_rt': b_discount_rt,
        'b_net_leverage_rt': b_net_leverage_rt,
        'b_price_leverage_rt': b_price_leverage_rt,
        'base_discount_rt': base_discount_rt,
        'net_value': net_value,
        'base_est_val': base_est_val,
        'est_err': est_err
    }
    df = pd.DataFrame(d)
    df = df.set_index('price_dt')
    return df
Example #3
0
def parse_data(data):
    fundb_base_fund_id = []
    funda_id = []
    funda_name = []
    fundb_id = []
    fundb_name = []
    maturity_dt = []
    coupon_descr_s = []  # 利率规则
    fundb_nav_dt = []
    fundb_discount_rt = []  # 溢价率
    fundb_price_leverage_rt = []  # 杠杆率
    fundb_capital_rasising_rt = []  # 融资成本
    fundb_lower_recalc_rt = []  # 下折母基跌幅
    fundb_upper_recalc_rt = []  # 上折母基涨幅
    fundb_base_est_dis_rt = []  # 整体溢价率
    abrate = []  # a/b 份额比
    fundb_base_price = []  # 母基净值
    funda_current_price = []  # a基现价
    fundb_current_price = []  # b基现价
    fundb_value = []  # b基净值
    rows = data['rows']
    for row in rows:
        row_data = row['cell']
        fundb_base_fund_id.append(
            util.json_object_to_convert(row_data['fundb_base_fund_id']))
        funda_id.append(util.json_object_to_convert(row_data['funda_id']))
        funda_name.append(util.json_object_to_convert(row_data['funda_name']))
        fundb_id.append(util.json_object_to_convert(row_data['fundb_id']))
        fundb_name.append(util.json_object_to_convert(row_data['fundb_name']))
        maturity_dt.append(util.json_object_to_convert(
            row_data['maturity_dt']))
        coupon_descr_s.append(
            util.json_object_to_convert(row_data['coupon_descr_s']))
        fundb_nav_dt.append(
            util.json_object_to_convert(row_data['fundb_nav_dt']))
        fundb_discount_rt.append(
            util.json_object_to_convert(row_data['fundb_discount_rt']))
        fundb_price_leverage_rt.append(
            util.json_object_to_convert(row_data['fundb_price_leverage_rt']))
        fundb_capital_rasising_rt.append(
            util.json_object_to_convert(row_data['fundb_capital_rasising_rt']))
        fundb_lower_recalc_rt.append(
            util.json_object_to_convert(row_data['fundb_lower_recalc_rt']))
        fundb_base_est_dis_rt.append(
            util.json_object_to_convert(row_data['fundb_base_est_dis_rt']))
        abrate.append(util.json_object_to_convert(row_data['abrate']))
        fundb_base_price.append(
            util.json_object_to_convert(row_data['fundb_base_price']))
        fundb_upper_recalc_rt.append(
            util.json_object_to_convert(row_data['fundb_upper_recalc_rt']))
        funda_current_price.append(
            util.json_object_to_convert(row_data['funda_current_price']))
        fundb_current_price.append(
            util.json_object_to_convert(row_data['fundb_current_price']))
        fundb_value.append(util.json_object_to_convert(
            row_data['fundb_value']))

    d = {
        'fundb_base_fund_id': fundb_base_fund_id,
        'funda_id': funda_id,
        'fundb_id': fundb_id,
        'funda_name': funda_name,
        'fundb_name': fundb_name,
        'maturity_dt': maturity_dt,
        'coupon_descr_s': coupon_descr_s,
        'fundb_nav_dt': fundb_nav_dt,
        'fundb_discount_rt': fundb_discount_rt,
        'fundb_price_leverage_rt': fundb_price_leverage_rt,
        'fundb_capital_rasising_rt': fundb_capital_rasising_rt,
        'fundb_lower_recalc_rt': fundb_lower_recalc_rt,
        'fundb_base_est_dis_rt': fundb_base_est_dis_rt,
        'abrate': abrate,
        'fundb_upper_recalc_rt': fundb_upper_recalc_rt,
        'funda_current_price': funda_current_price,
        'fundb_current_price': fundb_current_price,
        'fundb_value': fundb_value,
        'fundb_base_price': fundb_base_price
    }
    df = pd.DataFrame(d)
    df = df.set_index('fundb_base_fund_id')
    return df
Example #4
0
def parse_jisilu_data(data):
    price_dt = []
    a_price = []
    a_price_increase_rt = []  # A涨幅
    a_profit_rt = []  # A收益率
    a_amount = []  # A份额(万份)
    a_amount_increase = []  # A新增份额(万份)
    a_amount_increase_rt = []  # A份额增长率
    a_discount_rt = []  # A折价率
    b_discount_rt = []  # B溢价率
    b_net_leverage_rt = []  # b基净值杠杆率
    b_price_leverage_rt = []  # b基价格杠杆率
    base_discount_rt = []  # 合并溢价
    net_value = []  # 母基净值
    base_est_val = []  # 母基估值
    est_err = []  # 母基估值误差
    rows = data['rows']
    for row in rows:
        row_data = row['cell']
        price_dt.append(util.json_object_to_convert(row_data['price_dt']))
        a_price.append(util.json_object_to_convert(row_data['a_price']))
        a_price_increase_rt.append(
            util.json_object_to_convert(row_data['a_price_increase_rt']))
        a_profit_rt.append(util.json_object_to_convert(
            row_data['a_profit_rt']))
        a_amount.append(util.json_object_to_convert(row_data['a_amount']))
        a_amount_increase.append(
            util.json_object_to_convert(row_data['a_amount_increase']))
        a_amount_increase_rt.append(
            util.json_object_to_convert(row_data['a_amount_increase_rt']))
        a_discount_rt.append(
            util.json_object_to_convert(row_data['a_discount_rt']))
        b_discount_rt.append(
            util.json_object_to_convert(row_data['b_discount_rt']))
        b_net_leverage_rt.append(
            util.json_object_to_convert(row_data['b_net_leverage_rt']))
        b_price_leverage_rt.append(
            util.json_object_to_convert(row_data['b_price_leverage_rt']))
        base_discount_rt.append(
            util.json_object_to_convert(row_data['base_discount_rt']))
        net_value.append(util.json_object_to_convert(row_data['net_value']))
        base_est_val.append(
            util.json_object_to_convert(row_data['base_est_val']))
        est_err.append(util.json_object_to_convert(row_data['est_err']))

    d = {
        'price_dt': price_dt,
        'a_price': a_price,
        'a_price_increase_rt': a_price_increase_rt,
        'a_profit_rt': a_profit_rt,
        'a_amount': a_amount,
        'a_amount_increase': a_amount_increase,
        'a_amount_increase_rt': a_amount_increase_rt,
        'a_discount_rt': a_discount_rt,
        'b_discount_rt': b_discount_rt,
        'b_net_leverage_rt': b_net_leverage_rt,
        'b_price_leverage_rt': b_price_leverage_rt,
        'base_discount_rt': base_discount_rt,
        'net_value': net_value,
        'base_est_val': base_est_val,
        'est_err': est_err
    }
    df = pd.DataFrame(d)
    df = df.set_index('price_dt')
    return df
def parse_data(data):
    fundb_base_fund_id = []
    funda_id = []
    funda_name = []
    fundb_id = []
    fundb_name = []
    maturity_dt = []
    coupon_descr_s = []             # 利率规则
    fundb_nav_dt = []
    fundb_discount_rt = []          # 溢价率
    fundb_price_leverage_rt = []    # 杠杆率
    fundb_capital_rasising_rt = []  # 融资成本
    fundb_lower_recalc_rt = []      # 下折母基跌幅
    fundb_upper_recalc_rt = []      # 上折母基涨幅
    fundb_base_est_dis_rt = []      # 整体溢价率
    abrate = []                     # a/b 份额比
    fundb_base_price = []           # 母基净值
    funda_current_price = []        # a基现价
    fundb_current_price = []        # b基现价
    fundb_value = []                # b基净值
    rows = data['rows']
    for row in rows:
        row_data = row['cell']
        fundb_base_fund_id.append(util.json_object_to_convert(row_data['fundb_base_fund_id']))
        funda_id.append(util.json_object_to_convert(row_data['funda_id']))
        funda_name.append(util.json_object_to_convert(row_data['funda_name']))
        fundb_id.append(util.json_object_to_convert(row_data['fundb_id']))
        fundb_name.append(util.json_object_to_convert(row_data['fundb_name']))
        maturity_dt.append(util.json_object_to_convert(row_data['maturity_dt']))
        coupon_descr_s.append(util.json_object_to_convert(row_data['coupon_descr_s']))
        fundb_nav_dt.append(util.json_object_to_convert(row_data['fundb_nav_dt']))
        fundb_discount_rt.append(util.json_object_to_convert(row_data['fundb_discount_rt']))
        fundb_price_leverage_rt.append(util.json_object_to_convert(row_data['fundb_price_leverage_rt']))
        fundb_capital_rasising_rt.append(util.json_object_to_convert(row_data['fundb_capital_rasising_rt']))
        fundb_lower_recalc_rt.append(util.json_object_to_convert(row_data['fundb_lower_recalc_rt']))
        fundb_base_est_dis_rt.append(util.json_object_to_convert(row_data['fundb_base_est_dis_rt']))
        abrate.append(util.json_object_to_convert(row_data['abrate']))
        fundb_base_price.append(util.json_object_to_convert(row_data['fundb_base_price']))
        fundb_upper_recalc_rt.append(util.json_object_to_convert(row_data['fundb_upper_recalc_rt']))
        funda_current_price.append(util.json_object_to_convert(row_data['funda_current_price']))
        fundb_current_price.append(util.json_object_to_convert(row_data['fundb_current_price']))
        fundb_value.append(util.json_object_to_convert(row_data['fundb_value']))

    d = {
        'fundb_base_fund_id': fundb_base_fund_id,
        'funda_id': funda_id,
        'fundb_id': fundb_id,
        'funda_name': funda_name,
        'fundb_name': fundb_name,
        'maturity_dt': maturity_dt,
        'coupon_descr_s': coupon_descr_s,
        'fundb_nav_dt': fundb_nav_dt,
        'fundb_discount_rt': fundb_discount_rt,
        'fundb_price_leverage_rt': fundb_price_leverage_rt,
        'fundb_capital_rasising_rt': fundb_capital_rasising_rt,
        'fundb_lower_recalc_rt': fundb_lower_recalc_rt,
        'fundb_base_est_dis_rt': fundb_base_est_dis_rt,
        'abrate': abrate,
        'fundb_upper_recalc_rt': fundb_upper_recalc_rt,
        'funda_current_price': funda_current_price,
        'fundb_current_price': fundb_current_price,
        'fundb_value': fundb_value,
        'fundb_base_price': fundb_base_price}
    df = pd.DataFrame(d)
    df = df.set_index('fundb_base_fund_id')
    return df