In the _getWeights function of the AntiMomentumUpdateRule.sol contract. The code implementation has use different price to calculate price gradient(∂p̅(t)/∂t) and price change rate(1/p(t)·∂p(t)/∂t) from its corresponding whitepaper as shown below:
Code: w(t) = w(t-1) + κ·(ℓp(t) - 1/p(t)·∂p̅(t)/∂t),or w(t) = w(t-1) + κ·(ℓp(t) - 1/p̅(t)·∂p̅(t)/∂t)
White paper: w(t) = w(t-1) + κ·(ℓp(t) - 1/p̅(t)·∂p(t)/∂t)
The use of moving average prices in gradient calculation introduces a “double smoothing” effect, delaying the reaction to actual market changes. And the flexibility to toggle between raw and moving average prices introduces unnecessary complexity and deviates from the whitepaper’s guidelines.
Finding: The implementation uses moving average prices (p̄(t)) to compute price gradients (∂p(t)/∂t), while the whitepaper specifies raw prices (p(t)) for this calculation.
Root Cause: The use of moving average prices in gradient calculation introduces a “double smoothing” effect, delaying the reaction to actual market changes. Using smoothed prices for gradients compromises the strategy’s ability to respond to short-term market dynamics, reducing effectiveness and potentially leading to suboptimal decision-making.
Finding: The implementation uses a conditional flag (useRawPrice) to determine whether to use raw prices or moving average prices in the denominator. This contradicts the whitepaper, which explicitly specifies the use of moving average prices (p̄(t)) for stability.
Root Cause: The flexibility to toggle between raw and moving average prices introduces unnecessary complexity and deviates from the whitepaper’s guidelines. Allowing raw prices in the denominator can increase sensitivity to noise and short-term price spikes, leading to potential overreaction and instability.
pkg/pool-quantamm/contracts/rules/AntimomentumUpdateRule.sol:_getWeights#L71-L77
Using raw prices for gradient calculations improves the timeliness and accuracy of market signals.
Adhering to moving average prices in the denominator enhances stability, reducing unnecessary noise and volatility in weight adjustments.
Deviating from whitepaper specifications increases the risk of overfitting to specific market conditions, compromising robustness in broader scenarios. Failing to adhere to the whitepaper’s guidelines undermines the trustworthiness of the implementation and its alignment with theoretical foundations.
Manual Review
Use Raw Prices for Gradient Calculation:
Adjust _calculateQuantAMMGradient to compute gradients based on raw prices (p(t)), reflecting real-time market changes as intended by the whitepaper.
Clear Explanations for useRawPrice Option in Denominator:
Update the relevant sections in useRawPrice option with clear explanations for the use of price types in different contexts to enhance code maintainability to ensure compliance with the whitepaper.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.