Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compounding simple returns #11

Open
BrandonL20 opened this issue Jan 13, 2023 · 0 comments
Open

Compounding simple returns #11

BrandonL20 opened this issue Jan 13, 2023 · 0 comments

Comments

@BrandonL20
Copy link
Collaborator

BrandonL20 commented Jan 13, 2023

@guil-lambert I've only looked at this briefly so I could be totally off base, but it appears as if you are trying to sum up simple returns.

Returns:
" strat.append((endX*currentsqrtPrice**2+endY - startX*startPrice - startY)/2/positionSize)\n",

Compounding via cumsum:

"plt.plot(np.cumsum(strat), lw=1.5, color='w', zorder=3)\n",

I believe a more accurate calculation for calculating compounded returns would be something like
(1 + ret).cumprod() - 1
or
[ x - 1 for x in np.cumprod[ x + 1 for x in strat ] ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant