Skip to content

Get Last Trades

Retrieve the most recent trade execution history (fills) from Synthetix's orderbook across all users. Each trade represents a filled order or partial fill that has been executed. This endpoint provides public market data without requiring authentication.

Endpoint

POST https://papi.synthetix.io/v1/info

Request

Request Format

{
  "params": {
    "action": "getLastTrades",
    "symbol": "BTC-USDT",
    "limit": 100
  }
}

Request Parameters

ParameterTypeRequiredDescription
params.actionstringYesMust be "getLastTrades"
params.symbolstringYesTrading pair symbol (e.g., "BTC-USDT")
params.limitintegerNoMaximum number of trades to return (default: 50, max: 100)

No Authentication Required

This is a public endpoint that does not require authentication.

Response

Success Response

{
  "status": "ok",
  "response": {
    "trades": [
      {
        "tradeId": "123456789",
        "symbol": "BTC-USDT",
        "side": "buy",
        "price": "50000.50",
        "quantity": "0.1",
        "timestamp": 1704067200500,
        "isMaker": false
      },
      {
        "tradeId": "123456788",
        "symbol": "BTC-USDT",
        "side": "sell",
        "price": "50000.25",
        "quantity": "0.05",
        "timestamp": 1704067199800,
        "isMaker": true
      }
    ]
  },
  "request_id": "5ccf215d37e3ae6d"
}

Trade Object (Public)

FieldTypeDescription
tradeIdstringUnique identifier for the trade
symbolstringMarket symbol (e.g., "BTC-USDT")
sidestringOrder side: "buy" or "sell"
pricestringExecution price as string
quantitystringExecuted quantity as string
timestampintegerExecution time in milliseconds since epoch
isMakerbooleanWhether this was a maker order (added liquidity)

Error Response

{
  "status": "error",
  "error": {
    "message": "Invalid symbol",
    "code": "VALIDATION_ERROR"
  },
  "request_id": "5ccf215d37e3ae6d"
}

Examples

Get Recent Trades with Default Limit

{
  "params": {
    "action": "getLastTrades",
    "symbol": "BTC-USDT"
  }
}

Filter by Symbol

{
  "params": {
    "action": "getLastTrades",
    "symbol": "ETH-USDT",
    "limit": 100
  }
}

Maximum Results

{
  "params": {
    "action": "getLastTrades",
    "symbol": "BTC-USDT",
    "limit": 100
  }
}

Response Fields

Response Structure

FieldTypeDescription
tradesarrayArray of public trade objects

Sorting

Trades are returned in descending order by timestamp (newest first).

Implementation Notes

  • Public Data: This endpoint provides public market data suitable for price discovery, trading interfaces, market data feeds, and public trade history displays
  • Symbol Required: A valid market symbol must be provided
  • Limit Usage: Default limit is 50 trades, maximum 100 trades per request
  • Caching: Trade data is immutable once created, suitable for short-term caching
  • Real-time Updates: Use Trade Updates WebSocket subscription for live data with sub-50ms latency. Use REST for initial load, WebSocket for ongoing updates

Use Cases

Market Analysis

  • Recent price discovery and trade flow analysis
  • Volume and liquidity assessment
  • Market depth analysis when combined with orderbook data

Trading Interfaces

  • Displaying recent market activity
  • Trade history components
  • Price movement indicators

Data Feeds

  • Building market data aggregators
  • Feeding external analytics systems
  • Creating public market displays

Differences from getTrades

FeaturegetLastTrades (Public)getTrades (Private)
AuthenticationNot requiredRequired (EIP-712 signature)
Data ScopeAll usersSpecific subaccount only
Sensitive DataExcludedIncluded (fees, PnL, order IDs)
Symbol ParameterRequiredOptional
PaginationLimit onlyLimit + offset
Time FilteringNot supportedStart/end time supported
Rate LimitsMore permissiveStandard authenticated limits
Maximum Limit100 trades1000 trades

Error Handling

Common Errors

ErrorDescriptionSolution
Symbol is requiredSymbol parameter is missing or emptyProvide a valid market symbol
Invalid symbolMarket symbol not recognizedCheck available markets via getMarkets
Limit cannot exceed 100Limit exceeds maximumUse limit ≤ 100
Market not foundSpecified symbol doesn't existVerify symbol format and availability

Rate Limiting

:::info Rate Limits The Synthetix API enforces rate limits to ensure fair usage and system stability:

  • Order Placement: 100 orders per second per subaccount
  • WebSocket Connections: 100 connections per IP address
  • WebSocket Subscriptions: 1000 subscriptions per IP address

See Rate Limits for detailed information and best practices. :::

  • Public endpoints typically have higher rate limits
  • Each request counts as 1 against rate limits
  • No authentication overhead improves response times
  • See Rate Limits for details

Next Steps