-
Bitcoin
$111300
-0.83% -
Ethereum
$4296
-0.28% -
XRP
$2.970
-0.28% -
Tether USDt
$0.0000
0.01% -
BNB
$876.7
-0.13% -
Solana
$216.7
0.50% -
USDC
$0.9998
0.01% -
Dogecoin
$0.2424
1.50% -
TRON
$0.3345
0.88% -
Cardano
$0.8635
0.03% -
Hyperliquid
$53.38
5.54% -
Chainlink
$23.07
0.27% -
Ethena USDe
$1.001
0.02% -
Sui
$3.463
-0.21% -
Stellar
$0.3738
-0.33% -
Bitcoin Cash
$578.5
-1.51% -
Avalanche
$26.00
2.07% -
Hedera
$0.2276
0.77% -
UNUS SED LEO
$9.548
0.02% -
Cronos
$0.2597
2.73% -
Litecoin
$112.0
-0.64% -
Toncoin
$3.089
-0.29% -
Shiba Inu
$0.00001285
-0.10% -
Polkadot
$4.098
1.54% -
Uniswap
$9.484
-0.88% -
Ethena
$0.8361
8.06% -
Dai
$0.9998
0.01% -
Monero
$269.5
-0.68% -
World Liberty Financial
$0.1994
-4.02% -
Aave
$299.1
-1.29%
How does the Kraken API work for contract trading?
The Kraken Futures API enables automated trading of crypto perpetual contracts via REST and WebSocket endpoints, requiring separate API keys from futures.kraken.com.
Aug 13, 2025 at 11:35 am

Understanding the Kraken API for Contract Trading
The Kraken API provides a robust interface for interacting with Kraken’s financial products, including futures and perpetual contracts. While Kraken is traditionally known for its spot trading services, its expansion into derivatives through Kraken Futures—powered by the Crypto Facilities technology—enables users to trade perpetual futures contracts on various cryptocurrencies. The API allows traders to automate strategies, manage positions, and retrieve real-time market data. Access to contract trading via the API requires authentication using API keys, which are generated in the Kraken account settings. These keys grant permission to perform actions such as placing orders, checking balances, and retrieving position information.
To begin using the Kraken API for contract trading, you must first navigate to the Kraken Futures portal (futures.kraken.com), where you can generate a dedicated API key. Unlike spot trading, futures API access is managed separately. Once the key is created, it must be used with the futures.kraken.com base URL instead of the standard spot API endpoint. The API supports REST and WebSocket protocols, enabling both synchronous requests and real-time streaming of market data.
Authentication and API Key Setup
Before making any API calls, you must set up proper authentication. This involves generating an API key and secret through the Kraken Futures dashboard.
- Log in to your Kraken Futures account
- Navigate to Settings > API
- Click 'Create API Key'
- Assign permissions: ensure 'Order,' 'Query,' and 'Withdrawal' rights are enabled if needed
- Save the API key and private secret securely
Authentication for the Kraken Futures API uses HMAC-SHA256 signatures. Each request must include the following headers:
- APIKey: your generated public key
- Authent: the HMAC signature generated from the request data
- Content-Type: application/json
The signature is computed using the private secret, the request path, nonce (a strictly increasing number), and the request body. Libraries in Python, Node.js, and other languages can automate this process. For example, in Python, you can use the requests
library along with hmac
and hashlib
to sign requests properly.
Retrieving Market and Contract Information
To trade contracts effectively, you must first understand the available instruments. The Kraken Futures API provides endpoints to list all tradable contracts.
- Send a GET request to https://futures.kraken.com/derivatives/api/v3/instruments
- The response includes symbol, margin requirements, funding rates, and maximum leverage
- Each contract symbol follows a naming convention such as PI_XBTUSD (Perpetual Inverse Bitcoin/USD) or PF_SOLUSD (Perpetual Futures Solana/USD)
You can also fetch real-time order book data using the endpoint:
- https://futures.kraken.com/derivatives/api/v3/tickersThis returns the latest bid, ask, last traded price, and open interest for each contract. For deeper market insights, use the orderbook endpoint with a specified symbol to retrieve full bid/ask depth.
Placing and Managing Contract Orders
Once you’ve identified a trading opportunity, you can place orders using the sendorder endpoint. This requires a POST request to:
- https://futures.kraken.com/derivatives/api/v3/sendorder
Required parameters include:
- orderType: such as lmt (limit), mkt (market), or post (post-only)
- symbol: the contract identifier (e.g., PI_ETHUSD)
- side: buy or sell
- size: the number of contracts
- limitPrice: required for limit orders
For example, to place a limit buy order for 100 contracts of PI_XBTUSD at $43,000:
{ 'orderType': 'lmt', 'symbol': 'PI_XBTUSD', 'side': 'buy', 'size': 100, 'limitPrice': 43000}
After submission, the API returns an order ID, which you can use to monitor execution. To check active orders, use the openorders endpoint. To cancel an order, send a request to cancelorder with the order ID.
Monitoring Positions and Account Data
Real-time position tracking is essential for risk management. The positions endpoint returns all open futures positions:
- https://futures.kraken.com/derivatives/api/v3/positionsThe response includes entry price, current mark price, PNL (profit and loss), and liquidation price.
Account-level data, such as available margin, collateral balance, and leverage settings, can be retrieved via the accounts endpoint. This helps ensure you remain within safe margin thresholds. You can also adjust leverage for specific contracts using the setleverage endpoint, specifying the symbol and desired leverage value (e.g., 5x, 10x).
Using WebSocket for Real-Time Updates
For high-frequency trading or real-time monitoring, the Kraken Futures WebSocket API is more efficient than polling REST endpoints. Connect to:
- wss://futures.kraken.com/ws/v1
After connecting, subscribe to channels such as:
- ticker: real-time price updates
- book: order book changes
- executions: your trade fills
- positions: updates to your open positions
Each subscription requires a JSON payload. For example, to subscribe to the PI_XBTUSD ticker:
{ 'event': 'subscribe', 'feed': 'ticker', 'product_ids': ['PI_XBTUSD']}
Messages are pushed in real time, reducing latency. WebSocket connections must be authenticated if accessing private data. This involves sending a login message with your API key, nonce, and signed token.
Frequently Asked Questions
Is the Kraken spot API compatible with futures trading?No. The Kraken spot API (api.kraken.com) does not support futures contracts. You must use the futures.kraken.com endpoints with a separately generated API key from the Kraken Futures platform.
What is the difference between PI_XBTUSD and PF_EURUSD contracts?PI_XBTUSD is an inverse perpetual contract denominated in Bitcoin, meaning PNL is settled in BTC. PF_EURUSD is a fiat-margined perpetual contract, where collateral and PNL are in USD, providing stable-value exposure.
Can I use the same API key for multiple strategies?Yes, but it’s recommended to create separate API keys for different bots or strategies. This enhances security and allows granular permission control, such as restricting one key to read-only access.
How often is funding paid on perpetual contracts?Funding is exchanged every 8 hours at 00:00 UTC, 08:00 UTC, and 16:00 UTC. The rate depends on the premium between the perpetual contract price and the underlying index. Long positions pay short positions if the rate is positive, and vice versa.
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, XRP, and Crypto Signals: Navigating the Current Landscape
- 2025-09-10 10:45:12
- ApeCoin Moonshot: What Crypto Traders Need to Know Now!
- 2025-09-10 10:25:14
- MYX Airdrop Alert: Synchronized Wave of Claimed Addresses – What's the Deal?
- 2025-09-10 10:25:14
- Bitget Wallet, USDC Yield, and Aave: A New Era for Crypto Savings?
- 2025-09-10 10:45:12
- XRP Price Eyes $5, MAGACOIN Finance Sparks Pair Trade Buzz: A New York Minute on Crypto
- 2025-09-10 10:50:12
- Cloud Mining, Stability, and the Crypto Market: Navigating Uncertainty in 2025
- 2025-09-10 10:50:12
Related knowledge

How to learn smart contract development?
Sep 09,2025 at 02:18am
Understanding the Foundation of Smart Contracts1. Smart contract development begins with a solid understanding of what smart contracts are—self-execut...

How to set both stop loss and take profit at the same time?
Sep 06,2025 at 04:36pm
Understanding Simultaneous Stop Loss and Take Profit Orders1. Placing both stop loss and take profit orders at the same time is a standard practice in...

What is copy trading for crypto futures?
Sep 07,2025 at 02:00am
What Is Copy Trading in Crypto Futures?1. Copy trading in crypto futures allows investors to automatically replicate the trades of experienced traders...

What are the best indicators for day trading crypto futures?
Sep 08,2025 at 10:18am
Top Technical Indicators for Crypto Futures Day Trading1. The Relative Strength Index (RSI) is widely used to identify overbought or oversold conditio...

How to use the MACD indicator for futures?
Sep 07,2025 at 09:00pm
Understanding the MACD Indicator in Futures Trading1. The MACD (Moving Average Convergence Divergence) indicator is a momentum oscillator widely used ...

What to do if you are about to be liquidated?
Sep 06,2025 at 01:00am
Understanding Liquidation in the Crypto Market1. Liquidation occurs when a trader’s margin balance falls below the required maintenance margin, forcin...

How to learn smart contract development?
Sep 09,2025 at 02:18am
Understanding the Foundation of Smart Contracts1. Smart contract development begins with a solid understanding of what smart contracts are—self-execut...

How to set both stop loss and take profit at the same time?
Sep 06,2025 at 04:36pm
Understanding Simultaneous Stop Loss and Take Profit Orders1. Placing both stop loss and take profit orders at the same time is a standard practice in...

What is copy trading for crypto futures?
Sep 07,2025 at 02:00am
What Is Copy Trading in Crypto Futures?1. Copy trading in crypto futures allows investors to automatically replicate the trades of experienced traders...

What are the best indicators for day trading crypto futures?
Sep 08,2025 at 10:18am
Top Technical Indicators for Crypto Futures Day Trading1. The Relative Strength Index (RSI) is widely used to identify overbought or oversold conditio...

How to use the MACD indicator for futures?
Sep 07,2025 at 09:00pm
Understanding the MACD Indicator in Futures Trading1. The MACD (Moving Average Convergence Divergence) indicator is a momentum oscillator widely used ...

What to do if you are about to be liquidated?
Sep 06,2025 at 01:00am
Understanding Liquidation in the Crypto Market1. Liquidation occurs when a trader’s margin balance falls below the required maintenance margin, forcin...
See all articles
