Skip to main content
Use client.funding_rates() when you need historical funding rate data for perpetual contracts. This method returns a time series of funding rates used for carry modeling and perpetual trading analysis.

Method signature

funding_rates(source, market, from_, to, limit=1000)

Parameters

ParameterTypeRequiredNotes
sourcestrYesSource ID
marketstrYesNormalized market or instrument ID
from_str/datetime/date/intYesInclusive start time (ISO 8601, datetime, date, or epoch microseconds)
tostr/datetime/date/intYesExclusive end time (same formats as from_)
limitintNoPage size (default: 1000)
Note: API key required for historical ranges. Set POLARIS_API_KEY environment variable or pass api_key to PolarisClient().

Return value

List of funding rate point series rows.

Example response

[
    {
        'timestamp': 1704067200000000,
        'venue': 'binance',
        'symbol': 'BTCUSDT',
        'funding_rate': 0.00017,
        'funding_interval': 8 * 3600  # seconds
    }
]

Fields

Funding rate records include:
  • timestamp: observation time in UTC microseconds since the Unix epoch
  • venue: exchange identifier
  • symbol: normalized instrument symbol
  • funding_rate: the funding rate (decimal, e.g., 0.00017 = 0.017%)
  • funding_interval: funding period in seconds (typically 1h, 4h, or 8h)

Example

from datetime import datetime, timedelta, timezone
from polaris_data import PolarisClient

end = datetime.now(timezone.utc)
start = end - timedelta(days=7)

with PolarisClient() as client:
    rates = client.funding_rates(
        source="binance",
        market="BTCUSDT",
        from_=start,
        to=end,
    )

print(rates[:2])

How it works

client.funding_rates() uses snapshot-first replay: it queries the /snapshots endpoint for historical data and reads from local cached files when available. Funding rates are extracted from standardized datapoint events with the funding_rate label. For more details on snapshot-based queries, see Snapshots.