In [1]:
import bt

import matplotlib.pyplot as plt
%matplotlib inline

data = bt.get('eurusd,eurjpy,usdjpy', start='1027890000', end='1317330000')

mom_s = bt.Strategy('mom_s', [bt.algos.RunMonthly(),
                              bt.algos.SelectAll(),
                              bt.algos.SelectMomentum(1),
                              bt.algos.WeighEqually(),
                              bt.algos.Rebalance()],
                    ['eurjpy', 'usdjpy'])

# create the master strategy - this is the top-most node in the tree
# Once again, we are also specifying  the children. In this case, one of the
# children is a Security and the other is a Strategy.
master = bt.Strategy('master', [bt.algos.RunMonthly(),
                                bt.algos.SelectAll(),
                                bt.algos.WeighEqually(),
                                bt.algos.Rebalance()],
                    [mom_s, 'eurusd'])

# create the backtest and run it
t = bt.Backtest(master, data)

#print 'First Calculation'
r = bt.run(t)

#print 'First Graph'
r.plot()

#print 'First Output Table'
print 
r.display()
master
0% [############################# ] 100% | ETA: 00:00:00
Stat                 master
-------------------  ----------
Start                2003-07-07
End                  2014-09-11
Risk-free rate       0.00%

Total Return         24.20%
Daily Sharpe         0.26
Daily Sortino        0.35
CAGR                 1.96%
Max Drawdown         -28.16%
Calmar Ratio         0.07

MTD                  0.61%
3m                   0.15%
6m                   -2.28%
YTD                  -3.73%
1Y                   2.31%
3Y (ann.)            4.51%
5Y (ann.)            1.13%
10Y (ann.)           1.36%
Since Incep. (ann.)  1.96%

Daily Sharpe         0.26
Daily Sortino        0.35
Daily Mean (ann.)    2.07%
Daily Vol (ann.)     7.91%
Daily Skew           -0.14
Daily Kurt           3.91
Best Day             3.56%
Worst Day            -2.73%

Monthly Sharpe       0.27
Monthly Sortino      0.33
Monthly Mean (ann.)  2.31%
Monthly Vol (ann.)   8.56%
Monthly Skew         -0.78
Monthly Kurt         1.97
Best Month           6.56%
Worst Month          -8.42%

Yearly Sharpe        0.19
Yearly Sortino       0.38
Yearly Mean          1.47%
Yearly Vol           7.82%
Yearly Skew          0.02
Yearly Kurt          -0.49
Best Year            15.14%
Worst Year           -11.56%

Avg. Drawdown        -1.37%
Avg. Drawdown Days   55.30
Avg. Up Month        1.68%
Avg. Down Month      -2.01%
Win Year %           54.55%
Win 12m %            67.74%
In [ ]: