Reputation: 97
I have recently started using bt for backtesting, and after looking into the documentation, https://pmorissette.github.io/bt/bt.html, there does not seem to be a way to get the total portfolio value at each date, even though it can be easily plotted by calling the .plot()
method.
I may have overlooked on my part since I am pretty new to this. Great if someone can point me in the right direction.
Upvotes: 4
Views: 713
Reputation: 161
The library bt has various useful methods that you could use in your backtesting:
Then, assuming that res = bt.run(backtest)
You can do:
res.prices
will tell you in a percentage format how your portfolio value is changing
res.backtest_list[0].strategy.outlays
will tell you the outlays, which are the total dollar amount spent(gained) by a purchase(sale) of securities
res.backtest_list[0].positions
will tell you the number of shares purchased
res.get_security_weights()
will tell you the weight of your security in a percentage format
Upvotes: 1