treasuries_can.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:zipline-chinese 作者: zhanghan1990 项目源码 文件源码
def get_treasury_data(start_date, end_date):
    bill_data = load_frame(
        format_bill_url(start_date, end_date, start_date),
        # We skip fewer rows here because we query for fewer bill fields,
        # which makes the header smaller.
        skiprows=18,
    )

    bond_data = load_frame(
        format_bond_url(start_date, end_date, start_date),
        skiprows=22,
    )
    check_known_inconsistencies(bill_data, bond_data)

    # dropna('any') removes the rows for which we only had data for one of
    # bills/bonds.
    out = pd.concat([bond_data, bill_data], axis=1).dropna(how='any')
    assert set(out.columns) == set(six.itervalues(COLUMN_NAMES))

    # Multiply by 0.01 to convert from percentages to expected output format.
    return out * 0.01
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号