-
Bitcoin
$117500
2.15% -
Ethereum
$3911
6.19% -
XRP
$3.316
10.79% -
Tether USDt
$1.000
0.01% -
BNB
$787.2
2.24% -
Solana
$175.2
4.15% -
USDC
$0.9999
0.00% -
Dogecoin
$0.2225
8.40% -
TRON
$0.3383
0.28% -
Cardano
$0.7868
6.02% -
Stellar
$0.4382
9.34% -
Hyperliquid
$40.92
7.56% -
Sui
$3.764
7.63% -
Chainlink
$18.48
10.66% -
Bitcoin Cash
$582.1
1.88% -
Hedera
$0.2601
6.30% -
Avalanche
$23.33
4.94% -
Ethena USDe
$1.001
0.02% -
Litecoin
$122.3
2.04% -
UNUS SED LEO
$8.969
-0.27% -
Toncoin
$3.339
0.86% -
Shiba Inu
$0.00001287
4.30% -
Uniswap
$10.43
7.38% -
Polkadot
$3.861
5.08% -
Dai
$1.000
0.02% -
Bitget Token
$4.513
3.41% -
Monero
$267.7
-6.18% -
Cronos
$0.1499
4.14% -
Pepe
$0.00001110
5.15% -
Aave
$284.9
8.28%
How can I get historical contract data from the Kraken API?
Fetch Kraken Futures historical OHLC data via `futures-api.kraken.com/api/history/candles` using symbol, interval, and Unix timestamps; authenticate with API key and HMAC-SHA256 signature if rate-limited.
Aug 08, 2025 at 02:49 pm

Understanding Kraken API and Historical Contract Data
The Kraken API is a powerful interface that enables developers and traders to interact with Kraken’s cryptocurrency exchange services programmatically. When referring to historical contract data, it's important to clarify that Kraken primarily supports spot trading and futures contracts through its Kraken Futures platform (formerly known as Cryptowatch Derivatives). The standard Kraken REST API (api.kraken.com) does not provide historical data for futures or perpetual contracts directly. Instead, historical contract data is accessible via the Kraken Futures API, hosted at futures-api.kraken.com.
To retrieve historical data, you must identify the correct endpoint based on the type of contract and time frame needed. The Kraken Futures API offers endpoints such as /api/history/candles
to fetch OHLC (Open, High, Low, Close) data for specific futures contracts. Each endpoint requires parameters like symbol, interval, and from/until timestamps to define the data range.
Setting Up API Access Credentials
Before making any requests, you must set up authenticated access to the Kraken Futures API. This involves creating an API key and secret:
- Log in to your Kraken account and navigate to the Funding section.
- Select API and choose Kraken Futures.
- Click Create API Key.
- Assign permissions—ensure Read access is enabled for market data.
- Generate the key and securely store both the API key and secret key.
These credentials are required to sign requests using HMAC-SHA256. Unlike spot trading, Kraken Futures uses a separate authentication mechanism. Every request must include headers such as APIKey
and Authent
, where Authent
is the computed signature based on the request method, path, body, and timestamp.
Constructing the API Request for Historical Data
To retrieve historical contract data, use the candles history endpoint:
GET https://futures-api.kraken.com/api/history/candles
Required query parameters include:
- symbol: The contract symbol, such as
PI_XBTUSD
for the Bitcoin perpetual inverse contract. - interval: The candlestick interval. Valid values include
1m
,5m
,15m
,1h
,4h
,1d
. - from: Start time in Unix timestamp (seconds).
- until: End time in Unix timestamp (seconds).
For example, to fetch 1-hour candles for the Bitcoin perpetual contract from January 1, 2024, to January 2, 2024:
https://futures-api.kraken.com/api/history/candles?symbol=PI_XBTUSD&interval=1h&from=1704067200&until=1704153600
This request does not require authentication if only public market data is accessed. However, if rate-limited, consider using authenticated requests.
Handling Authentication for Rate-Limited Requests
If you exceed the unauthenticated request limit, switch to signed requests. The process involves:
- Creating a request payload with method, path, body, and ISO 8601 timestamp.
- Concatenating the timestamp, method, path, and body (if present) into a signing string.
- Using HMAC-SHA256 with your secret key to generate a signature.
- Including the signature in the
Authent
header and your key inAPIKey
.
Example steps in Python:
- Set the request method:
GET
- Define the path:
/api/history/candles?symbol=PI_XBTUSD&interval=1h&from=1704067200&until=1704153600
- Generate the ISO timestamp:
2024-01-01T00:00:00Z
- Build the signing message:
2024-01-01T00:00:00ZGET/api/history/candles?symbol=PI_XBTUSD&interval=1h&from=1704067200&until=1704153600
- Compute HMAC-SHA256 of the message using your secret key
- Encode the result in base64
- Set headers:
APIKey: YOUR_PUBLIC_KEY
Authent: BASE64_SIGNATURE
Nonce: 2024-01-01T00:00:00Z
Send the request using a library like requests
.
Processing and Storing the Response Data
The API returns a JSON response containing an array of candle objects. Each candle includes:
- timestamp: Unix time of the candle start.
- open: Opening price.
- high: Highest price.
- low: Lowest price.
- close: Closing price.
- volume: Traded volume.
Example response:
{
"result": "success",
"candles": [{
"timestamp": 1704067200,
"open": "42000.00",
"high": "42500.00",
"low": "41800.00",
"close": "42300.00",
"volume": "120.5"
}
]
}
Parse the JSON and extract the candles
array. You can store this data in CSV, a database, or a DataFrame for analysis. Ensure timestamps are converted to local time or UTC as needed. Handle pagination if the time range is large—Kraken may limit results per request, requiring multiple calls with adjusted from
and until
values.
Common Errors and Troubleshooting
- Invalid symbol: Double-check the contract symbol. Use
GET /api/instruments
to list all available contracts. - Rate limiting: Unauthenticated requests are limited. Use authentication or add delays between calls.
- Invalid timestamp format: Ensure Unix timestamps are in seconds, not milliseconds.
- Signature mismatch: Verify the signing string includes the exact path and query parameters, and that the secret key is correct.
- Empty response: Confirm the time range includes active trading periods.
Use tools like Postman or Python scripts to test requests incrementally. Enable logging to capture request headers and responses for debugging.
Frequently Asked Questions
How do I find the correct symbol for a Kraken Futures contract?
Use the instruments endpoint: GET https://futures-api.kraken.com/api/instruments
. This returns all active contracts with their symbols, such as PI_XBTUSD
for Bitcoin perpetuals or FI_ETHUSD
for Ether futures.
Can I retrieve tick-level historical data instead of candles?
The Kraken Futures API does not provide tick-level data through public endpoints. The /api/history/candles
endpoint only supports aggregated OHLC data at specified intervals. For granular data, consider WebSocket feeds or third-party data providers.
Is there a limit on how much historical data I can fetch at once?
Yes, the API may limit the number of candles returned per request. If your time range is large, split it into smaller intervals—such as one day at a time—and make multiple requests. Check the response for completeness and adjust the from
and until
parameters accordingly.
Do I need to be a verified Kraken user to access historical contract data?
For unauthenticated public data requests, basic account access suffices. However, to increase rate limits and ensure stable access, a verified account with API credentials is recommended. Full trading permissions are not required for data retrieval.
Disclaimer:info@kdj.com
The information provided is not trading advice. kdj.com does not assume any responsibility for any investments made based on the information provided in this article. Cryptocurrencies are highly volatile and it is highly recommended that you invest with caution after thorough research!
If you believe that the content used on this website infringes your copyright, please contact us immediately (info@kdj.com) and we will delete it promptly.
- Bitcoin, Meme ICOs, and FOMO: Catching the Next Crypto Wave
- 2025-08-08 18:30:34
- OM, Investment, and Growth: Decoding the Latest Trends in Digital Assets
- 2025-08-08 18:30:34
- SNEK, Cardano, and the Contributor's Conundrum: A Meme Coin's Fight for Recognition
- 2025-08-08 16:30:12
- Toshi Crypto's Wild Ride: Rally, Demand Slump, and What's Next
- 2025-08-08 16:30:12
- Ethereum, Staking Yields, and DeFi Exposure: A New Era for Investors?
- 2025-08-08 15:10:12
- Unilabs Pumps MIA, Binance Coin Bouncing Back, and Ethereum's Bearish Blues
- 2025-08-08 15:10:12
Related knowledge

What is the distinction between mark price and last price on KuCoin?
Aug 08,2025 at 01:58pm
Understanding the Basics of Price in Cryptocurrency TradingIn cryptocurrency exchanges like KuCoin, two key price indicators frequently appear on trad...

What are the specific maker and taker fees on KuCoin Futures?
Aug 08,2025 at 08:28am
Understanding Maker and Taker Fees on KuCoin FuturesWhen trading on KuCoin Futures, users encounter two primary types of fees: maker fees and taker fe...

What is the maximum leverage available on KuCoin Futures?
Aug 08,2025 at 10:21am
Understanding Leverage in KuCoin Futures TradingLeverage in KuCoin Futures allows traders to control a larger position size using a smaller amount of ...

What is the minimum deposit for OKX contracts?
Aug 08,2025 at 07:00am
Understanding OKX Contract Trading BasicsOKX is one of the leading cryptocurrency derivatives exchanges, offering a wide range of perpetual and future...

Where can I find the OKX trading calculator?
Aug 08,2025 at 07:49am
Understanding the OKX Trading Calculator FunctionalityThe OKX trading calculator is a powerful analytical tool designed to assist traders in estimatin...

Can I trade options on OKX?
Aug 08,2025 at 11:01am
Understanding Options Trading on OKXYes, you can trade options on OKX. OKX is one of the leading cryptocurrency derivatives exchanges that offers a de...

What is the distinction between mark price and last price on KuCoin?
Aug 08,2025 at 01:58pm
Understanding the Basics of Price in Cryptocurrency TradingIn cryptocurrency exchanges like KuCoin, two key price indicators frequently appear on trad...

What are the specific maker and taker fees on KuCoin Futures?
Aug 08,2025 at 08:28am
Understanding Maker and Taker Fees on KuCoin FuturesWhen trading on KuCoin Futures, users encounter two primary types of fees: maker fees and taker fe...

What is the maximum leverage available on KuCoin Futures?
Aug 08,2025 at 10:21am
Understanding Leverage in KuCoin Futures TradingLeverage in KuCoin Futures allows traders to control a larger position size using a smaller amount of ...

What is the minimum deposit for OKX contracts?
Aug 08,2025 at 07:00am
Understanding OKX Contract Trading BasicsOKX is one of the leading cryptocurrency derivatives exchanges, offering a wide range of perpetual and future...

Where can I find the OKX trading calculator?
Aug 08,2025 at 07:49am
Understanding the OKX Trading Calculator FunctionalityThe OKX trading calculator is a powerful analytical tool designed to assist traders in estimatin...

Can I trade options on OKX?
Aug 08,2025 at 11:01am
Understanding Options Trading on OKXYes, you can trade options on OKX. OKX is one of the leading cryptocurrency derivatives exchanges that offers a de...
See all articles
