vegaprotocol / vega

A Go implementation of the Vega Protocol, a protocol for creating and trading derivatives on a fully decentralised network.
https://vega.xyz
GNU Affero General Public License v3.0
37 stars 22 forks source link

Update after 0038-OLIQ spec change #5605

Closed gordsport closed 2 years ago

gordsport commented 2 years ago

The 0038 spec has been updated:

with the following info:

Note: if the resulting quote price of any of the entries in the buy / sell shape leads to negative product value from the product quote-to-value function but strictly positive volume then the entire LP order for this LP is undeployed, their stake won't count towards target stake being met and they shall not receive any LP fees regardless of their equity-like-share. This can lead to a liquidity auction if the supplied stake for the market is below the required level due to this LP.

This change is covered in the feature test:l

However the change needs to also be implemented on the core side.

davidsiska-vega commented 2 years ago

The spec is written be forward looking but of course for cash settled futures the "product value" is just the price that they're trading at.

gordsport commented 2 years ago

@EVODelavega - please can you confirm that it is not possible for the price to be negative here?

If so we can move out / close this issue as its already as per the spec.

EVODelavega commented 2 years ago

Prices in core are of the type uint256, so in that sense it is impossible to have negative prices. Pegged orders and LP orders are only deployed during continuous trading, and we correct the price point to be within the bounds set by price monitoring. Unless the price monitoring component doesn't account for uint256 overflow, it shouldn't be possible to have negative (or rather int overflow) prices. When pricing/applying the offsets when deploying LP orders, we ensure the offset is not greater than the reference price, so I cannot see how we could end up with an invalid price