Uniswap / v3-polars

GNU General Public License v2.0
98 stars 16 forks source link

Add a parameter that allows for specifying a new price level at which to execute a swap #19

Open ankile opened 2 months ago

ankile commented 2 months ago

In the previous version of the simulator code, there was a givenPrice argument that the swapIn function accepted that allowed one to simulate multiple swaps, one after the other, by specifying the given price as the next sqrt_P received by the previous call to swapIn.

I don't know the best way to add this functionality back in, but something like this is crucial to the usecase of running counterfactual swap orders for a block. Pease advise if there's a better way to do this with the new system! 😊