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/
69 stars 10 forks source link

Lags start price #28

Closed BrandonL20 closed 1 year ago

BrandonL20 commented 1 year ago

Fixes previous assumption that there were many swap near each day's first price (this assumption is not true in less popular pools).

For the following data:
Day 1
Open price: P1
Close price: P2

Day 2 Open price: P3

Old logic: start an LP position around P3 on Day 2 New logic: start an LP position around P2 on Day 2

This is b/c sometimes the first swap on Day 2 can start very late (i.e. 8PM UTC) in illiquid/unpopular pools. And sometimes that swap is MASSIVE and crashes the price in the pool. Creating the LP position around the last close price prevents forward-looking bias in the backtest.

BrandonL20 commented 1 year ago

Added changes to PR in bite20230202_3, please see updated pr