post
https://api.testnet.rise.trade/v1/orders/tpsl
Create a Take Profit or Stop Loss order. Orders are stored off-chain and executed on-chain when the stop price condition is met.
Order Types:
TAKE_PROFIT: Triggers when price moves favorably (long: price >= stop_price, short: price <= stop_price)STOP_LOSS: Triggers when price moves unfavorably (long: price <= stop_price, short: price >= stop_price)
Stop Price Options:
MARK_PRICE: Use oracle mark price for triggerLAST_TRADED_PRICE: Use last traded price for trigger
Signature: Signer signs VerifySignature with hash = keccak256(encodedTpslOrderData)
TPSL Order Encoding:
bytes[0:8] = marketId (uint64, big-endian)
bytes[8:24] = size (uint128, big-endian)
bytes[24:40] = limitPrice (uint128, big-endian, 0 for market order)
bytes[40:56] = stopPrice (uint128, big-endian)
bytes[56] = flags: bit0=side, bit1=stopType(0=profit,1=loss), bit2=orderType(0=market,1=limit), bit3=stopPriceOption(0=mark,1=last)