Developers

Funding rate

List a perpetual's past funding rates, newest first.

On this page

URLs and generated code samples on this page: Testnet (chain ID 326). Other code on this page doesn't change: it stays on testnet until you switch it in your code. Tutorials, signing cases and live tools always use testnet.

Pagination works as follows:

  • We perform a reverse chronological lookup, starting from end_time. If end_time is not set, we start from the most recent data.
  • The lookup is limited to limit records. If more data is requested, the response will contain a next cursor for you to query the next page.
  • If a cursor is provided, it will be used to fetch results from that point onwards.
  • Pagination will continue until the start_time is reached. If start_time is not set, pagination will continue as far back as our data retention policy allows.
SDKclient.funding_rate(...)
HTTPPOST https://market-data.testnet.grvt.io/full/v1/funding, or /lite/v1/funding for lite names (the SDKs' default)
WebSocketmethod v1/funding on wss://market-data.testnet.grvt.io/ws/full, or /ws/lite for lite names
AuthNone (public)
RetriesRead: the SDKs retry retryable errors (rules)
Contract idsettlement.funding_rate (RPCFundingRateV1)

Request

Body type ApiFundingRateRequest. Fields the server fills are left out.

  • instrumentlite name istring (instrument name)required#
    The instrument name, e.g. BTC_USDT_Perp (perpetual), BTC_USDT_SFP (stable funding perp) or BTC_USDT_SpotSwap (spot swap).
  • start_timelite name ststring (int64 unix ns)optionaldefault 0#
    Start time of funding rate in unix nanoseconds
  • end_timelite name etstring (int64 unix ns)optionaldefault now()#
    End time of funding rate in unix nanoseconds
  • limitlite name linteger (uint32)optionaldefault 500#
    The limit to query for. Defaults to 500; Max 1000
  • cursorlite name cstringoptional#
    The cursor to indicate when to start the query from
  • agg_typelite name atenum FundingRateAggregationTypeoptionaldefault FUNDING_INTERVAL#
    Aggregation method for historical funding rate observations. Defaults to using the instrument-specific funding interval.
    4 values
    FUNDING_INTERVAL, ONE_HOURLY, FOUR_HOURLY, EIGHT_HOURLY (details).

Response

Body type ApiFundingRateResponse (the same object is the JSON-RPC result over WebSocket).

  • resultlite name rarray<ApiFundingRate>required#
    The funding rate result set for given interval
    9 fields of ApiFundingRate
    • instrumentlite name istring (instrument name)required#
      The instrument name, e.g. BTC_USDT_Perp (perpetual), BTC_USDT_SFP (stable funding perp) or BTC_USDT_SpotSwap (spot swap).
    • funding_ratelite name frstringoptional#
      The funding rate of the instrument, expressed in percentage points. Absent for stable perps, which have funding_rate_long_apr_pct and funding_rate_short_apr_pct instead.
    • funding_timelite name ftstring (int64 unix ns)required#
      The funding timestamp of the funding rate, expressed in unix nanoseconds
    • mark_pricelite name mpstringrequired#
      The mark price of the instrument at funding timestamp. Decimal string, e.g. "65000.5"; up to 9 decimals. For stable perps, the index price the charge used.
    • funding_rate_8_h_avglite name fr1stringoptional#
      Deprecated: Refer to funding_rate instead. Will be removed in a future release. Absent for stable perps.
    • funding_interval_hourslite name fiinteger (uint8)required#
      Funding interval in hours (e.g. 1/4/8/etc).
    • funding_rate_long_apr_pctlite name fr2stringoptional#
      Stable perps only: the annual rate for retail longs at this charge, in percent a year ('-5.5' = retail longs paid 5.5%; positive = retail receives, negative = retail pays). Absent for other kinds.
    • funding_rate_short_apr_pctlite name fr3stringoptional#
      Stable perps only: the annual rate for retail shorts at this charge, in percent a year ('-5' = retail shorts paid 5%; positive = retail receives, negative = retail pays). Absent for other kinds.
    • funding_multiplierlite name fminteger (uint8)optional#
      Stable perps only: days of funding the charge covered, 3 on the triple day, else 1. Absent for other kinds.
  • nextlite name nstringoptional#
    The cursor to indicate when to start the next query from

Errors

Errors come back as {"code", "message", "status"} (lite {"c", "m", "s"}) with the HTTP status. Codes this call can return (all error codes):

3007NotApplicableForSpotInstrument400
API is not applicable for spot instruments
3008InvalidFundingAggregationTypeForStablePerp400
Funding rate aggregation type is not applicable for stable perp instruments
3012InvalidCursor400
Cursor is invalid
Plus 5 errors any call can return
1002InternalServer500
Internal Server Error
1003InvalidRequest400
Request could not be processed due to malformed syntax
1006RateLimit429retryable
You have surpassed the allocated rate limit for your tier
1014GatewayTimeout504retryable
Upstream data service timed out, please try again
1015ServiceUnavailable503retryable
Upstream data service is temporarily unavailable, please try again

Example

Example code
from grvt import Grvt

with Grvt(env="testnet") as client:
    resp = client.funding_rate(
        instrument="BTC_USDT_Perp",
        limit=500,
    )
    print(resp)

Raw HTTP (set GRVT_DOMAIN, see Environments):

With full field names:

curl -sS "https://market-data.testnet.grvt.io/full/v1/funding" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "instrument": "BTC_USDT_Perp",
  "limit": 500
}
EOF

With lite field names:

curl -sS "https://market-data.testnet.grvt.io/lite/v1/funding" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "i": "BTC_USDT_Perp",
  "l": 500
}
EOF
Run on testnet
esc

↑ ↓ move↵ open⇧↵ open .mdTry an error code like 2002

Keyboard shortcuts

⌘ K
Search the docs
/
Search
l
Next code language (Python → TypeScript → Go → Rust → curl → WebSocket)
j / k
Next / previous page
t
Light / dark theme
?
This help
Esc
Close dialogs and drawers