Real-time funding payment notifications when funding settles on your positions.
Overview
Funding payments occur when you have an open position and a trade executes (either yours or someone else's that affects the funding rate). This channel provides instant notification of funding settlements, eliminating the need to poll the REST API.
Subscribe
{
"method": "subscribe",
"params": {
"channel": "funding",
"market_ids": [1, 2]
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
market_ids | number[] | No | Filter by market IDs. Empty = all markets |
makers | string[] | No | Filter by account addresses. Empty = authenticated account only |
Message Format
Update
Sent when a funding payment is settled on your position.
{
"channel": "funding",
"type": "update",
"market_id": "1",
"data": {
"account": "0x1234567890123456789012345678901234567890",
"funding_payment": "-12340000000000000000",
"position_size": "1500000000000000000",
"last_checkpoint": "1230000000000000",
"new_checkpoint": "1350000000000000"
},
"block_number": 33759944,
"log_index": 42,
"tx_hash": "0xabc123...",
"block_timestamp": "1705317000000000000",
"timestamp": "1705317000123456789"
}Note: There is no snapshot for the funding channel. Funding payments are events, not state. Use the REST API to query historical funding payments.
Update Message Fields
| Field | Type | Description |
|---|---|---|
channel | string | Always "funding" |
type | string | Always "update" |
market_id | string | Market ID |
data | object | Funding payment details |
block_number | number | Blockchain block number |
log_index | number | Log index within the block |
tx_hash | string | Transaction hash |
block_timestamp | string | Blockchain timestamp (nanoseconds) |
timestamp | string | Server timestamp (nanoseconds) |
Funding Payment Data Fields
| Field | Type | Description |
|---|---|---|
account | string | Account address |
funding_payment | string | Funding amount (wei, 18 decimals). See sign convention |
position_size | string | Position size at settlement (wei, 18 decimals) |
last_checkpoint | string | Previous accumulated funding checkpoint |
new_checkpoint | string | New accumulated funding checkpoint |
Sign Convention
| Sign | Meaning |
|---|---|
positive | You paid funding (deducted from balance) |
negative | You received funding (added to balance) |
Example: Paying Funding
Long position when funding rate is positive (longs pay shorts):
{
"funding_payment": "5000000000000000000",
"position_size": "10000000000000000000"
}This means: You paid 5 USDC in funding (5 * 10^18 wei).
Example: Receiving Funding
Short position when funding rate is positive (longs pay shorts):
{
"funding_payment": "-5000000000000000000",
"position_size": "-10000000000000000000"
}This means: You received 5 USDC in funding (-5 * 10^18 wei).
Funding Calculation
Funding payment is calculated using the formula:
fundingPayment = (newCheckpoint - lastCheckpoint) * positionSize / 10^18
Where:
newCheckpointis the accumulated funding rate at settlementlastCheckpointis your position's previous funding checkpointpositionSizeis your position size (positive for long, negative for short)
When Funding Settles
Funding payments are calculated and broadcast when:
- You execute a trade (open, close, or modify position)
- Someone else executes a trade in the same market
The funding is settled based on the time your position was held since the last checkpoint.
Examples
Subscribe to all funding payments
{
"method": "subscribe",
"params": {
"channel": "funding"
}
}Subscribe to specific markets
{
"method": "subscribe",
"params": {
"channel": "funding",
"market_ids": [1, 2]
}
}Subscribe to specific accounts (internal only)
{
"method": "subscribe",
"params": {
"channel": "funding",
"makers": ["0x1234567890123456789012345678901234567890"]
}
}Unsubscribe
{
"method": "unsubscribe",
"params": {
"channel": "funding"
}
}Authentication
The funding channel requires authentication. Unauthenticated clients cannot subscribe to this channel.
For authenticated users, if no makers filter is specified, the channel automatically filters to your own account's funding payments.
Related Channels
- positions - Track your position changes
- orders.events - Track order executions that may trigger funding