Skip to content

Get Performance History

Retrieve comprehensive performance analytics including historical account value, PnL trends, and trading volume for a subaccount over a specified period. Optimized for charting and performance analysis.

Endpoint

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

Request

Request Format

{
  "params": {
    "action": "getPerformanceHistory",
    "period": "week"
  },
  "subAccountId": "1867542890123456789",
  "nonce": 1735689600000,
  "signature": {
    "v": 28,
    "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
  }
}

Request Parameters

ParameterTypeRequiredDescription
paramsobjectYesContainer for action-specific parameters
params.actionstringYesMust be "getPerformanceHistory"
params.periodstringNoTime window for the performance history. One of day (default), week, month, threeMonth, ytd, allTime.

If params.period is omitted, the service returns day performance history by default.

ParameterTypeRequiredDescription
nonceuint64YesUnix milliseconds timestamp (must be monotonically increasing)
signatureobjectYesEIP-712 signature object
expiresAfteruint64NoUnix milliseconds expiration timestamp (5x rate limit on stale cancels)

Response

Success Response

{
  "status": "ok",
  "response": {
    "subAccountId": "123456789",
    "period": "day",
    "performanceHistory": {
      "history": [
        {
          "sampledAt": 1736947200000,
          "accountValue": "10000.50",
          "pnl": "12.34"
        },
        {
          "sampledAt": 1736950800000,
          "accountValue": "10020.10",
          "pnl": "15.67"
        }
      ],
      "volume": "250000.00"
    }
  },
  "request_id": "abcd1234"
}

Response Structure

Performance History Object

FieldTypeDescription
historyarrayOrdered list of performance points for the requested period
history[]objectIndividual datapoint containing timestamp and performance values
history[].sampledAtnumberUnix timestamp in milliseconds
history[].accountValuestringAccount value at the timestamp
history[].pnlstringPnL at the timestamp
volumestringTotal volume traded during the requested period

The response also echoes the subAccountId and the period that was requested.

Error Response

{
  "status": "error",
  "error": {
    "message": "Failed to retrieve performance history",
    "code": "INTERNAL_ERROR"
  },
  "request_id": "5ccf215d37e3ae6d",
  "timestamp": "2025-01-01T00:00:00Z"
}

Code Examples

Get Performance History

{
  "params": {
    "action": "getPerformanceHistory",
    "period": "month"
  },
  "subAccountId": "1867542890123456789",
  "nonce": 1735689600000,
  "signature": {
    "v": 28,
    "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
  }
}

Performance Information

  • Historical Analytics: Account value and PnL tracking for a selected timeframe (day, week, month, threeMonth, YTD, all-time)
  • Volume Tracking: Trading activity metrics for performance analysis over the requested period
  • Time Series Data: Ideal for charting and portfolio performance visualization
  • Performance Focus: Dedicated to performance analytics, separate from account balances and margin data
  • USDT Denomination: All monetary values are denominated in USDT for consistency
  • Optimized for Analytics: Structured for performance dashboards and reporting tools

Use Cases

  • Performance Dashboards: Build comprehensive performance tracking interfaces
  • PnL Analysis: Track profit and loss trends over different time periods
  • Trading Analytics: Analyze trading volume and activity patterns
  • Portfolio Reporting: Generate performance reports for users
  • Charting Applications: Power performance charts and visualizations
  • Trend Analysis: Identify performance patterns and trading behavior

Validation Rules

  • nonce must be a timestamp in milliseconds and must be increasing
  • Must be signed by account owner or authorized delegate
  • Subaccount ID must be valid and accessible

EIP-712 Domain Separator

All signature-based authentication uses the following domain separator:

{
  "name": "Synthetix",
  "version": "1",
  "chainId": 1,
  "verifyingContract": "0x0000000000000000000000000000000000000000"
}

Signing

All trading methods are signed using EIP-712. Each successful trading request will contain:

  • A piece of structured data that includes the sender address
  • A signature of the hash of that structured data, signed by the sender

For detailed information on EIP-712 signing, see EIP-712 Signing.

Nonce Management

The nonce system prevents replay attacks and ensures order uniqueness:

  • Use current timestamp in milliseconds as nonce
  • Each nonce must be greater than the previous one
  • Recommended: Use Date.now() or equivalent
  • If nonce conflicts occur, increment by 1 and retry

Error Handling

Common error scenarios:

ErrorDescription
Invalid signatureEIP-712 signature validation failed
Invalid market symbolMarket symbol not recognized
Nonce already usedNonce must be greater than previous value
Rate limit exceededToo many requests in time window
Request expiredexpiresAfter timestamp has passed
ErrorDescription
Invalid request formatRequest payload could not be parsed
Internal errorFailed to retrieve performance data
Subaccount not foundSpecified subaccount does not exist
Insufficient permissionsAccount lacks access to this subaccount

Related Endpoints

Data Format Notes

  • Timestamps: Unix timestamp in milliseconds
  • Time Series: Array of objects with sampledAt, accountValue, and pnl, ordered chronologically
  • Numeric Precision: All numeric values returned as strings to preserve precision
  • Volume (volume): Represents total volume traded during the requested time period