Back to Community
Combining Strategic and Tactical Asset Allocation

Brandon VanLandingham requested help to create a core satellite strategy which is a combination of static portfolio and tactical portfolio with a different set of assets that trade on a moving average crossover.

Here is a simple version to play with.

Quantopian, for more then a month I unable to attach backtest to any post reply, please respond.

Clone Algorithm
41
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 59093ec3f6ef49664535c7cd
There was a runtime error.
2 responses

Slightly modified version:

# Core-satellite strategy v2  
# ---------------------------------------------------------------------------------  
core_etf, proportion = symbols('QQQ', 'XLP', 'TLT', 'IEF'), [0.25, 0.25, 0.25, 0.25]  
tact_etf, ma_s, ma_f = symbols('XLV', 'XLY', 'TLO', 'GLD'), 200, 20  
lev, wt_core = 1.0, 0.25  
# ---------------------------------------------------------------------------------  
def initialize(context):  
     schedule_function(trade, date_rules.week_start(2), time_rules.market_open(minutes=65)) 

def trade(context,data):  
    if get_open_orders(): return 

    for i in range(len(core_etf)):  
        if data.can_trade(core_etf[i]):  
            order_target_percent(core_etf[i], lev*wt_core*proportion[i])

    ma_fast = data.history(tact_etf, 'price', ma_f, '1d').mean()  
    ma_slow = data.history(tact_etf, 'price', ma_s, '1d').mean()  
    ratio   = ma_fast/ma_slow  
    pos_mom = ratio[ratio >= 1.0]  
    wt      = lev*(1.0 - wt_core) / len(pos_mom) if len(pos_mom) !=0 else 0

    for etf in tact_etf:  
        if data.can_trade(etf):  
            if etf in pos_mom.index:  
                order_target_percent(etf, wt)  
            else:  
                order_target(etf, 0)  

def before_trading_start(context,data):  
    record(leverage = context.account.leverage)  

Total Returns
205.2%
Benchmark Returns
90.5%
Alpha
0.10
Beta
0.16
Sharpe
1.21
Sortino
1.77
Volatility
0.10
Max Drawdown
-13.6%

You should comment your code. But nice read anyway