You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a simple test strategy (SMA crossover). I set it up so that long_only, short_only and both can be analyzed.
When analyzing the periodic returns, I stumbled upon the fact that the sum of periodic long_only and short_only returns doesn't always equal the corresponding both returns.
Here are some daily returns where the above assumption is true:
However, as soon as I introduce fees or slippage, the short_only side doesn't correspond to the both side (and we are not talking about rounding issues), while long_only looks quite reasonable.
Am I missing something? Is this a bug / incorrect computation?
Fees and slippage aren't taken into account when target percentage is translated into number of shares in order to satisfy the 100% portfolio value requirement. Thus, you short buy slightly more than you can afford (you can see this when you print the allocation with pf.asset_value() / pf.value()).
Thus, you short buy slightly more than you can afford
I don't fully understand this. Do you mind to elaborate?
Still, no matter how you treat fees/slippage in the first place, I feel that long_only and short_only returns should add up to both returns.
Coming back to my example above (periods marked in yellow in the second dataframe), if I am only invested on the short_only side, the return in these specific periods will solely be responsible for the overall (both) portfolio return, won't it?
If my only portfolio position is to be short one asset and this asset looses 5% in a single period, then I expect my return on the short_only side to be +5%. As this is my only position, the portfolio return should be equally +5%, shouldn't it?
I created a simple test strategy (SMA crossover). I set it up so that
long_only
,short_only
andboth
can be analyzed.When analyzing the periodic returns, I stumbled upon the fact that the sum of periodic
long_only
andshort_only
returns doesn't always equal the correspondingboth
returns.Here are some daily returns where the above assumption is true:
However, as soon as I introduce fees or slippage, the
short_only
side doesn't correspond to theboth
side (and we are not talking about rounding issues), whilelong_only
looks quite reasonable.Am I missing something? Is this a bug / incorrect computation?
Here's the code to reproduce the issue:
The text was updated successfully, but these errors were encountered: