Ejemplo n.º 1
0
    def setUp(self):
        longonly_params = {keys.lo_ticker: ['SGX_NK', 'LIFFE_FTI']}
        portfolio_params = {keys.weighting: [0.1, 0.9]}

        # Simple Engine example
        engine = adagio.Engine()
        engine.add(adagio.LongOnly(**longonly_params))
        engine.add(adagio.Portfolio(**portfolio_params))
        engine.backtest()

        self.engine = engine
Ejemplo n.º 2
0
    def setUp(self):
        longonly_params = {
            keys.lo_ticker: ['SGX_NK', 'LIFFE_FTI'],
        }
        lo_vol_scale_params = {
            keys.vs_chg_rule: '+Wed-1bd+1bd',
            keys.vs_target_vol: 0.1,
            keys.vs_method_params: {
                keys.vs_method: keys.vs_rolling,
                keys.vs_window: 63,
            }
        }
        signal_params = {
            keys.signal_method_params: {
                keys.signal_method: keys.signal_trend_ma_xover,
                keys.signal_windows: [[8, 24], [16, 48], [32, 96]],
            },
            keys.signal_chg_rule: '+Wed-1bd+1bd',
            keys.signal_to_position: keys.linear,
            keys.position_cap: 1.0,
            keys.position_floor: -1.0
        }
        portfolio_params = {
            keys.weighting: keys.equal_weight,
            keys.port_weight_chg_rule: '+Wed-1bd+1bd',
        }
        portfolio_vol_scale_params = {
            keys.vs_chg_rule: '+Wed-1bd+1bd',
            keys.vs_target_vol: 0.1,
            keys.vs_method_params: {
                keys.vs_method: keys.vs_rolling,
                keys.vs_window: 63,
            }
        }

        # Nested Engine example
        engine1 = adagio.Engine()
        engine1.add(adagio.LongOnly(**longonly_params))
        engine1.add(adagio.VolatilityScaling(**lo_vol_scale_params))
        engine1.add(adagio.Signal(**signal_params))

        engine2 = adagio.Engine()
        engine2.add(adagio.LongOnly(**longonly_params))
        engine2.add(adagio.VolatilityScaling(**lo_vol_scale_params))
        engine2.add(adagio.Signal(**signal_params))

        engine3 = adagio.Engine()
        engine3.add([engine1, engine2])
        engine3.add(adagio.Portfolio(**portfolio_params))
        engine3.add(adagio.PortVolatilityScaling(**portfolio_vol_scale_params))
        engine3.backtest()

        self.engine = engine3
Ejemplo n.º 3
0
    def setUp(self):
        longonly_params = {keys.lo_ticker: ['SGX_NK', 'LIFFE_FTI']}
        portfolio_params = {
            keys.weighting: keys.equal_weight,
            keys.port_weight_chg_rule: '+Wed-1bd+1bd',
        }

        # Simple Engine example
        engine = adagio.Engine()
        engine.add(adagio.LongOnly(**longonly_params))
        engine.add(adagio.Portfolio(**portfolio_params))
        engine.backtest()

        self.engine = engine
Ejemplo n.º 4
0
    def setUp(self):
        longonly_params = {
            keys.lo_ticker: ['SGX_NK', 'LIFFE_FTI']
        }
        lo_vol_scale_params = {
            keys.vs_window: 63,
            keys.vs_chg_rule: '+Wed-1bd+1bd',
            keys.vs_target_vol: 0.1,
        }
        signal_params = {
            keys.signal_type: keys.momentum,
            keys.signal_windows: [[8, 24], [16, 48], [32, 96]],
            keys.signal_chg_rule: '+Wed-1bd+1bd',
            keys.signal_to_position: keys.linear,
            keys.position_cap: 1.0,
            keys.position_floor: -1.0
        }
        portfolio_params = {
            keys.weighting: keys.equal_weight
        }
        portfolio_vol_scale_params = {
            keys.vs_window: 63,
            keys.vs_chg_rule: '+Wed-1bd+1bd',
            keys.vs_target_vol: 0.1,
        }

        # Simple Engine example
        engine = adagio.Engine()
        engine.add(adagio.LongOnly(**longonly_params))
        engine.add(adagio.VolatilityScaling(**lo_vol_scale_params))
        engine.add(adagio.Signal(**signal_params))
        engine.add(adagio.Portfolio(**portfolio_params))
        engine.add(adagio.PortVolatilityScaling(**portfolio_vol_scale_params))
        engine.backtest()

        self.engine = engine
Ejemplo n.º 5
0
        keys.position_floor: -1.0
    }
    portfolio_params = {keys.weighting: keys.equal_weight}
    portfolio_vol_scale_params = {
        keys.vs_window: 63,
        keys.vs_chg_rule: '+Wed-1bd+1bd',
        keys.vs_target_vol: 0.1,
    }
    engine_params = {keys.name: 'engine', keys.backtest_ccy: 'USD'}

    # Simple Engine example
    engine = adagio.Engine(**engine_params)
    engine.add(adagio.LongOnly(**longonly_params))
    engine.add(adagio.VolatilityScaling(**lo_vol_scale_params))
    engine.add(adagio.Signal(**signal_params))
    engine.add(adagio.Portfolio(**portfolio_params))
    engine.add(adagio.PortVolatilityScaling(**portfolio_vol_scale_params))
    engine.backtest()

    # Nested Engine example
    engine1 = adagio.Engine(name='engine1')
    engine1.add(adagio.LongOnly(**longonly_params))
    engine1.add(adagio.VolatilityScaling(**lo_vol_scale_params))
    engine1.add(adagio.Signal(**signal_params))

    engine2 = adagio.Engine(name='engine2')
    engine2.add(adagio.LongOnly(**longonly_params))
    engine2.add(adagio.VolatilityScaling(**lo_vol_scale_params))
    engine2.add(adagio.Signal(**signal_params))

    engine3 = adagio.Engine(name='engine3')
Ejemplo n.º 6
0
        keys.slippage:
        2.0,
    }
    comdty_metal_lo_params = {
        keys.lo_ticker: ['CME_GC', 'CME_SI', 'CME_PL', 'CME_PA', 'CME_HG'],
        keys.slippage: 2.0,
    }

    # Equity Developed markets
    engine_equity_dm = adagio.Engine(name='Equity DM Trend-following')
    engine_equity_dm.add(adagio.LongOnly(**equity_dm_lo_params))
    engine_equity_dm.add(
        adagio.VolatilityScaling(name='vs_pre_signal', **lo_vol_scale_params))
    engine_equity_dm.add(adagio.Signal(**momentum_params))
    engine_equity_dm.add(
        adagio.Portfolio(name='equity_port', **portfolio_params))
    engine_equity_dm.add(
        adagio.PortVolatilityScaling(name='equity_port_vs',
                                     **port_vol_scale_params))

    # Equity Emerging markets
    engine_equity_em = adagio.Engine(name='Equity EM Trend-following')
    engine_equity_em.add(adagio.LongOnly(**equity_em_lo_params))
    engine_equity_em.add(
        adagio.VolatilityScaling(name='vs_pre_signal', **lo_vol_scale_params))
    engine_equity_em.add(adagio.Signal(**momentum_params))
    engine_equity_em.add(
        adagio.Portfolio(name='equity_port', **portfolio_params))
    engine_equity_em.add(
        adagio.PortVolatilityScaling(name='equity_port_vs',
                                     **port_vol_scale_params))