I would like to run a simple backtest. Any advice on Alg structure?
10 securities
Lookback 3 months
find and select the top 4 performers
Rebalance every month (once a month)
Thanks all!
I would like to run a simple backtest. Any advice on Alg structure?
10 securities
Lookback 3 months
find and select the top 4 performers
Rebalance every month (once a month)
Thanks all!
Logging the top 4 profit-n-loss each day here. You could schedule looping through c.pnl_top.index to do something with them.
Clear c.pnls each time to avoid those from the past (now closed):
c.pnls = pd.Series({})
I added a header line here
Sym PnL Position
2016-10-10 05:45 before_trading_start:123 INFO AMAT 26886 shrs 4971
2016-10-10 05:45 before_trading_start:123 INFO FEYE 26008 shrs -10424
2016-10-10 05:45 before_trading_start:123 INFO ATW 20421 shrs 0
2016-10-10 05:45 before_trading_start:123 INFO BAC 16400 shrs 0
2016-10-11 05:45 before_trading_start:120 INFO .
2016-10-11 05:45 before_trading_start:123 INFO FEYE 25278 shrs -10424
2016-10-11 05:45 before_trading_start:123 INFO AMAT 25047 shrs 4971
2016-10-11 05:45 before_trading_start:123 INFO ATW 20421 shrs 0
2016-10-11 05:45 before_trading_start:123 INFO BAC 16400 shrs 0