Skip to main content

Kraken SDK

Tribulnation SDK implementation for Kraken.

Installation

pip install tribulnation-kraken

Surfaces

Surface Class Credentials
Earn tribulnation.kraken.Earn keyed — Earn/Strategies needs an API key
Market tribulnation.kraken.KrakenMarket public for market data, keyed for balances, orders and fills
Report tribulnation.kraken.Report keyed
Wallet tribulnation.kraken.Wallet keyed
from tribulnation.kraken import KrakenMarket

async with KrakenMarket.new(public=True) as kraken:
  book = await kraken.depth('spot:XBTUSD', levels=5)
  print(book.best_bid, book.best_ask)

Spot and linear perpetuals are available through spot and perp exchanges. For example, await kraken.depth('perp:PF_XBTUSD', levels=5) reads the Futures book. Perpetuals serve public data without a key; with a Futures API key (separate from Spot keys: futures_api_key/futures_private_key, or KRAKEN_FUTURES_API_KEY/ KRAKEN_FUTURES_PRIVATE_KEY) they also trade: orders (lmt, post, ioc, batches, in-place edits), positions, the multi-collateral pool, leverage, fees, own fills and funding payments, and the WebSocket book and fills feeds.

async with KrakenMarket.new(futures_api_key=..., futures_private_key=...) as kraken:
  market = await kraken.perp_market('perp:PF_POPCATUSD')
  order = await market.place_order(
    {'type': 'POST_ONLY', 'qty': -1000, 'price': '0.0280'}
  )

Spot trades with the Spot API key (api_key/private_key, or KRAKEN_API_KEY/ KRAKEN_PRIVATE_KEY): REST limit orders (LIMIT GTC, POST_ONLY with the post flag, MARKET as an IOC limit at price), in-place amends, cancels, open and queried orders, balances() and the Spot collateral IDs (kraken:spot:ZUSD), and the executions fills stream. Spot and perpetuals can share one account with both key pairs, for a Spot/perpetual carry on Kraken:

async with KrakenMarket.new(
  api_key=..., private_key=..., futures_api_key=..., futures_private_key=...
) as kraken:
  spot = await kraken.spot_market('spot:KAVAUSD')
  await spot.place_order({'type': 'POST_ONLY', 'qty': 500, 'price': '0.0790'})
  print(await spot.balances(), await spot.collateral_ids())

The kraken_testnet venue is the Futures demo environment (perpetuals only). Spot has no testnet.

Identifiers

Assets are Kraken's internal ids — XXBT, XETH, ZUSD, USDC, SOL — the spelling Balance, Ledgers, TradesHistory and WithdrawMethods all answer in. Earn/Strategies names assets by display name (BTC) and is re-keyed to the same internal ids through the venue's own Assets listing, which carries the same altname under both spellings. Spot markets are the REST pair altname (XBTUSD, ETHUSDC): the form every pair= argument and account row uses, joined internally to the WebSocket v2 symbol (BTC/USD) for streams.

Perpetual market IDs retain the instrument symbol (PF_XBTUSD, PF_ETHUSD). The supported set is non-tradfi USD flexible_futures with unit contract size, joined to active perpetual tickers. Kraken includes some tokenized assets in that set.

Perpetual quantities are already base units. Historical funding uses Kraken's relative rate and maps period start to settlement time by adding one hour. Funding bounds are inclusive; an omitted start reads all retained rows. The latest period may settle later.

Gaps

  • Spot Market.candles: Kraken documents a window of 720 recent candles per interval; BTC/ETH probes returned 721 rows including the current interval. since cannot retrieve older history, so archive backfill requires separate ingestion.
  • Perpetual candles use bounded requests of 2000 possible opens, preserving aware half-open bounds and missing periods. Older availability depends on the market; the API is not a complete archive guarantee. Standard fees and maximum order size remain unknown.
  • Perpetual trades_history reads REST fills, which carry no fee; trades_stream fills carry theirs. Isolated-margin buckets (perp_collateral of a market with a leverage preference) are not supported.
  • Wallet.deposit_methods: DepositMethods answers a method name per asset and no network field, so there is no network to report.
  • Earn: apr is the midpoint of Kraken's low/high estimate and min_qty is never set, because Kraken quotes the minimum allocation in USD rather than in the asset.

Metadata

Release files for tribulnation-kraken 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tribulnation-kraken 0.9.0
File Size Uploaded Provenance Actions
tribulnation_kraken-0.9.0.tar.gz 41.5 kB With provenance Details for tribulnation_kraken-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tribulnation-kraken 0.9.0
File Interpreter ABI Platform Actions
tribulnation_kraken-0.9.0-py3-none-any.whl Python 3 none any Details for tribulnation_kraken-0.9.0-py3-none-any.whl

Total release size: 97.6 kB

Release files / tribulnation_kraken-0.9.0.tar.gz

Download URL tribulnation_kraken-0.9.0.tar.gz
Size 41.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d2e46150f507c8099cabd64959181afc2559ad2cf56cdd6287667a95a50992c2
BLAKE2b-256 checksum
How to use checksums
1cce7f9a8670120611facff24689fe93a751c216359273d5f47caee8224f4691
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / tribulnation_kraken-0.9.0-py3-none-any.whl

Download URL tribulnation_kraken-0.9.0-py3-none-any.whl
Size 56.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38962947834300cbeaeed88cb7a21d173d4e5e008daa5dc833971dfb2d594cfb
BLAKE2b-256 checksum
How to use checksums
9f4698047632ad45f396d5aba24b763adbaf0bc678f3a963c1bcdd5410b29045
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for tribulnation-kraken 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tribulnation_kraken-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page