コード例 #1
0
ファイル: tests.py プロジェクト: tombnorwood/valuesserver
def natgas_portfolio_creation(session, values_server):
    natgas_asset_class_settings = [
        {
            'asset_class_symbol': 'NG',
            'is_primary': True,
            'months_out_limit': 15,
            'is_multi_driver': True
        },
        {
            'asset_class_symbol': 'ON',
            'is_primary': False,
            'months_out_limit': 15,
            'is_multi_driver': True
        },
        {
            'asset_class_symbol': 'NPG',
            'is_primary': False,
            'months_out_limit': 15,
            'is_multi_driver': True
        },
        {
            'asset_class_symbol': 'LNE',
            'is_primary': False,
            'months_out_limit': 15,
            'is_multi_driver': True
        },
        {
            'asset_class_symbol': 'NN',
            'is_primary': False,
            'months_out_limit': 15,
            'is_multi_driver': True
        }
    ]

    natgas_portfolio = create_portfolio("Natgas")
    values_server.portfolios[natgas_portfolio.name] = natgas_portfolio

    trade_calendar = create_trade_calendar()
    trade_calendar.portfolios.append(natgas_portfolio)

    discount_curve = create_discount_curve()
    discount_curve.portfolio = natgas_portfolio
    natgas_portfolio.discount_curve = discount_curve

    decay_schedule = create_decay_schedule("Natgas Decay")

    for aci_settings in natgas_asset_class_settings:
        aci = create_asset_class_impl(session, **aci_settings)
        decay_schedule.asset_class_impls.append(aci)
        natgas_portfolio.asset_class_impls[aci.name] = aci
コード例 #2
0
ファイル: tests.py プロジェクト: tombnorwood/valuesserver
def silver_portfolio_creation(session, values_server):
    silver_asset_class_settings = [
        {
            'asset_class_symbol': 'SLV',
            'is_primary': True,
            'months_out_limit': 15,
            'is_multi_driver': False
        },
        {
            'asset_class_symbol': 'SO',
            'is_primary': False,
            'months_out_limit': 15,
            'is_multi_driver': False
        },
        {
            'asset_class_symbol': 'SI',
            'is_primary': True,
            'months_out_limit': 15,
            'is_multi_driver': False
        }
    ]

    silver_portfolio = create_portfolio("Silver")
    values_server.portfolios[silver_portfolio.name] = silver_portfolio

    trade_calendar = create_trade_calendar()
    trade_calendar.portfolios.append(silver_portfolio)

    discount_curve = create_discount_curve()
    discount_curve.portfolio = silver_portfolio
    silver_portfolio.discount_curve = discount_curve

    decay_schedule = create_decay_schedule("Silver Decay")

    for aci_settings in silver_asset_class_settings:
        aci = create_asset_class_impl(session, **aci_settings)
        decay_schedule.asset_class_impls.append(aci)
        silver_portfolio.asset_class_impls[aci.name] = aci