Conditional Orders Lose the Beta!

A Game-Changing Upgrade for Kwenta Traders

If you're an active user of Kwenta, you may have recently observed a significant uptick in the speed of conditional order executions. What you've been experiencing isn't a fluke but the result of an impressive system upgrade. Running silently in the shadows for over a week, has reduced conditional order execution delays by as much as 50%.

This new mechanism has successfully processed nearly 1,000 orders while maintaining maximum throughput during intense market volatility.

Having achieved acceptable performance and resilience, we are excited to announce that we're officially moving conditional orders out of 'Beta.' Kwenta traders can now look forward to a trading experience that is not only faster but more robust and secure.

Constraints of Blockchain

Decentralized exchanges easily facilitate trading at market prices but often lack the ability to execute Limit or Stop-Loss orders without additional infrastructure. The nature of blockchain tech means that transactions can't be initiated autonomously. "Keepers" are introduced into the system, thus enabling things like advanced trading tools (limit order/stop-loss) that require a transaction at a later time.

In the context of derivatives, these keepers can monitor off/on-chain price changes and trigger order executions when set conditions are met. Before executing a given order (or batch of orders), the keeper may update the on-chain price feed to ensure the price on-chain is as accurate as possible.

The Importance of Conditional Orders

So why are conditional orders like Limit or Stop-Loss essential? While some traders may have the time and focus to monitor the market constantly, the reality is that most people have other commitments. Conditional order types allow traders to pre-set buying or selling prices or automatically exit a position if a particular loss level is reached.

From Beta to Today

Kwenta initially rolled out a beta version of conditional orders as part of our Smart Margin V2 launch in April 2023. Despite our efforts with an all-on-chain design, the beta version revealed shortcomings, notably the dependency on push-based oracles that tend to update less frequently and other latency concerns found later. These issues may have caused some traders to experience less-than-ideal order fills.

Subsequent upgrades sought to resolve these concerns by shifting to faster pull-based oracles. While the switch did improve the speed of oracles that trigger orders, it revealed other execution latencies. Even with faster oracles, the system was hard-locked to check order execution eligibility only every 10 seconds and was out of our control.

The initial success of shifting to pull-based oracles was progress. Still, a 10-second latency in checking order eligibility was unacceptable and presented a significant issue. This meant traders could face delayed execution up to 10 seconds after an order becomes eligible for placement. Thus….

A Hybrid Solution for Faster and Secure Trading

To overcome these challenges, Kwenta implemented a hybrid on/off-chain system. An off-chain matching engine monitors on-chain conditional orders while simultaneously keeping track of real-time price updates from Pyth, provided off-chain.

When a price update from Pyth occurs, it may trigger an eligible conditional order for execution. The keeper then takes the off-chain price and commits on-chain along with the traders order in a single batch.

This hybrid approach results in orders that can be fully committed to the chain within seconds of being triggered but maintain the security users of a decentralized system have come to expect.

What’s Next?

Although Kwenta’s conditional order system is out of beta, work continues to test and monitor its performance in various real-world conditions. As we continue working with the Synthetix team on Perps v3, the learnings from Kwenta’s work on the v2 conditional order system will help inform the underlying design and the tools Kwenta offers.

Underlying infrastructure providers such as our oracle providers at Pyth and Chainlink, Optimism developers, and even anticipated improvements to Ethereum will provide future opportunities to provide cheaper, faster, and more predictable pricing.

Join the Kwenta Community

If you haven't already, join the Kwenta community on Discord.

To be the first to learn about new updates to Kwenta, follow us on Twitter.

To trade synthetic assets and futures, visit Kwenta.

Subscribe to Kwenta
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
This entry has been permanently stored onchain and signed by its creator.