Rasa Solver TP/SL Implementation
Rasa’s conditional orders handler lets you set take-profit and stop-losses to an existing position.
Instead of polling and closing positions manually, you send a conditional order to Rasa and it will automatically request the close when your trigger price is hit.
This version of the API:
Uses the instant trading login flow (no more manual JSON signing)
Requires MultiAccount delegation so Rasa can request closes on your behalf
Supports multiple conditional orders per quote (e.g. one TP and one SL)
Base URL
https://conditional-orders-handler.rasa.capital/api/v4/Before sending TP/SL orders, you must have:
MultiAccount delegation set up
In your MultiAccount, you must delegate at least the following functions to the Rasa PartyB address:
requestToClosePosition(0x501e891f)requestToCancelCloseRequest(0xa63b9363)
This lets Rasa submit/modify close requests on your sub-account when the TP/SL triggers.
Instant trading login (Bearer token)
You must log in to the Rasa hedger using the instant trading flow (SIWE) and obtain an
access_token.That token will be sent as
Authorization: Bearer <token>when you call the conditional orders API.
An open SYMMIO position (quote)
You need a valid
quote_idfrom an existing open position.You must know:
account_address(PartyA sub-account)symbol_idmulti_account_addressRasa PartyB address for the chain (goes in
hedger_whitelist).
POST api/v4/
Request Payload
Example payload for one TP and one SL on the same quote:
Request Fields:
account_address:PartyA sub-account address for this position (the MultiAccount child that owns the quote).quote_id:The SYMMIO quote ID you want to attach TP/SL to (must be OPEN).symbol_id:The SYMMIO symbol ID (e.g. XRP =4in your example).multi_account_address:The MultiAccount contract address deployed by a frontend builder.hedger_whitelistArray of PartyB addresses allowed to execute these conditional orders. For Rasa on Base, this is their PartyB address:conditional_ordersArray of TP/SL instructions for this quote. You can send one or multiple (e.g. one TP + one SL).
conditional_orders[] object
conditional_orders[] objectEach object describes a single TP or SL:
quantity(string) — How much of the position should be closed when this order triggers.price(string) – This is the minimum price you’re willing to accept when closing, after slippage.For LONGS, a common pattern is:
e.g. for 10% slippage:
price = conditional_price * 0.9For SHORTS, the direction is inverted:
e.g. for 10% slippage:
price = conditional_price * 1.1
The solver will only close the trade if it can get at least this price (for longs) or at most this price (for shorts).
conditional_price(string) – The price level at which this TP/SL should attempt to close.conditional_price_type(string) — How the trigger price is interpreted:"last_close"– use the last close price feed for that symbol."market" — uses the market price for that symbol
order_type(number) — Order type used when closing:1for market orders,2for limit.position_type(number) — The direction of the position:0– Long,1– Short.This is important because TP and SL logic, as well as slippage direction, depend on whether the position is long or short.
conditional_order_type(string)"take_profit"– close when price moves in your favor to lock in gains."stop_loss"– close when price moves against you to cap losses.
leverage(number) The leverage used for the position.
Authentication & Headers
Before calling the conditional-orders API, you must log in to Rasa using the instant-trading login flow and obtain an access_token.
When sending the request:
Flow Summary
Delegate permissions via MultiAccount: Allow Rasa’s PartyB address to call
requestToClosePositionandrequestToCancelCloseRequestfor your sub-account.Login to Rasa via the instant-trading flow and get a Bearer token.
Build your conditional orders payload
POST the payload with the
Authorization: Bearer <token>header.When the market reaches your
conditional_priceand execution is possible above/below yourpricethreshold.
GET /api/v4/{quote_id}/
You can query which TP/SL (or other conditional) orders are currently registered for a quote.
Endpoint
Path params
quote_id– the SYMMIO quote ID you want to inspect.
Example response
DELETE /api/v4/{quote_id}/{conditional_order_type}
You can remove an existing TP, SL, or other conditional order for a quote.
Endpoint
Path params
quote_id– the quote ID of the conditional order you want to cancel.conditional_order_type– one of:take_profitstop_loss
This will cancel that specific type of conditional order for the quote. For example:
Cancel only the stop loss for quote
179921:
Cancel the take profit:
Last updated
