FundingPayment
Documentation for eth_defi.hyperliquid.trade_history.FundingPayment Python class.
- class FundingPayment
Bases:
objectA single funding payment from the Hyperliquid
userFundingendpoint.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
Asset symbol (e.g., "BTC", "ETH")
Funding rate applied
USD amount (negative = paid, positive = received)
Position size at the time of the funding event
Funding event timestamp
Timestamp in milliseconds (for storage)
Transaction hash
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)
- n_samples: int
Number of samples aggregated
- classmethod from_api_response(data)
Parse a funding payment from API response data.
The
userFundingAPI returns entries with adeltasub-object containing the actual funding fields (coin, usdc, szi, fundingRate).- Parameters
data (dict) – Raw funding dict from
userFundingAPI response.- Returns
Parsed FundingPayment object.
- Return type
- __init__(coin, funding_rate, usdc, position_size, timestamp, timestamp_ms, hash=None, n_samples=1)
- Parameters
coin (str) –
funding_rate (decimal.Decimal) –
usdc (decimal.Decimal) –
position_size (decimal.Decimal) –
timestamp (datetime.datetime) –
timestamp_ms (int) –
hash (str | None) –
n_samples (int) –
- Return type
None