Get open trade
Get open trade

Avantis · 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.