FundingPayment

Documentation for eth_defi.hyperliquid.trade_history.FundingPayment Python class.

class FundingPayment

Bases: object

A single funding payment from the Hyperliquid userFunding endpoint.

Funding is paid/received periodically (typically hourly) for open perpetual positions. Negative USDC means funding was paid by the holder; positive means funding was received.

Attributes summary

coin

Asset symbol (e.g., "BTC", "ETH")

funding_rate

Funding rate applied

usdc

USD amount (negative = paid, positive = received)

position_size

Position size at the time of the funding event

timestamp

Funding event timestamp

timestamp_ms

Timestamp in milliseconds (for storage)

hash

Transaction hash

n_samples

Number of samples aggregated

Methods summary

__init__(coin, funding_rate, usdc, ...[, ...])

from_api_response(data)

Parse a funding payment from API response data.

coin: str

Asset symbol (e.g., “BTC”, “ETH”)

funding_rate: decimal.Decimal

Funding rate applied

usdc: decimal.Decimal

USD amount (negative = paid, positive = received)

position_size: decimal.Decimal

Position size at the time of the funding event

timestamp: datetime.datetime

Funding event timestamp

timestamp_ms: int

Timestamp in milliseconds (for storage)

hash: str | None

Transaction hash

n_samples: int

Number of samples aggregated

classmethod from_api_response(data)

Parse a funding payment from API response data.

The userFunding API returns entries with a delta sub-object containing the actual funding fields (coin, usdc, szi, fundingRate).

Parameters

data (dict) – Raw funding dict from userFunding API response.

Returns

Parsed FundingPayment object.

Return type

eth_defi.hyperliquid.trade_history.FundingPayment

__init__(coin, funding_rate, usdc, position_size, timestamp, timestamp_ms, hash=None, n_samples=1)
Parameters
Return type

None