
gTrade · Reads onchain state
Reads one entry of a gTrade book, an open trade or an open limit or stop order, as the diamond holds it at the block the plug runs. The diamond's getTrade returns the trade's pair, leverage, side, whether it is open, its collateral index and amount, its type (0 a trade, 1 a limit order, 2 a stop order), its open or trigger price, its take profit and its stop loss, zero when unset. An entry that has closed, been cancelled or filled into a trade reads back as not open. 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.