CVI v4 now supports opening/closing positions in near real-time (several seconds) via a new position execution logic. Instead of using the CVI oracle value as the sole price for settling trades, a secondary oracle is used in parallel to fetch the raw real-time CVI value. A combination of the two values is used to safely and reliable execute trades in real-time, while preventing front-running the CVI oracle.
The CVI oracle value is computed by Chainlink's decentralised oracle network and includes an adaptive exponential moving average in order to increase its reliability.
In parallel to it, the raw cvi value is updated in real-time and is pulled on-demand whenever a trader executes a trade.
The execution logic works as follows:
Price for opening a position = Max(CVI Oracle value, Raw CVI value)
Price for closing a position = Min(CVI Oracle value, Raw CVI value)
Execution gap = Math.abs(1 - CVI Oracle value / Raw CVI Value)