The getMarkPrice
function wrongly moves the price based on how much the skew moves without considering where the skew started. Because of this, users who greatly imbalance the market will be punished less than users who only make small orders. The misalignment of incentives will lead to small users being unfairly punished, while large users can move the skew drastically, putting the entire market at risk.
The getMarkPrice
function aims to modify the market price based on the current skew and what the new skew will be. In general, when the skew moves away from balanced, the user will experience negative price impact. And when the user moves the skew towards balanced, they will get positive price impact.
The price is determined by taking the average of the priceBeforeDelta
and priceAfterDelta
.
The issue with this is that by taking the average, large swings are cushioned while small swings will experience most of the positive/negative impact from wherever the skew is.
Take for example:
The current skew of the market is 0 (perfectly balanced).
The price of the asset is $100.
With 0 skew, the price before delta is $100.
Now examine the following scenario to see how a smaller position is punished by a much larger amount despite a smaller impact on the skew.
Alice (Big swing)
Opens a position with a size of 1000.
Price before is $100.
Price after is $109.50 (9.5% impact for moving the skew from 0 to 950).
Mark price is the average of the above two prices: ((100 + 109.5) / 2) = 104.75.
Alice's price is $104.75.
Bob (Small swing)
Follows Alice and opens a small position with a size of 50.
Price before is $109.5.
Price after is $110 (0.5% impact for moving the skew from 950 to 1000).
Mark price is the average of the above two prices: ((109.5 + 110) / 2) = 109.75.
Bob's price is $109.75.
Despite Bob having nothing to do with the state of the skew and only making a small order, he is getting almost a 5% worse price. Meanwhile, Alice drastically imbalances the market and is only impacted by half of the damage that has been done.
With a high likelihood and medium impact, a medium severity makes the most sense.
The high likelihood comes from the fact that this misalignment will always be present and impact every skew change.
The medium impact is based on large swings getting more favorable prices despite hurting the market, while small swings will get worse prices by consequence of the large swing users.
Users will wrongly get unfavorable prices leading to a lowered PnL.
Anyone can imbalance the market and only be partially punished.
Manual analysis
The best way to mitigate this is to appropriately punish large trades that move the skew away from balanced. To do this, consider moving the markPrice
towards the priceAfterDelta
as the sizeDelta
grows if the skew is moving away from balanced.
Some version of the following would allow you to dynamically adjust how much of the negative price impact a user should experience based on how much they are imbalancing the market.
If x = 5
, this would result in the same output that the function currently does. But as sizeDelta
grows and the balance worsens, you can increase the value of x
so more of the negative price impact is applied.
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.