Skip to content

Get Funding Payments

Retrieve detailed funding payment history and statistics for the authenticated subaccount. This endpoint provides user-specific funding data including payments received, paid, and net funding across all positions.

Endpoint

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

Request

Request Format

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

Request Parameters

ParameterTypeRequiredDescription
paramsobjectYesRequest parameters wrapper
params.actionstringYesMust be "getFundingPayments"
params.subAccountIdstringYesSubaccount ID to retrieve funding data for
params.symbolstringNoFilter by specific trading pair
params.startTimenumberNoStart timestamp for filtering (ms)
params.endTimenumberNoEnd timestamp for filtering (ms)
params.limitnumberNoMaximum number of records (default: 100)
ParameterTypeRequiredDescription
nonceuint64YesUnix milliseconds timestamp (must be monotonically increasing)
signatureobjectYesEIP-712 signature object
expiresAfteruint64NoUnix milliseconds expiration timestamp (5x rate limit on stale cancels)

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

Response

Success Response

{
  "status": "ok",
  "response": {
    "summary": {
      "totalFundingReceived": "125.75000000",
      "totalFundingPaid": "89.25000000",
      "netFunding": "36.50000000",
      "totalPayments": "247",
      "averagePaymentSize": "0.87044534"
    },
    "fundingHistory": [
      {
        "paymentId": "fp_1958787130134106112",
        "symbol": "BTC-USDT",
        "positionSize": "2.50000000",
        "fundingRate": "0.00001250",
        "payment": "-1.12500000",
        "timestamp": 1735689600000,
        "fundingTimestamp": 1735689600000
      },
      {
        "paymentId": "fp_1958787130134106111",
        "symbol": "ETH-USDT",
        "positionSize": "-5.00000000",
        "fundingRate": "-0.00002100",
        "payment": "3.15000000",
        "timestamp": 1735661200000,
        "fundingTimestamp": 1735661200000
      }
    ]
  },
  "request_id": "a3f7c2d1e9b8x67k",
  "timestamp": "2025-01-01T00:00:00Z"
}

Response Fields

Summary Object

FieldTypeDescription
totalFundingReceivedstringTotal funding payments received
totalFundingPaidstringTotal funding payments paid
netFundingstringNet funding (received - paid)
totalPaymentsstringTotal number of funding payments
averagePaymentSizestringAverage payment size (absolute value)

Funding History Object

FieldTypeDescription
paymentIdstringUnique identifier for the funding payment
symbolstringTrading pair symbol
positionSizestringPosition size at funding time (signed)
fundingRatestringFunding rate applied (1-hour rate)
paymentstringFunding payment amount (negative = paid out)
timestampnumberWhen payment was processed
fundingTimestampnumberFunding period timestamp

Payment Calculation

Formula: Payment = Position Size × Funding Rate × Mark Price

  • Positive payment: Funding received
  • Negative payment: Funding paid
  • Long positions: Pay when funding rate is positive
  • Short positions: Receive when funding rate is positive

Authentication

This endpoint requires EIP-712 signature authentication.

Request Signing

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.

Example Authentication

const domain = {
  name: "Synthetix",
  version: "1",
  chainId: 1,
  verifyingContract: "0x0000000000000000000000000000000000000000"
};
 
const types = {
  GetFundingPayments: [
    { name: "action", type: "string" },
    { name: "subAccountId", type: "string" },
    { name: "symbol", type: "string" },
    { name: "nonce", type: "uint256" }
  ]
};
 
const value = {
  type: "getFundingPayments",
  subAccountId: "1867542890123456789",
  symbol: "BTC-USDT",
  nonce: 1735689600000
};
 
const signature = await signer._signTypedData(domain, types, value);

Error Responses

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

Endpoint-Specific Errors

Error CodeError TypeDescriptionSolution
40001INVALID_SUBACCOUNTSubaccount not found or unauthorizedVerify subaccount ownership
40002INVALID_SYMBOLInvalid trading symbol filterUse valid symbol from getMarkets
40003INVALID_TIME_RANGEInvalid time range parametersEnsure startTime < endTime

Use Cases

Funding Performance Analysis

// Analyze funding performance over time
const fundingData = await getFundingPayments({
  subAccountId: "1867542890123456789",
  startTime: Date.now() - (30 * 24 * 60 * 60 * 1000) // Last 30 days
});
 
const netFunding = parseFloat(fundingData.result.summary.netFunding);
console.log(`Net funding last 30 days: ${netFunding} USDT`);

Position-Specific Funding

// Get funding for specific market
const btcFunding = await getFundingPayments({
  subAccountId: "1867542890123456789",
  symbol: "BTC-USDT"
});

Funding Rate Impact

// Calculate funding rate impact on strategy
const fundingHistory = fundingData.result.fundingHistory;
const highRatePayments = fundingHistory.filter(
  payment => Math.abs(parseFloat(payment.fundingRate)) > 0.01
);

Related Endpoints