{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "No datapaths provided for .csv, will use defaults  (may break in production, should be fine in sim)\n",
      "No datapaths provided for .csv, will use defaults  (may break in production, should be fine in sim)\n",
      "No datapaths provided for .csv, will use defaults  (may break in production, should be fine in sim)\n",
      "No datapaths provided for .csv, will use defaults  (may break in production, should be fine in sim)\n",
      "No datapaths provided for .csv, will use defaults  (may break in production, should be fine in sim)\n",
      "No datapaths provided for .csv, will use defaults  (may break in production, should be fine in sim)\n",
      "No datapaths provided for .csv, will use defaults  (may break in production, should be fine in sim)\n",
      "No datapaths provided for .csv, will use defaults  (may break in production, should be fine in sim)\n",
      "{'rule0': TradingRule; function: <function ewmac_forecast_with_defaults at 0x137a10488>, data:  and other_args: }\n",
      "{'ewmac': TradingRule; function: <function ewmac_forecast_with_defaults at 0x137a10488>, data:  and other_args: }\n",
      "Adding config defaults\n",
      "System base_system with .config, .data, and .stages: rules\n",
      "Calculating raw forecast EDOLLAR for ewmac\n",
      "index\n",
      "2020-11-17    1.869360\n",
      "2020-11-18    1.848157\n",
      "2020-11-19    1.844952\n",
      "2020-11-20    1.867194\n",
      "2020-11-23    1.843271\n",
      "Freq: B, dtype: float64\n",
      "TradingRule; function: <function ewmac_forecast_with_defaults at 0x137a10488>, data:  and other_args: Lfast, Lslow\n",
      "Adding config defaults\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Adding config defaults\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Adding config defaults\n",
      "Getting forecast scalar for ewmac32 over EDOLLAR\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "index\n",
      "2020-11-17    2.637545\n",
      "2020-11-18    2.637686\n",
      "2020-11-19    2.637827\n",
      "2020-11-20    2.637966\n",
      "2020-11-23    2.638108\n",
      "Freq: B, Name: EDOLLAR, dtype: float64\n",
      "Adding config defaults\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "index\n",
      "2020-11-17    4.953805\n",
      "2020-11-18    4.897615\n",
      "2020-11-19    4.889123\n",
      "2020-11-20    4.948063\n",
      "2020-11-23    4.884669\n",
      "Freq: B, dtype: float64\n",
      "Adding config defaults\n",
      "Calculating forecast weights for EDOLLAR\n",
      "WARNING: No forecast weights  - using equal weights of 0.5000 over all 2 trading rules in system\n",
      "WARNING: No forecast weights  - using equal weights of 0.5000 over all 2 trading rules in system\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "            ewmac32  ewmac8\n",
      "index                      \n",
      "2020-11-17      0.5     0.5\n",
      "2020-11-18      0.5     0.5\n",
      "2020-11-19      0.5     0.5\n",
      "2020-11-20      0.5     0.5\n",
      "2020-11-23      0.5     0.5\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "index\n",
      "2020-11-17    1.0\n",
      "2020-11-18    1.0\n",
      "2020-11-19    1.0\n",
      "2020-11-20    1.0\n",
      "2020-11-23    1.0\n",
      "Freq: B, dtype: float64\n",
      "Adding config defaults\n",
      "Calculating forecast weights for US10\n",
      "Calculating raw forecast weights for US10\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Only this set of rules ['ewmac32', 'ewmac8'] is cheap enough to trade for US10\n",
      "Only this set of rules ['ewmac32', 'ewmac8'] is cheap enough to trade for CORN\n",
      "Only this set of rules ['ewmac32', 'ewmac8'] is cheap enough to trade for EDOLLAR\n",
      "Only this set of rules ['ewmac32', 'ewmac8'] is cheap enough to trade for SP500\n",
      "Calculating pandl for instrument rules for CORN\n",
      "Calculating pandl for instrument forecast for CORN ewmac32\n",
      "Calculating pandl for instrument forecast for CORN ewmac8\n",
      "Calculating pandl for instrument rules for EDOLLAR\n",
      "Calculating pandl for instrument forecast for EDOLLAR ewmac32\n",
      "Calculating pandl for instrument forecast for EDOLLAR ewmac8\n",
      "Calculating pandl for instrument rules for SP500\n",
      "Calculating pandl for instrument forecast for SP500 ewmac32\n",
      "Calculating pandl for instrument forecast for SP500 ewmac8\n",
      "Calculating pandl for instrument rules for US10\n",
      "Calculating pandl for instrument forecast for US10 ewmac32\n",
      "Calculating pandl for instrument forecast for US10 ewmac8\n",
      "Using cost multiplier on optimisation of 2.00\n",
      " [================================================================================] 100.0% Optimising\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\n",
      "             ewmac32    ewmac8\n",
      "index                         \n",
      "2020-11-17  0.494052  0.505948\n",
      "2020-11-18  0.493606  0.506394\n",
      "2020-11-19  0.493167  0.506833\n",
      "2020-11-20  0.492735  0.507265\n",
      "2020-11-23  0.492309  0.507691\n",
      "Calculating forecast div multiplier for US10\n",
      "Calculating forecast correlations over CORN, EDOLLAR, SP500, US10\n",
      " [================================================================================] 100.0% Estimating correlations\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\n",
      "index\n",
      "2020-11-17    1.112629\n",
      "2020-11-18    1.112849\n",
      "2020-11-19    1.113066\n",
      "2020-11-20    1.113279\n",
      "2020-11-23    1.113489\n",
      "Freq: B, dtype: float64\n",
      "Adding config defaults\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "No mapping applied for EDOLLAR\n",
      "Adding config defaults\n",
      "index\n",
      "2020-11-17    0.025584\n",
      "2020-11-18    0.025099\n",
      "2020-11-19    0.024879\n",
      "2020-11-20    0.024204\n",
      "2020-11-23    0.023774\n",
      "Freq: B, dtype: float64\n",
      "index\n",
      "2020-11-17    2489.000\n",
      "2020-11-18    2488.625\n",
      "2020-11-19    2489.125\n",
      "2020-11-20    2489.000\n",
      "2020-11-23    2488.625\n",
      "Freq: B, Name: price, dtype: float64\n",
      "(index\n",
      "1984-01-12    73.055\n",
      "1984-01-13    73.245\n",
      "1984-01-16    73.205\n",
      "1984-01-17    73.205\n",
      "1984-01-18    73.205\n",
      "               ...  \n",
      "2020-11-17    99.560\n",
      "2020-11-18    99.545\n",
      "2020-11-19    99.565\n",
      "2020-11-20    99.560\n",
      "2020-11-23    99.545\n",
      "Freq: B, Name: price, Length: 9618, dtype: float64, 2500)\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Getting vol target\n",
      "index\n",
      "2020-11-17    49.652009\n",
      "2020-11-18    48.702644\n",
      "2020-11-19    48.286940\n",
      "2020-11-20    46.974104\n",
      "2020-11-23    46.132741\n",
      "Freq: B, dtype: float64\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "index\n",
      "2020-11-17    157.345093\n",
      "2020-11-18    160.412236\n",
      "2020-11-19    161.793229\n",
      "2020-11-20    166.315041\n",
      "2020-11-23    169.348274\n",
      "Freq: B, dtype: float64\n",
      "{'base_currency': 'GBP', 'percentage_vol_target': 25.0, 'notional_trading_capital': 500000.0, 'annual_cash_vol_target': 125000.0, 'daily_cash_vol_target': 7812.5}\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "No mapping applied for EDOLLAR\n",
      "index\n",
      "2020-11-17     2.400740\n",
      "2020-11-18     5.841639\n",
      "2020-11-19    15.642073\n",
      "2020-11-20    22.426300\n",
      "2020-11-23    22.092940\n",
      "Freq: B, dtype: float64\n",
      "Adding config defaults\n",
      "Calculating instrument weights\n",
      "Calculating raw instrument weights\n",
      "Getting vol target\n",
      "Calculating pandl for subsystem for instrument CORN\n",
      "Calculating subsystem position for CORN\n",
      "Calculating volatility scalar for CORN\n",
      "Calculating instrument value vol for CORN\n",
      "Calculating instrument currency vol for CORN\n",
      "Calculating combined forecast for CORN\n",
      "Calculating forecast weights for CORN\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Calculating diversification multiplier for CORN\n",
      "No mapping applied for CORN\n",
      "Calculating pandl for subsystem for instrument EDOLLAR\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "No mapping applied for EDOLLAR\n",
      "Calculating pandl for subsystem for instrument SP500\n",
      "Calculating subsystem position for SP500\n",
      "Calculating volatility scalar for SP500\n",
      "Calculating instrument value vol for SP500\n",
      "Calculating instrument currency vol for SP500\n",
      "Calculating combined forecast for SP500\n",
      "Calculating forecast weights for SP500\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Calculating diversification multiplier for SP500\n",
      "No mapping applied for SP500\n",
      "Calculating pandl for subsystem for instrument US10\n",
      "Calculating subsystem position for US10\n",
      "Calculating volatility scalar for US10\n",
      "Calculating instrument value vol for US10\n",
      "Calculating instrument currency vol for US10\n",
      "Calculating combined forecast for US10\n",
      "Calculating forecast weights for US10\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Calculating diversification multiplier for US10\n",
      "No mapping applied for US10\n",
      "Cost multiplier of 0.0 will be ignored as equalising SR in optimisation (equalise_SR=True)\n",
      "Cost multiplier of 0.0 will be ignored as equalising SR in optimisation (equalise_SR=True)\n",
      "Zero cost multiplier and not applying cost weightings - so costs won't be used at all\n",
      "Zero cost multiplier and not applying cost weightings - so costs won't be used at all\n",
      "Cost multiplier of  0 is less than one and not applying cost weightings - effect of costs may be underestimated\n",
      "Cost multiplier of  0 is less than one and not applying cost weightings - effect of costs may be underestimated\n",
      "Using cost multiplier on optimisation of 0.00\n",
      " [================================================================================] 100.0% Optimising\n",
      "                CORN   EDOLLAR     SP500      US10\n",
      "index                                             \n",
      "2020-11-17  0.272632  0.216548  0.294738  0.216083\n",
      "2020-11-18  0.272632  0.216548  0.294738  0.216083\n",
      "2020-11-19  0.272632  0.216548  0.294738  0.216083\n",
      "2020-11-20  0.272632  0.216548  0.294738  0.216083\n",
      "2020-11-23  0.272632  0.216548  0.294738  0.216083\n",
      "Calculating instrument div. multiplier\n",
      "Calculating instrument correlations\n",
      " [================================================================================] 100.0% Estimating correlations\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\n",
      "index\n",
      "2020-11-17    1.659017\n",
      "2020-11-18    1.659059\n",
      "2020-11-19    1.659100\n",
      "2020-11-20    1.659140\n",
      "2020-11-23    1.659180\n",
      "Freq: B, dtype: float64\n",
      "Adding config defaults\n",
      "Calculating notional position for EDOLLAR\n",
      "Calculating diversification multiplier\n",
      "Calculating instrument weights\n",
      "Calculating raw instrument weights\n",
      "Calculating subsystem position for CORN\n",
      "Calculating volatility scalar for CORN\n",
      "Calculating instrument value vol for CORN\n",
      "Calculating instrument currency vol for CORN\n",
      "Getting vol target\n",
      "Calculating combined forecast for CORN\n",
      "Calculating forecast weights for CORN\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Calculating diversification multiplier for CORN\n",
      "No mapping applied for CORN\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "No mapping applied for EDOLLAR\n",
      "Calculating subsystem position for SP500\n",
      "Calculating volatility scalar for SP500\n",
      "Calculating instrument value vol for SP500\n",
      "Calculating instrument currency vol for SP500\n",
      "Calculating combined forecast for SP500\n",
      "Calculating forecast weights for SP500\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Calculating diversification multiplier for SP500\n",
      "No mapping applied for SP500\n",
      "Calculating subsystem position for US10\n",
      "Calculating volatility scalar for US10\n",
      "Calculating instrument value vol for US10\n",
      "Calculating instrument currency vol for US10\n",
      "Calculating combined forecast for US10\n",
      "Calculating forecast weights for US10\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Calculating diversification multiplier for US10\n",
      "No mapping applied for US10\n",
      "index\n",
      "2020-11-17     1.440444\n",
      "2020-11-18     3.504983\n",
      "2020-11-19     9.385244\n",
      "2020-11-20    13.455780\n",
      "2020-11-23    13.255764\n",
      "Freq: B, dtype: float64\n",
      "Adding config defaults\n",
      "Calculating pandl for portfolio\n",
      "Getting vol target\n",
      "Calculating pandl for instrument for CORN\n",
      "Calculating buffered positions\n",
      "Calculating notional position for CORN\n",
      "Calculating diversification multiplier\n",
      "Calculating instrument weights\n",
      "Calculating raw instrument weights\n",
      "Calculating subsystem position for CORN\n",
      "Calculating volatility scalar for CORN\n",
      "Calculating instrument value vol for CORN\n",
      "Calculating instrument currency vol for CORN\n",
      "Calculating combined forecast for CORN\n",
      "Calculating forecast weights for CORN\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Calculating diversification multiplier for CORN\n",
      "No mapping applied for CORN\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "No mapping applied for EDOLLAR\n",
      "Calculating subsystem position for SP500\n",
      "Calculating volatility scalar for SP500\n",
      "Calculating instrument value vol for SP500\n",
      "Calculating instrument currency vol for SP500\n",
      "Calculating combined forecast for SP500\n",
      "Calculating forecast weights for SP500\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Calculating diversification multiplier for SP500\n",
      "No mapping applied for SP500\n",
      "Calculating subsystem position for US10\n",
      "Calculating volatility scalar for US10\n",
      "Calculating instrument value vol for US10\n",
      "Calculating instrument currency vol for US10\n",
      "Calculating combined forecast for US10\n",
      "Calculating forecast weights for US10\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Calculating diversification multiplier for US10\n",
      "No mapping applied for US10\n",
      "Calculating buffers for CORN\n",
      "Calculating position method buffer for CORN\n",
      "Calculating pandl for instrument for EDOLLAR\n",
      "Calculating buffered positions\n",
      "Calculating notional position for EDOLLAR\n",
      "Calculating buffers for EDOLLAR\n",
      "Calculating position method buffer for EDOLLAR\n",
      "Calculating pandl for instrument for SP500\n",
      "Calculating buffered positions\n",
      "Calculating notional position for SP500\n",
      "Calculating buffers for SP500\n",
      "Calculating position method buffer for SP500\n",
      "Calculating pandl for instrument for US10\n",
      "Calculating buffered positions\n",
      "Calculating notional position for US10\n",
      "Calculating buffers for US10\n",
      "Calculating position method buffer for US10\n",
      "[[('min', '-12.54'), ('max', '14.86'), ('median', '0'), ('mean', '0.03676'), ('std', '1.335'), ('skew', '0.01767'), ('ann_mean', '9.41'), ('ann_std', '21.36'), ('sharpe', '0.4405'), ('sortino', '0.4574'), ('avg_drawdown', '-12.6'), ('time_in_drawdown', '0.5981'), ('calmar', '0.1725'), ('avg_return_to_drawdown', '0.7469'), ('avg_loss', '-1.087'), ('avg_gain', '1.15'), ('gaintolossratio', '1.059'), ('profitfactor', '1.112'), ('hitrate', '0.5123'), ('t_stat', '3.084'), ('p_value', '0.002046')], ('You can also plot / print:', ['rolling_ann_std', 'drawdown', 'curve', 'percent'])]\n",
      "[[('min', '-12.54'), ('max', '14.86'), ('median', '0'), ('mean', '0.03686'), ('std', '1.335'), ('skew', '0.01782'), ('ann_mean', '9.435'), ('ann_std', '21.36'), ('sharpe', '0.4417'), ('sortino', '0.4557'), ('avg_drawdown', '-12.57'), ('time_in_drawdown', '0.5971'), ('calmar', '0.1734'), ('avg_return_to_drawdown', '0.7504'), ('avg_loss', '-1.14'), ('avg_gain', '1.15'), ('gaintolossratio', '1.008'), ('profitfactor', '1.113'), ('hitrate', '0.5246'), ('t_stat', '3.092'), ('p_value', '0.00199')], ('You can also plot / print:', ['rolling_ann_std', 'drawdown', 'curve', 'percent'])]\n",
      "[[('min', '-12.54'), ('max', '14.86'), ('median', '0'), ('mean', '0.03676'), ('std', '1.335'), ('skew', '0.01767'), ('ann_mean', '9.41'), ('ann_std', '21.36'), ('sharpe', '0.4405'), ('sortino', '0.4574'), ('avg_drawdown', '-12.6'), ('time_in_drawdown', '0.5981'), ('calmar', '0.1725'), ('avg_return_to_drawdown', '0.7469'), ('avg_loss', '-1.087'), ('avg_gain', '1.15'), ('gaintolossratio', '1.059'), ('profitfactor', '1.112'), ('hitrate', '0.5123'), ('t_stat', '3.084'), ('p_value', '0.002046')], ('You can also plot / print:', ['rolling_ann_std', 'drawdown', 'curve', 'percent'])]\n",
      "Config with elements: base_currency, forecast_div_multiplier, forecast_scalars, forecast_weights, instrument_div_multiplier, instrument_weights, notional_trading_capital, percentage_vol_target, trading_rules\n",
      "Adding config defaults\n",
      "Calculating notional position for EDOLLAR\n",
      "Calculating diversification multiplier\n",
      "Calculating instrument weights\n",
      "Calculating raw instrument weights\n",
      "Calculating subsystem position for CORN\n",
      "Calculating volatility scalar for CORN\n",
      "Calculating instrument value vol for CORN\n",
      "Calculating instrument currency vol for CORN\n",
      "Getting vol target\n",
      "Calculating combined forecast for CORN\n",
      "Calculating forecast weights for CORN\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Calculating diversification multiplier for CORN\n",
      "No mapping applied for CORN\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "No mapping applied for EDOLLAR\n",
      "Calculating subsystem position for SP500\n",
      "Calculating volatility scalar for SP500\n",
      "Calculating instrument value vol for SP500\n",
      "Calculating instrument currency vol for SP500\n",
      "Calculating combined forecast for SP500\n",
      "Calculating forecast weights for SP500\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Calculating diversification multiplier for SP500\n",
      "No mapping applied for SP500\n",
      "Calculating subsystem position for US10\n",
      "Calculating volatility scalar for US10\n",
      "Calculating instrument value vol for US10\n",
      "Calculating instrument currency vol for US10\n",
      "Calculating combined forecast for US10\n",
      "Calculating forecast weights for US10\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Calculating diversification multiplier for US10\n",
      "No mapping applied for US10\n",
      "index\n",
      "2020-11-17     1.440444\n",
      "2020-11-18     3.504983\n",
      "2020-11-19     9.385244\n",
      "2020-11-20    13.455780\n",
      "2020-11-23    13.255764\n",
      "Freq: B, dtype: float64\n",
      "Config with elements: base_currency, forecast_div_multiplier, forecast_weights, instrument_div_multiplier, instrument_weights, notional_trading_capital, percentage_vol_target, trading_rules\n",
      "Adding config defaults\n",
      "Calculating raw forecast EDOLLAR for ewmac32\n",
      "index\n",
      "2020-11-17    1.869360\n",
      "2020-11-18    1.848157\n",
      "2020-11-19    1.844952\n",
      "2020-11-20    1.867194\n",
      "2020-11-23    1.843271\n",
      "Freq: B, dtype: float64\n",
      "Calculating raw forecast EDOLLAR for ewmac8\n",
      "index\n",
      "2020-11-17   -0.882338\n",
      "2020-11-18   -0.799151\n",
      "2020-11-19   -0.590814\n",
      "2020-11-20   -0.471016\n",
      "2020-11-23   -0.474093\n",
      "Freq: B, dtype: float64\n",
      "Calculating capped forecast for EDOLLAR ewmac32\n",
      "index\n",
      "2020-11-17    4.953805\n",
      "2020-11-18    4.897615\n",
      "2020-11-19    4.889123\n",
      "2020-11-20    4.948063\n",
      "2020-11-23    4.884669\n",
      "Freq: B, dtype: float64\n",
      "2.65\n",
      "Calculating combined forecast for EDOLLAR\n",
      "Calculating forecast weights for EDOLLAR\n",
      "Calculating capped forecast for EDOLLAR ewmac8\n",
      "Calculating diversification multiplier for EDOLLAR\n",
      "No mapping applied for EDOLLAR\n",
      "index\n",
      "2020-11-17    0.152578\n",
      "2020-11-18    0.364164\n",
      "2020-11-19    0.966794\n",
      "2020-11-20    1.348423\n",
      "2020-11-23    1.304586\n",
      "Freq: B, dtype: float64\n",
      "            ewmac32  ewmac8\n",
      "index                      \n",
      "2020-11-17      0.5     0.5\n",
      "2020-11-18      0.5     0.5\n",
      "2020-11-19      0.5     0.5\n",
      "2020-11-20      0.5     0.5\n",
      "2020-11-23      0.5     0.5\n",
      "Calculating subsystem position for EDOLLAR\n",
      "Calculating volatility scalar for EDOLLAR\n",
      "Calculating instrument value vol for EDOLLAR\n",
      "Calculating instrument currency vol for EDOLLAR\n",
      "Getting vol target\n",
      "index\n",
      "2020-11-17     2.400740\n",
      "2020-11-18     5.841639\n",
      "2020-11-19    15.642073\n",
      "2020-11-20    22.426300\n",
      "2020-11-23    22.092940\n",
      "Freq: B, dtype: float64\n",
      "Calculating notional position for EDOLLAR\n",
      "Calculating diversification multiplier\n",
      "Calculating instrument weights\n",
      "Calculating raw instrument weights\n",
      "Calculating subsystem position for CORN\n",
      "Calculating volatility scalar for CORN\n",
      "Calculating instrument value vol for CORN\n",
      "Calculating instrument currency vol for CORN\n",
      "Calculating combined forecast for CORN\n",
      "Calculating forecast weights for CORN\n",
      "Calculating capped forecast for CORN ewmac32\n",
      "Calculating raw forecast CORN for ewmac32\n",
      "Calculating capped forecast for CORN ewmac8\n",
      "Calculating raw forecast CORN for ewmac8\n",
      "Calculating diversification multiplier for CORN\n",
      "No mapping applied for CORN\n",
      "Calculating subsystem position for SP500\n",
      "Calculating volatility scalar for SP500\n",
      "Calculating instrument value vol for SP500\n",
      "Calculating instrument currency vol for SP500\n",
      "Calculating combined forecast for SP500\n",
      "Calculating forecast weights for SP500\n",
      "Calculating capped forecast for SP500 ewmac32\n",
      "Calculating raw forecast SP500 for ewmac32\n",
      "Calculating capped forecast for SP500 ewmac8\n",
      "Calculating raw forecast SP500 for ewmac8\n",
      "Calculating diversification multiplier for SP500\n",
      "No mapping applied for SP500\n",
      "Calculating subsystem position for US10\n",
      "Calculating volatility scalar for US10\n",
      "Calculating instrument value vol for US10\n",
      "Calculating instrument currency vol for US10\n",
      "Calculating combined forecast for US10\n",
      "Calculating forecast weights for US10\n",
      "Calculating capped forecast for US10 ewmac32\n",
      "Calculating raw forecast US10 for ewmac32\n",
      "Calculating capped forecast for US10 ewmac8\n",
      "Calculating raw forecast US10 for ewmac8\n",
      "Calculating diversification multiplier for US10\n",
      "No mapping applied for US10\n",
      "index\n",
      "2020-11-17     1.440444\n",
      "2020-11-18     3.504983\n",
      "2020-11-19     9.385244\n",
      "2020-11-20    13.455780\n",
      "2020-11-23    13.255764\n",
      "Freq: B, dtype: float64\n"
     ]
    },
    {
     "data": {
      "text/plain": "<Figure size 432x288 with 0 Axes>"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%run simplesystem.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": "<AxesSubplot:xlabel='index'>"
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": "<Figure size 432x288 with 1 Axes>",
      "image/png": "[encoded data, 18560 characters]\n"
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "my_account.portfolio().plot()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3.0
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}