synthetix
synthetix copied to clipboard
Feature/time based order
This PR adjusts the existing next-price order component in FuturesV2
such that the execution of orders are based on time rather than a semi-arbitrary price update from CL feeds. A trader can specify a desiredTimeDelta
in submitDelayedOrder
, allowing their order to be filled after block.timestamp + desiredTimeDelta
.
At the same time, order can also be filled if in the situation where a CL price update occurs before block.timestamp + desiredTimeDelta
(denoted as executableAtTime
in the DelayedOrder
struct).
For validation and additional configurability, each market has two additional parameters, minDelayTimeDelta
and maxDelayTimeDelta
. When submitting an order, the desiredTimeDelta
must be between the lower and upper bound respectively.
All references to nextPrice
has been renamed to delayedOrder
, including documentation (at least I hope). Note that nextPriceConfirmWindow
has not changed. As of writing this, we are still discussing we should introduce delayedOrderConfirmWindow
such that,
if hasPassedNextPriceConfirmWindow or hasPassedDelayedOrderWindow:
keeperCanCancelOrder()