Order model
Orders represent perpetual trading activity including market orders, liquidations, limit orders, take profits, and stop losses. Identifier on Mobula:order
Supported exchanges: lighter, gains
Supported chains: lighter:301, lighter:304, evm:42161 (Arbitrum)
Event Categories
Perps events are divided into three categories based on their structure: 1. Executed Orders (PerpOrderExecuted) - Full trade executions with pricing data
| Type | Description |
|---|---|
MARKET_BUY | Market buy order execution |
MARKET_SELL | Market sell order execution |
LIQUIDATION | Liquidated position |
LIMIT_BUY | Limit buy order execution |
LIMIT_SELL | Limit sell order execution |
TAKE_PROFIT | Take profit trigger execution |
STOP_LOSS | Stop loss trigger execution |
PerpTpSlUpdate) - Take profit and stop loss modifications
| Type | Description |
|---|---|
UPDATE_TP | Take profit level update |
UPDATE_SL | Stop loss level update |
PerpUncategorizedEvent) - Position management events
| Type | Description |
|---|---|
TRADE_STORED | New trade stored (pending execution) |
POSITION_SIZE_INCREASE_EXECUTED | Position size increased |
POSITION_SIZE_DECREASE_EXECUTED | Position size decreased |
LEVRAGE_UPDATE_EXECUTED | Leverage updated on position |
MARKET_CLOSE_CANCELED | Market close order canceled |
MARKET_OPEN_CANCELED | Market open order canceled |
Field Reference - Executed Orders
Fields available onPerpOrderExecuted events (MARKET_BUY, MARKET_SELL, LIQUIDATION, etc.):
| Field | Type | Description |
|---|---|---|
market | string | Market identifier (e.g., lighter-eth-usd, lighter-btc-usd) |
exchange | string | Exchange identifier (lighter, gains) |
chainId | string | Chain identifier (e.g., lighter:301, evm:42161) |
type | string | Order type (see table above) |
priceQuote | number | Execution price in quote currency |
priceUSD | number | Execution price in USD |
baseAmountRaw | string | Base asset amount in wei (18 decimals) |
collateralAmountRaw | string | Collateral amount in wei (18 decimals) |
traderAddress | string | Trader’s wallet address |
transactionHash | string | Transaction hash |
tradeId | string | Unique trade identifier ({exchange}-{address}-{market}-{id}) |
leverage | number | null | Position leverage multiplier |
takeProfitUSD | number | null | Take profit price in USD |
stopLossUSD | number | null | Stop loss price in USD |
collateralAsset | string | null | Collateral token contract address |
date | string | ISO 8601 timestamp |
extra | object | Exchange-specific additional data |
Field Reference - TP/SL Updates
Fields available onPerpTpSlUpdate events (UPDATE_TP, UPDATE_SL):
| Field | Type | Description |
|---|---|---|
market | string | Market identifier |
exchange | string | Exchange identifier |
chainId | string | Chain identifier |
type | string | UPDATE_TP or UPDATE_SL |
traderAddress | string | Trader’s wallet address |
transactionHash | string | Transaction hash |
tradeId | string | Unique trade identifier |
newPriceQuote | number | New TP/SL price in quote currency |
quantityPercentage | number | Percentage of position affected |
date | string | ISO 8601 timestamp |
Field Reference - Uncategorized Events
Fields available onPerpUncategorizedEvent events:
| Field | Type | Description |
|---|---|---|
market | string | Market identifier |
exchange | string | Exchange identifier |
chainId | string | Chain identifier |
type | string | Event type (see table above) |
traderAddress | string | Trader’s wallet address |
transactionHash | string | Transaction hash |
tradeId | string | Unique trade identifier |
date | string | ISO 8601 timestamp |
extra | object | Event-specific data (see below) |
| Event Type | Extra Fields |
|---|---|
TRADE_STORED | tradeType, leverage, long, collateralAmount, index, openPrice, tp, sl |
POSITION_SIZE_INCREASE_EXECUTED | cancelReason |
POSITION_SIZE_DECREASE_EXECUTED | cancelReason |
LEVRAGE_UPDATE_EXECUTED | (none) |
MARKET_OPEN_CANCELED | cancelReason, orderId |
MARKET_CLOSE_CANCELED | cancelReason, index |
Extra Data (Lighter/Gains)
For liquidations and limit orders, additional data is available in theextra field:
| Field | Type | Description |
|---|---|---|
extra.trade.long | boolean | Position direction (true = long, false = short) |
extra.trade.index | number | Trade index on the exchange |
extra.trade.openPrice | bigint | Position open price |
extra.trade.tradeType | number | Internal trade type identifier |
extra.trade.collateralIndex | number | Collateral asset index |
extra.open | boolean | Whether this opens a new position |
extra.amountSentToTrader | bigint | Amount returned to trader (for closes) |
extra.percentProfit | bigint | Profit percentage (for closes) |
extra.oraclePrice | bigint | Oracle price at execution |
extra.collateralPriceUsd | bigint | Collateral USD price at execution |