margot.backtest¶
Module contents¶
-
class
margot.backtest.
BackTest
(algo, start_balance=100000)¶ Backtest an trading algo that’s a descendent of BaseAlgo.
Warning
BackTest is still a work in progress - it probably doesn’t even work yet!
-
algo
¶ A boolean indicating if we like SPAM or not.
-
starting_balance
¶ An integer count of the eggs we have laid.
-
calc_daily_returns
(day)¶ Calculate the returns based on yesterdays positions, MoC to MoC.
- Parameters
day (date) – the date for which we calculate returns.
Daily returns are the difference between yesterdays adjusted_close and todays adjusted_close.
-
create_position_timeseries
()¶ Create Position time-series from signals.
Runs through all of the backtest data by default.
Calculates the returns from taking the previous row’s positions.
- Returns
time-series of Positions
- Return type
pd.DataFrame
-
run
()¶ Run the backtest.
- Returns
[description]
- Return type
[type]
-