Exemple #1
0
def gle_cppi():
    risky_asset = EquityYFinance("GLE.PA")
    maturity = Date(2025, 1, 5)
    zero_coupon = ZeroCouponFake(0.01, maturity, "long_rate_1")
    rule = CPPI_simple(risky_asset, zero_coupon, maturity, 25, 80.0)
    cash_asset = ZeroCouponFake(0.001, Date(2100, 1, 1), "cash_10_bp")
    start_date = Date(2021, 1, 4)
    portfolio = Portfolio(rule, cash_asset, 100.0, start_date)
    dates = risky_asset.h.index[risky_asset.h.index >= start_date]
    portfolio.compute(dates)
    portfolio.report().to_clipboard()
    print(portfolio.report().head())
Exemple #2
0
def example_rolling():
    start_date = Date(2019, 1, 3)
    oc = generate_cube(start_date, 0.88, 0.92)
    udl = oc.iloc[0].iloc[1].iloc[0].udl
    udls = udl.series
    dates = udls.index[udls.index.get_loc(Date(2019, 1, 3))::]
    cash_asset = OneUsd()
    rule = RollingPut(udl, oc)
    portfolio = Portfolio(rule, cash_asset, 100.0, start_date)
    portfolio.compute(dates)
    portfolio.report().to_clipboard()
    print(portfolio.report().head())