Get open trade

Get open trade on Avantis

Base
Base

Reads onchain state

Reads one open Avantis trade as TradingStorage holds it at the block the plug runs. TradingStorage's openTrades returns the collateral left in the trade, the price it opened at, its side, its leverage, its take profit and stop loss, zero when unset, and the time it opened. A trade a keeper has closed or liquidated reads back all zeros, so a zero leverage means the trade is gone. Reach for it to gate a close or an increase on the trade still being open, to compare its open price with a live price, or to size a later step from its collateral.

Plug lets you combine onchain actions like this one into a single transaction, without writing a smart contract. Use in App opens a new plug with this action already in it.

More on Avantis ยท 37