Update open order
Update open order

gTrade · Acts onchain

Moves an open gTrade limit or stop order to a new trigger price, take profit, stop loss and slippage. The diamond's updateOpenOrder rewrites the order on the trader's book in the same block; its collateral, side and leverage stay as placed. The take profit must sit beyond the new trigger on the order's winning side and the stop loss on its losing side, zero for none, and an order already being triggered refuses the update. gTrade keys every book on its trader. A program on a Plug account apart from its wallet acts on the wallet's own book: the Plug account calls the diamond's delegatedTradingAction naming the wallet, which runs the call as the wallet, so collateral is pulled from and proceeds are paid to the wallet and every trade stays the wallet's. The wallet's one standing grant is setTradingDelegate naming its Plug account, sent with its approvals before the first program that needs it; a wallet that is its own socket trades as itself. Reach for it to trail an entry behind a moving price, or to tighten an order's exits as a condition changes.