Solana.Unity-Core icon indicating copy to clipboard operation
Solana.Unity-Core copied to clipboard

[Bug] PriceMath.TickIndexToPrice and PriceMath.SqrtPriceX64ToPrice Wrong price calculations

Open Maxxx555 opened this issue 2 years ago • 1 comments

Describe the bug Wrong price calculations

To Reproduce

Console.WriteLine(PriceMath.TickIndexToPrice(1, 9, 9));
Console.WriteLine(PriceMath.TickIndexToPrice(100, 9, 9));
10.00150003749937502188359611493754442728685383249508961171928583303106051744175749673006360257982567683817469619873
10.15112303331957826695058866288058596662162812280744838892230990557699568227283140711413108281156799322006970554316890624

Expected behavior

1.0001
1.0100496620928754

Maxxx555 avatar Feb 15 '24 15:02 Maxxx555

@Maxxx555 can you please expand on the issue description with the formula, pool used as example with tick size/prize and expected calculation?

GabrielePicco avatar Feb 19 '24 07:02 GabrielePicco