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.symbolstringNoFilter trades by market symbol (e.g., "BTC-USDT")
params.limitintegerNoMaximum number of trades to return (default: 100, max: 500)

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
      }
    ],
    "total": 2
  },
  "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",
  "timestamp": "2025-01-01T00:00:00Z"
}

Examples

Get Recent Trades (All Markets)

{
  "params": {
    "action": "getLastTrades",
    "limit": 50
  }
}

Filter by Symbol

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

Maximum Results

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

Response Fields

Response Structure

FieldTypeDescription
tradesarrayArray of public trade objects
totalintegerNumber of trades returned

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 Filtering: Filter by symbol to reduce response size and bandwidth
  • Limit Usage: Default limit is 100 trades, maximum 500 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)
PaginationLimit onlyLimit + offset
Time FilteringNot supportedStart/end time supported
Rate LimitsMore permissiveStandard authenticated limits
Maximum Limit500 trades1000 trades

Error Handling

Common Errors

ErrorDescriptionSolution
Invalid symbolMarket symbol not recognizedCheck available markets via getMarkets
Invalid limitLimit exceeds maximumUse limit ≤ 500
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