Open stucash opened 7 months ago
I'd very much appreciate if you or any of the team member could revert to this problem as the daily returns is definitely a crucial part which needs to be aligned for the backtest to be reliable.
I'm aiming to use vectorbt as the main backtesting engine, it is vital for me to understand enough.
Thanks very much.
Thanks for making available such a powerful tool to the open source community.
I've just started finding my way around of vectorbt and I noticed these four different return types and I am a bit baffled by the results they generated when I compared them with each other.
I am on vectorbt free, not vectorbt[full] free or vectorbt pro. I am using python 3.10 on Debian 11 variant.
Reading the docs, I understand that:
asset_returns
are just the returns solely generated by the asset's cash flow and the proportion of portfolio equity assigned to that particular asset.returns
are (daily as well?) returns as per column/group (a column can be just an asset, in my example below it is just one asset), based on portfolio value. I am not too sure how I shall interpret "portfolio value" here.daily_returns
, doesn't have much info but it is self-explanatory to a degree: we know it is for each day and it is showed as per column/group as well. I don't know whether it is based on portfolio value or not (it seems they do).My questions are:
Are
returns
anddaily_returns
the same? I noticed on 2020-02-25 the return value departed there for them, but other entries looked to be identical; when I set the optionuse_asset_returns
toTrue
, I noticed thatdaily_returns
is showing identical results toasset_returns
(with filter for no trade days andNaN
days). 1.1 I am inclined to believe that the value on 2020-02-25 shouldn't exist and it is some calculation in the background generated this. Though it is extremely small (e-16
).How do we reconcile
asset_returns
andreturns
/daily_returns
? If asset_returns was for single asset only, doesn'treturns
/daily_returns
show returns as per column(asset) as well? i.e., Is there a portfolio level daily return which weighted-sum all assets' returns to just one series?daily_returns
producedNaN
on days there were no trades happened, e.g., 2020-01-01, 2020-01-04. Why is this?Here's my simple example, if it's not correctly setup please kindly point it out. I filtered for the trades happened only for first asset just for demonstration.