panoptic-labs / research

At Panoptic, we recognize the power of open source code in promoting research integrity and collaboration. We strive to maintain a transparent work environment that allows us all to learn from each other's findings by sharing our coding projects through GitHub - creating an enriched experience for everyone involved!
https://www.panoptic.xyz/
70 stars 10 forks source link

Compounding simple returns #11

Open BrandonL20 opened 1 year ago

BrandonL20 commented 1 year ago

@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: https://github.com/panoptic-labs/research/blob/4e463cd9e8d421a067d25f1b2fbf1f39b3edac03/_research-bites/20230112/ResearchBites-20230112-Autoroll.ipynb?short_path=c0c4987#L184

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 ] ]