Stop Loss API
The Stop Loss feature enables automated trading when token prices fall below specified thresholds. It relies on Chainlink-compatible price oracles to monitor token prices and trigger the order when conditions are satisfied.Key Parameters
Execution Logic
ThegetTradeableOrder function validates conditions in sequence:
- Confirms the order hasn’t expired
- Retrieves current prices from both oracles
- Verifies prices are positive and recently updated
- Normalizes both to 18 decimals
- Calculates the exchange rate and compares against strike
- Returns the executable order if conditions are met
Failure Scenarios
- Orders fail permanently with
OrderNotValidif expired or oracle prices are invalid - They revert with
PollTryNextBlock(signaling retry on next block) when prices are stale or the strike hasn’t been reached yet