From 729f278e370ab9dc5195ee60df558a10fb987ed3 Mon Sep 17 00:00:00 2001 From: Claude Enriquez <185819186+claudeenriquez@users.noreply.github.com> Date: Fri, 5 Sep 2025 10:11:49 +0000 Subject: [PATCH] feat: add license and openapi spec files --- .github/dependabot.yml | 17 + .github/workflows/api-specs.yml | 25 + .github/workflows/email-check.yml | 45 + LICENSE | 21 + README.md | 80 +- futures-rest/auth/api-public.yml | 1104 +++ futures-rest/charts/api-public.yml | 708 ++ futures-rest/history/_parameters.yml | 263 + futures-rest/history/_responses.yml | 50 + futures-rest/history/_schemas.yml | 244 + futures-rest/history/api-public.yml | 1172 ++++ futures-rest/stats/public.yml | 234 + futures-rest/trading/_parameters.yml | 116 + futures-rest/trading/_responses.yml | 54 + futures-rest/trading/_schemas.yml | 526 ++ futures-rest/trading/public.yml | 5955 +++++++++++++++++ oauth/openapi_v3.yaml | 562 ++ .../responses/errors/internalError.yaml | 7 + .../responses/errors/invalidApiKey.yaml | 7 + .../responses/errors/invalidApiNonce.yaml | 7 + .../responses/errors/invalidApiSignature.yaml | 7 + otc/openapi_v3.yaml | 247 + otc/partials/properties/nonce.yaml | 3 + otc/partials/responses/200.yaml | 8 + otc/partials/responses/401.yaml | 12 + otc/partials/responses/500.yaml | 7 + otc/schemas/objects/errors/error.yaml | 19 + otc/schemas/objects/errors/validation.yaml | 10 + otc/schemas/objects/otc/active-quote.yaml | 25 + otc/schemas/objects/otc/decimals.yaml | 4 + otc/schemas/objects/otc/historical-quote.yaml | 59 + otc/schemas/objects/otc/quote-props.yaml | 42 + .../requests/otc/check-otc-client.yaml | 14 + .../otc/create-otc-quote-request.yaml | 38 + .../requests/otc/get-otc-active-quotes.yaml | 18 + .../requests/otc/get-otc-exposures.yaml | 10 + .../otc/get-otc-historical-quotes.yaml | 11 + otc/schemas/requests/otc/get-otc-pairs.yaml | 9 + .../requests/otc/update-otc-quote.yaml | 23 + otc/schemas/responses/200.yaml | 9 + otc/schemas/responses/400.yaml | 10 + otc/schemas/responses/401.yaml | 8 + otc/schemas/responses/404.yaml | 8 + otc/schemas/responses/500.yaml | 6 + .../responses/otc/check-otc-client.yaml | 21 + .../otc/create-otc-quote-request.yaml | 27 + .../responses/otc/get-otc-active-quotes.yaml | 13 + .../responses/otc/get-otc-exposures.yaml | 34 + .../otc/get-otc-historical-quotes.yaml | 13 + otc/schemas/responses/otc/get-otc-pairs.yaml | 69 + .../responses/otc/update-otc-quote.yaml | 16 + pay/openapi_v3.yaml | 224 + pay/partials/properties/external_id.yaml | 3 + .../requests/paylink/createPaylinkCode.yaml | 25 + .../requests/paylink/getPaylinkCode.yaml | 10 + .../requests/paylink/getPaylinkConfig.yaml | 7 + .../requests/request/cancelPayRequest.yaml | 10 + .../requests/request/createPayRequest.yaml | 35 + .../requests/transfer/cancelPayTransfer.yaml | 10 + .../requests/transfer/createPayTransfer.yaml | 29 + .../responses/paylink/createPaylinkCode.yaml | 30 + .../responses/paylink/getPaylinkCode.yaml | 37 + .../responses/paylink/getPaylinkConfig.yaml | 38 + .../responses/request/cancelPayRequest.yaml | 30 + .../responses/request/createPayRequest.yaml | 35 + .../responses/transfer/cancelPayTransfer.yaml | 30 + .../responses/transfer/createPayTransfer.yaml | 30 + .../requests/funding/deposits/addresses.yaml | 50 + .../requests/funding/deposits/methods.yaml | 46 + .../requests/funding/deposits/recent.yaml | 47 + .../funding/withdrawals/addresses.yaml | 35 + .../requests/funding/withdrawals/info.yaml | 40 + .../requests/funding/withdrawals/methods.yaml | 35 + .../requests/funding/withdrawals/recent.yaml | 35 + .../funding/withdrawals/withdraw.yaml | 39 + .../examples/requests/public/assets/info.yaml | 19 + .../requests/public/assets/pairs.yaml | 19 + spot-rest/examples/requests/public/depth.yaml | 19 + spot-rest/examples/requests/public/ohlc.yaml | 19 + .../examples/requests/public/spread.yaml | 19 + .../examples/requests/public/ticker.yaml | 19 + spot-rest/examples/requests/public/time.yaml | 22 + .../examples/requests/public/trades.yaml | 19 + .../examples/requests/trading/orders/add.yaml | 9 + .../requests/trading/orders/add_example.yaml | 7 + .../requests/trading/orders/batchadd.yaml | 130 + .../requests/trading/orders/batchcancel.yaml | 52 + .../requests/trading/orders/cancel.yaml | 46 + .../requests/trading/orders/edit.yaml | 70 + .../requests/user/account/balance.yaml | 42 + .../requests/user/account/balanceex.yaml | 42 + .../examples/requests/user/ledgers/info.yaml | 44 + .../examples/requests/user/ledgers/query.yaml | 43 + .../examples/requests/user/orders/closed.yaml | 43 + .../examples/requests/user/orders/open.yaml | 43 + .../examples/requests/user/orders/query.yaml | 44 + .../requests/user/trades/balance.yaml | 43 + .../requests/user/trades/history.yaml | 42 + .../examples/requests/user/trades/query.yaml | 43 + .../examples/requests/user/trades/volume.yaml | 43 + .../responses/errors/internalError.yaml | 7 + .../responses/errors/invalidApiKey.yaml | 7 + .../responses/errors/invalidApiNonce.yaml | 7 + .../responses/errors/invalidApiSignature.yaml | 7 + .../responses/funding/deposits/addresses.yaml | 17 + .../responses/funding/deposits/methods.yaml | 11 + .../responses/funding/deposits/recent.yaml | 24 + .../responses/public/assets/info.yaml | 163 + .../responses/public/assets/pairs.yaml | 140 + .../examples/responses/public/depth.yaml | 17 + spot-rest/examples/responses/public/ohlc.yaml | 20 + .../examples/responses/public/spread.yaml | 14 + .../examples/responses/public/ticker.yaml | 30 + spot-rest/examples/responses/public/time.yaml | 4 + .../examples/responses/public/trades.yaml | 16 + .../responses/trading/orders/add.yaml | 1 + .../responses/trading/orders/batchadd.yaml | 1 + .../responses/trading/orders/batchcancel.yaml | 3 + .../responses/trading/orders/cancel.yaml | 3 + .../responses/trading/orders/edit.yaml | 1 + .../responses/user/account/balance.yaml | 10 + .../examples/responses/user/ledgers/info.yaml | 40 + .../responses/user/ledgers/query.yaml | 20 + .../responses/user/orders/closed.yaml | 85 + .../examples/responses/user/orders/open.yaml | 19 + .../examples/responses/user/orders/query.yaml | 54 + .../responses/user/trades/balance.yaml | 10 + .../responses/user/trades/history.yaml | 52 + .../examples/responses/user/trades/query.yaml | 28 + .../responses/user/trades/volume.yaml | 20 + spot-rest/openapi_v3.yaml | 3675 ++++++++++ .../partials/parameters/query/aclass.yaml | 12 + .../partials/parameters/query/asset.yaml | 6 + .../parameters/query/asset_class.yaml | 8 + spot-rest/partials/parameters/query/pair.yaml | 7 + .../partials/parameters/query/user_iiban.yaml | 9 + .../parameters/query/wildcard_pair.yaml | 7 + spot-rest/partials/properties/nonce.yaml | 3 + spot-rest/partials/properties/oflags.yaml | 11 + spot-rest/partials/properties/ordertype.yaml | 15 + .../properties/rebase_multiplier.yaml | 10 + spot-rest/partials/responses/200.yaml | 8 + spot-rest/partials/responses/401.yaml | 12 + spot-rest/partials/responses/500.yaml | 7 + .../requests/funding/deposits/addresses.yaml | 50 + .../requests/funding/deposits/methods.yaml | 46 + .../requests/funding/deposits/recent.yaml | 47 + .../funding/withdrawals/addresses.yaml | 35 + .../requests/funding/withdrawals/info.yaml | 40 + .../requests/funding/withdrawals/methods.yaml | 35 + .../requests/funding/withdrawals/recent.yaml | 35 + .../funding/withdrawals/withdraw.yaml | 39 + spot-rest/requests/public/assets/info.yaml | 19 + spot-rest/requests/public/assets/pairs.yaml | 19 + spot-rest/requests/public/depth.yaml | 19 + spot-rest/requests/public/ohlc.yaml | 19 + spot-rest/requests/public/spread.yaml | 19 + spot-rest/requests/public/ticker.yaml | 19 + spot-rest/requests/public/time.yaml | 22 + spot-rest/requests/public/trades.yaml | 19 + spot-rest/requests/trading/orders/add.yaml | 9 + .../requests/trading/orders/add_example.yaml | 7 + .../requests/trading/orders/batchadd.yaml | 130 + .../requests/trading/orders/batchcancel.yaml | 52 + spot-rest/requests/trading/orders/cancel.yaml | 46 + spot-rest/requests/trading/orders/edit.yaml | 70 + spot-rest/requests/user/account/balance.yaml | 42 + .../requests/user/account/balanceex.yaml | 42 + spot-rest/requests/user/ledgers/info.yaml | 44 + spot-rest/requests/user/ledgers/query.yaml | 43 + spot-rest/requests/user/orders/closed.yaml | 43 + spot-rest/requests/user/orders/open.yaml | 43 + spot-rest/requests/user/orders/query.yaml | 44 + spot-rest/requests/user/trades/balance.yaml | 43 + spot-rest/requests/user/trades/history.yaml | 42 + spot-rest/requests/user/trades/query.yaml | 43 + spot-rest/requests/user/trades/volume.yaml | 43 + spot-rest/responses/errors/internalError.yaml | 7 + spot-rest/responses/errors/invalidApiKey.yaml | 7 + .../responses/errors/invalidApiNonce.yaml | 7 + .../responses/errors/invalidApiSignature.yaml | 7 + .../responses/funding/deposits/addresses.yaml | 17 + .../responses/funding/deposits/methods.yaml | 11 + .../responses/funding/deposits/recent.yaml | 24 + spot-rest/responses/public/assets/info.yaml | 163 + spot-rest/responses/public/assets/pairs.yaml | 140 + spot-rest/responses/public/depth.yaml | 17 + spot-rest/responses/public/ohlc.yaml | 20 + spot-rest/responses/public/spread.yaml | 14 + spot-rest/responses/public/ticker.yaml | 30 + spot-rest/responses/public/time.yaml | 4 + spot-rest/responses/public/trades.yaml | 16 + spot-rest/responses/trading/orders/add.yaml | 1 + .../responses/trading/orders/batchadd.yaml | 1 + .../responses/trading/orders/batchcancel.yaml | 3 + .../responses/trading/orders/cancel.yaml | 3 + spot-rest/responses/trading/orders/edit.yaml | 1 + spot-rest/responses/user/account/balance.yaml | 10 + spot-rest/responses/user/ledgers/info.yaml | 40 + spot-rest/responses/user/ledgers/query.yaml | 20 + spot-rest/responses/user/orders/closed.yaml | 85 + spot-rest/responses/user/orders/open.yaml | 19 + spot-rest/responses/user/orders/query.yaml | 54 + spot-rest/responses/user/trades/balance.yaml | 10 + spot-rest/responses/user/trades/history.yaml | 52 + spot-rest/responses/user/trades/query.yaml | 28 + spot-rest/responses/user/trades/volume.yaml | 20 + spot-rest/schemas/objects/errors/error.yaml | 19 + .../schemas/objects/errors/validation.yaml | 10 + .../objects/funding/deposits/address.yaml | 16 + .../objects/funding/deposits/deposit.yaml | 50 + .../objects/funding/deposits/method.yaml | 21 + .../funding/withdrawals/withdrawal.yaml | 63 + .../schemas/objects/public/assets/info.yaml | 24 + .../schemas/objects/public/assets/pairs.yaml | 90 + .../objects/public/orderBookEntry.yaml | 38 + spot-rest/schemas/objects/public/spread.yaml | 17 + .../schemas/objects/public/tickData.yaml | 24 + spot-rest/schemas/objects/public/ticker.yaml | 47 + spot-rest/schemas/objects/public/trade.yaml | 21 + .../schemas/objects/user/account/balance.yaml | 38 + .../objects/user/account/balanceex.yaml | 20 + .../user/account/creditlines-asset.yaml | 20 + .../user/account/creditlines-monitor.yaml | 34 + .../objects/user/account/creditlines.yaml | 13 + .../schemas/objects/user/ledgers/ledger.yaml | 56 + .../schemas/objects/user/orders/closed.yaml | 159 + .../schemas/objects/user/orders/open.yaml | 129 + .../schemas/objects/user/orders/order.yaml | 78 + .../schemas/objects/user/staking/asset.yaml | 74 + .../schemas/objects/user/staking/lock.yaml | 13 + .../objects/user/staking/transaction.yaml | 37 + .../schemas/objects/user/trades/balance.yaml | 44 + .../schemas/objects/user/trades/history.yaml | 14 + .../schemas/objects/user/trades/trade.yaml | 101 + .../schemas/objects/user/volume/fees.yaml | 25 + .../requests/funding/deposits/addresses.yaml | 36 + .../requests/funding/deposits/methods.yaml | 18 + .../requests/funding/deposits/recent.yaml | 43 + .../funding/withdrawals/addresses.yaml | 25 + .../requests/funding/withdrawals/cancel.yaml | 23 + .../requests/funding/withdrawals/info.yaml | 27 + .../requests/funding/withdrawals/methods.yaml | 19 + .../requests/funding/withdrawals/recent.yaml | 42 + .../funding/withdrawals/withdrawal.yaml | 48 + spot-rest/schemas/requests/nonceOnly.yaml | 12 + .../schemas/requests/trading/orders/add.yaml | 178 + .../requests/trading/orders/amend.yaml | 50 + .../requests/trading/orders/batchadd.yaml | 189 + .../requests/trading/orders/batchcancel.yaml | 30 + .../requests/trading/orders/cancel.yaml | 21 + .../schemas/requests/trading/orders/edit.yaml | 83 + .../schemas/requests/user/closedOrders.yaml | 56 + .../schemas/requests/user/ledgers/info.yaml | 61 + .../schemas/requests/user/ledgers/query.yaml | 25 + .../schemas/requests/user/openOrders.yaml | 29 + .../schemas/requests/user/orders/amends.yaml | 16 + .../schemas/requests/user/orders/query.yaml | 25 + .../schemas/requests/user/ordersInfo.yaml | 25 + .../schemas/requests/user/trades/balance.yaml | 21 + .../schemas/requests/user/trades/history.yaml | 53 + .../schemas/requests/user/trades/query.yaml | 25 + .../schemas/requests/user/trades/volume.yaml | 19 + spot-rest/schemas/responses/200.yaml | 9 + spot-rest/schemas/responses/400.yaml | 10 + spot-rest/schemas/responses/401.yaml | 8 + spot-rest/schemas/responses/404.yaml | 8 + spot-rest/schemas/responses/500.yaml | 6 + .../responses/funding/deposits/addresses.yaml | 10 + .../responses/funding/deposits/methods.yaml | 10 + .../responses/funding/deposits/recent.yaml | 15 + .../funding/withdrawals/addresses.yaml | 43 + .../responses/funding/withdrawals/info.yaml | 32 + .../funding/withdrawals/methods.yaml | 42 + .../responses/funding/withdrawals/recent.yaml | 9 + .../funding/withdrawals/withdrawal.yaml | 15 + .../schemas/responses/public/assets/info.yaml | 9 + spot-rest/schemas/responses/public/depth.yaml | 9 + spot-rest/schemas/responses/public/ohlc.yaml | 13 + .../schemas/responses/public/spread.yaml | 13 + .../schemas/responses/public/ticker.yaml | 28 + spot-rest/schemas/responses/public/time.yaml | 15 + .../schemas/responses/public/trades.yaml | 13 + .../schemas/responses/trading/orders/add.yaml | 29 + .../responses/trading/orders/amend.yaml | 23 + .../responses/trading/orders/batchadd.yaml | 56 + .../responses/trading/orders/batchcancel.yaml | 14 + .../responses/trading/orders/cancel.yaml | 19 + .../responses/trading/orders/edit.yaml | 71 + .../responses/user/account/balance.yaml | 6 + .../responses/user/account/balanceex.yaml | 12 + .../responses/user/account/creditlines.yaml | 7 + .../schemas/responses/user/ledgers/info.yaml | 17 + .../schemas/responses/user/ledgers/query.yaml | 9 + .../schemas/responses/user/orders/amends.yaml | 53 + .../schemas/responses/user/orders/closed.yaml | 17 + .../schemas/responses/user/orders/open.yaml | 14 + .../schemas/responses/user/orders/query.yaml | 11 + .../responses/user/trades/balance.yaml | 6 + .../responses/user/trades/history.yaml | 6 + .../schemas/responses/user/trades/volume.yaml | 27 + 301 files changed, 23774 insertions(+), 2 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/api-specs.yml create mode 100644 .github/workflows/email-check.yml create mode 100644 LICENSE create mode 100644 futures-rest/auth/api-public.yml create mode 100644 futures-rest/charts/api-public.yml create mode 100644 futures-rest/history/_parameters.yml create mode 100644 futures-rest/history/_responses.yml create mode 100644 futures-rest/history/_schemas.yml create mode 100644 futures-rest/history/api-public.yml create mode 100644 futures-rest/stats/public.yml create mode 100644 futures-rest/trading/_parameters.yml create mode 100644 futures-rest/trading/_responses.yml create mode 100644 futures-rest/trading/_schemas.yml create mode 100644 futures-rest/trading/public.yml create mode 100644 oauth/openapi_v3.yaml create mode 100644 otc/examples/responses/errors/internalError.yaml create mode 100644 otc/examples/responses/errors/invalidApiKey.yaml create mode 100644 otc/examples/responses/errors/invalidApiNonce.yaml create mode 100644 otc/examples/responses/errors/invalidApiSignature.yaml create mode 100644 otc/openapi_v3.yaml create mode 100644 otc/partials/properties/nonce.yaml create mode 100644 otc/partials/responses/200.yaml create mode 100644 otc/partials/responses/401.yaml create mode 100644 otc/partials/responses/500.yaml create mode 100644 otc/schemas/objects/errors/error.yaml create mode 100644 otc/schemas/objects/errors/validation.yaml create mode 100644 otc/schemas/objects/otc/active-quote.yaml create mode 100644 otc/schemas/objects/otc/decimals.yaml create mode 100644 otc/schemas/objects/otc/historical-quote.yaml create mode 100644 otc/schemas/objects/otc/quote-props.yaml create mode 100644 otc/schemas/requests/otc/check-otc-client.yaml create mode 100644 otc/schemas/requests/otc/create-otc-quote-request.yaml create mode 100644 otc/schemas/requests/otc/get-otc-active-quotes.yaml create mode 100644 otc/schemas/requests/otc/get-otc-exposures.yaml create mode 100644 otc/schemas/requests/otc/get-otc-historical-quotes.yaml create mode 100644 otc/schemas/requests/otc/get-otc-pairs.yaml create mode 100644 otc/schemas/requests/otc/update-otc-quote.yaml create mode 100644 otc/schemas/responses/200.yaml create mode 100644 otc/schemas/responses/400.yaml create mode 100644 otc/schemas/responses/401.yaml create mode 100644 otc/schemas/responses/404.yaml create mode 100644 otc/schemas/responses/500.yaml create mode 100644 otc/schemas/responses/otc/check-otc-client.yaml create mode 100644 otc/schemas/responses/otc/create-otc-quote-request.yaml create mode 100644 otc/schemas/responses/otc/get-otc-active-quotes.yaml create mode 100644 otc/schemas/responses/otc/get-otc-exposures.yaml create mode 100644 otc/schemas/responses/otc/get-otc-historical-quotes.yaml create mode 100644 otc/schemas/responses/otc/get-otc-pairs.yaml create mode 100644 otc/schemas/responses/otc/update-otc-quote.yaml create mode 100644 pay/openapi_v3.yaml create mode 100644 pay/partials/properties/external_id.yaml create mode 100644 pay/schemas/requests/paylink/createPaylinkCode.yaml create mode 100644 pay/schemas/requests/paylink/getPaylinkCode.yaml create mode 100644 pay/schemas/requests/paylink/getPaylinkConfig.yaml create mode 100644 pay/schemas/requests/request/cancelPayRequest.yaml create mode 100644 pay/schemas/requests/request/createPayRequest.yaml create mode 100644 pay/schemas/requests/transfer/cancelPayTransfer.yaml create mode 100644 pay/schemas/requests/transfer/createPayTransfer.yaml create mode 100644 pay/schemas/responses/paylink/createPaylinkCode.yaml create mode 100644 pay/schemas/responses/paylink/getPaylinkCode.yaml create mode 100644 pay/schemas/responses/paylink/getPaylinkConfig.yaml create mode 100644 pay/schemas/responses/request/cancelPayRequest.yaml create mode 100644 pay/schemas/responses/request/createPayRequest.yaml create mode 100644 pay/schemas/responses/transfer/cancelPayTransfer.yaml create mode 100644 pay/schemas/responses/transfer/createPayTransfer.yaml create mode 100644 spot-rest/examples/requests/funding/deposits/addresses.yaml create mode 100644 spot-rest/examples/requests/funding/deposits/methods.yaml create mode 100644 spot-rest/examples/requests/funding/deposits/recent.yaml create mode 100644 spot-rest/examples/requests/funding/withdrawals/addresses.yaml create mode 100644 spot-rest/examples/requests/funding/withdrawals/info.yaml create mode 100644 spot-rest/examples/requests/funding/withdrawals/methods.yaml create mode 100644 spot-rest/examples/requests/funding/withdrawals/recent.yaml create mode 100644 spot-rest/examples/requests/funding/withdrawals/withdraw.yaml create mode 100644 spot-rest/examples/requests/public/assets/info.yaml create mode 100644 spot-rest/examples/requests/public/assets/pairs.yaml create mode 100644 spot-rest/examples/requests/public/depth.yaml create mode 100644 spot-rest/examples/requests/public/ohlc.yaml create mode 100644 spot-rest/examples/requests/public/spread.yaml create mode 100644 spot-rest/examples/requests/public/ticker.yaml create mode 100644 spot-rest/examples/requests/public/time.yaml create mode 100644 spot-rest/examples/requests/public/trades.yaml create mode 100644 spot-rest/examples/requests/trading/orders/add.yaml create mode 100644 spot-rest/examples/requests/trading/orders/add_example.yaml create mode 100644 spot-rest/examples/requests/trading/orders/batchadd.yaml create mode 100644 spot-rest/examples/requests/trading/orders/batchcancel.yaml create mode 100644 spot-rest/examples/requests/trading/orders/cancel.yaml create mode 100644 spot-rest/examples/requests/trading/orders/edit.yaml create mode 100644 spot-rest/examples/requests/user/account/balance.yaml create mode 100644 spot-rest/examples/requests/user/account/balanceex.yaml create mode 100644 spot-rest/examples/requests/user/ledgers/info.yaml create mode 100644 spot-rest/examples/requests/user/ledgers/query.yaml create mode 100644 spot-rest/examples/requests/user/orders/closed.yaml create mode 100644 spot-rest/examples/requests/user/orders/open.yaml create mode 100644 spot-rest/examples/requests/user/orders/query.yaml create mode 100644 spot-rest/examples/requests/user/trades/balance.yaml create mode 100644 spot-rest/examples/requests/user/trades/history.yaml create mode 100644 spot-rest/examples/requests/user/trades/query.yaml create mode 100644 spot-rest/examples/requests/user/trades/volume.yaml create mode 100644 spot-rest/examples/responses/errors/internalError.yaml create mode 100644 spot-rest/examples/responses/errors/invalidApiKey.yaml create mode 100644 spot-rest/examples/responses/errors/invalidApiNonce.yaml create mode 100644 spot-rest/examples/responses/errors/invalidApiSignature.yaml create mode 100644 spot-rest/examples/responses/funding/deposits/addresses.yaml create mode 100644 spot-rest/examples/responses/funding/deposits/methods.yaml create mode 100644 spot-rest/examples/responses/funding/deposits/recent.yaml create mode 100644 spot-rest/examples/responses/public/assets/info.yaml create mode 100644 spot-rest/examples/responses/public/assets/pairs.yaml create mode 100644 spot-rest/examples/responses/public/depth.yaml create mode 100644 spot-rest/examples/responses/public/ohlc.yaml create mode 100644 spot-rest/examples/responses/public/spread.yaml create mode 100644 spot-rest/examples/responses/public/ticker.yaml create mode 100644 spot-rest/examples/responses/public/time.yaml create mode 100644 spot-rest/examples/responses/public/trades.yaml create mode 100644 spot-rest/examples/responses/trading/orders/add.yaml create mode 100644 spot-rest/examples/responses/trading/orders/batchadd.yaml create mode 100644 spot-rest/examples/responses/trading/orders/batchcancel.yaml create mode 100644 spot-rest/examples/responses/trading/orders/cancel.yaml create mode 100644 spot-rest/examples/responses/trading/orders/edit.yaml create mode 100644 spot-rest/examples/responses/user/account/balance.yaml create mode 100644 spot-rest/examples/responses/user/ledgers/info.yaml create mode 100644 spot-rest/examples/responses/user/ledgers/query.yaml create mode 100644 spot-rest/examples/responses/user/orders/closed.yaml create mode 100644 spot-rest/examples/responses/user/orders/open.yaml create mode 100644 spot-rest/examples/responses/user/orders/query.yaml create mode 100644 spot-rest/examples/responses/user/trades/balance.yaml create mode 100644 spot-rest/examples/responses/user/trades/history.yaml create mode 100644 spot-rest/examples/responses/user/trades/query.yaml create mode 100644 spot-rest/examples/responses/user/trades/volume.yaml create mode 100644 spot-rest/openapi_v3.yaml create mode 100644 spot-rest/partials/parameters/query/aclass.yaml create mode 100644 spot-rest/partials/parameters/query/asset.yaml create mode 100644 spot-rest/partials/parameters/query/asset_class.yaml create mode 100644 spot-rest/partials/parameters/query/pair.yaml create mode 100644 spot-rest/partials/parameters/query/user_iiban.yaml create mode 100644 spot-rest/partials/parameters/query/wildcard_pair.yaml create mode 100644 spot-rest/partials/properties/nonce.yaml create mode 100644 spot-rest/partials/properties/oflags.yaml create mode 100644 spot-rest/partials/properties/ordertype.yaml create mode 100644 spot-rest/partials/properties/rebase_multiplier.yaml create mode 100644 spot-rest/partials/responses/200.yaml create mode 100644 spot-rest/partials/responses/401.yaml create mode 100644 spot-rest/partials/responses/500.yaml create mode 100644 spot-rest/requests/funding/deposits/addresses.yaml create mode 100644 spot-rest/requests/funding/deposits/methods.yaml create mode 100644 spot-rest/requests/funding/deposits/recent.yaml create mode 100644 spot-rest/requests/funding/withdrawals/addresses.yaml create mode 100644 spot-rest/requests/funding/withdrawals/info.yaml create mode 100644 spot-rest/requests/funding/withdrawals/methods.yaml create mode 100644 spot-rest/requests/funding/withdrawals/recent.yaml create mode 100644 spot-rest/requests/funding/withdrawals/withdraw.yaml create mode 100644 spot-rest/requests/public/assets/info.yaml create mode 100644 spot-rest/requests/public/assets/pairs.yaml create mode 100644 spot-rest/requests/public/depth.yaml create mode 100644 spot-rest/requests/public/ohlc.yaml create mode 100644 spot-rest/requests/public/spread.yaml create mode 100644 spot-rest/requests/public/ticker.yaml create mode 100644 spot-rest/requests/public/time.yaml create mode 100644 spot-rest/requests/public/trades.yaml create mode 100644 spot-rest/requests/trading/orders/add.yaml create mode 100644 spot-rest/requests/trading/orders/add_example.yaml create mode 100644 spot-rest/requests/trading/orders/batchadd.yaml create mode 100644 spot-rest/requests/trading/orders/batchcancel.yaml create mode 100644 spot-rest/requests/trading/orders/cancel.yaml create mode 100644 spot-rest/requests/trading/orders/edit.yaml create mode 100644 spot-rest/requests/user/account/balance.yaml create mode 100644 spot-rest/requests/user/account/balanceex.yaml create mode 100644 spot-rest/requests/user/ledgers/info.yaml create mode 100644 spot-rest/requests/user/ledgers/query.yaml create mode 100644 spot-rest/requests/user/orders/closed.yaml create mode 100644 spot-rest/requests/user/orders/open.yaml create mode 100644 spot-rest/requests/user/orders/query.yaml create mode 100644 spot-rest/requests/user/trades/balance.yaml create mode 100644 spot-rest/requests/user/trades/history.yaml create mode 100644 spot-rest/requests/user/trades/query.yaml create mode 100644 spot-rest/requests/user/trades/volume.yaml create mode 100644 spot-rest/responses/errors/internalError.yaml create mode 100644 spot-rest/responses/errors/invalidApiKey.yaml create mode 100644 spot-rest/responses/errors/invalidApiNonce.yaml create mode 100644 spot-rest/responses/errors/invalidApiSignature.yaml create mode 100644 spot-rest/responses/funding/deposits/addresses.yaml create mode 100644 spot-rest/responses/funding/deposits/methods.yaml create mode 100644 spot-rest/responses/funding/deposits/recent.yaml create mode 100644 spot-rest/responses/public/assets/info.yaml create mode 100644 spot-rest/responses/public/assets/pairs.yaml create mode 100644 spot-rest/responses/public/depth.yaml create mode 100644 spot-rest/responses/public/ohlc.yaml create mode 100644 spot-rest/responses/public/spread.yaml create mode 100644 spot-rest/responses/public/ticker.yaml create mode 100644 spot-rest/responses/public/time.yaml create mode 100644 spot-rest/responses/public/trades.yaml create mode 100644 spot-rest/responses/trading/orders/add.yaml create mode 100644 spot-rest/responses/trading/orders/batchadd.yaml create mode 100644 spot-rest/responses/trading/orders/batchcancel.yaml create mode 100644 spot-rest/responses/trading/orders/cancel.yaml create mode 100644 spot-rest/responses/trading/orders/edit.yaml create mode 100644 spot-rest/responses/user/account/balance.yaml create mode 100644 spot-rest/responses/user/ledgers/info.yaml create mode 100644 spot-rest/responses/user/ledgers/query.yaml create mode 100644 spot-rest/responses/user/orders/closed.yaml create mode 100644 spot-rest/responses/user/orders/open.yaml create mode 100644 spot-rest/responses/user/orders/query.yaml create mode 100644 spot-rest/responses/user/trades/balance.yaml create mode 100644 spot-rest/responses/user/trades/history.yaml create mode 100644 spot-rest/responses/user/trades/query.yaml create mode 100644 spot-rest/responses/user/trades/volume.yaml create mode 100644 spot-rest/schemas/objects/errors/error.yaml create mode 100644 spot-rest/schemas/objects/errors/validation.yaml create mode 100644 spot-rest/schemas/objects/funding/deposits/address.yaml create mode 100644 spot-rest/schemas/objects/funding/deposits/deposit.yaml create mode 100644 spot-rest/schemas/objects/funding/deposits/method.yaml create mode 100644 spot-rest/schemas/objects/funding/withdrawals/withdrawal.yaml create mode 100644 spot-rest/schemas/objects/public/assets/info.yaml create mode 100644 spot-rest/schemas/objects/public/assets/pairs.yaml create mode 100644 spot-rest/schemas/objects/public/orderBookEntry.yaml create mode 100644 spot-rest/schemas/objects/public/spread.yaml create mode 100644 spot-rest/schemas/objects/public/tickData.yaml create mode 100644 spot-rest/schemas/objects/public/ticker.yaml create mode 100644 spot-rest/schemas/objects/public/trade.yaml create mode 100644 spot-rest/schemas/objects/user/account/balance.yaml create mode 100644 spot-rest/schemas/objects/user/account/balanceex.yaml create mode 100644 spot-rest/schemas/objects/user/account/creditlines-asset.yaml create mode 100644 spot-rest/schemas/objects/user/account/creditlines-monitor.yaml create mode 100644 spot-rest/schemas/objects/user/account/creditlines.yaml create mode 100644 spot-rest/schemas/objects/user/ledgers/ledger.yaml create mode 100644 spot-rest/schemas/objects/user/orders/closed.yaml create mode 100644 spot-rest/schemas/objects/user/orders/open.yaml create mode 100644 spot-rest/schemas/objects/user/orders/order.yaml create mode 100644 spot-rest/schemas/objects/user/staking/asset.yaml create mode 100644 spot-rest/schemas/objects/user/staking/lock.yaml create mode 100644 spot-rest/schemas/objects/user/staking/transaction.yaml create mode 100644 spot-rest/schemas/objects/user/trades/balance.yaml create mode 100644 spot-rest/schemas/objects/user/trades/history.yaml create mode 100644 spot-rest/schemas/objects/user/trades/trade.yaml create mode 100644 spot-rest/schemas/objects/user/volume/fees.yaml create mode 100644 spot-rest/schemas/requests/funding/deposits/addresses.yaml create mode 100644 spot-rest/schemas/requests/funding/deposits/methods.yaml create mode 100644 spot-rest/schemas/requests/funding/deposits/recent.yaml create mode 100644 spot-rest/schemas/requests/funding/withdrawals/addresses.yaml create mode 100644 spot-rest/schemas/requests/funding/withdrawals/cancel.yaml create mode 100644 spot-rest/schemas/requests/funding/withdrawals/info.yaml create mode 100644 spot-rest/schemas/requests/funding/withdrawals/methods.yaml create mode 100644 spot-rest/schemas/requests/funding/withdrawals/recent.yaml create mode 100644 spot-rest/schemas/requests/funding/withdrawals/withdrawal.yaml create mode 100644 spot-rest/schemas/requests/nonceOnly.yaml create mode 100644 spot-rest/schemas/requests/trading/orders/add.yaml create mode 100644 spot-rest/schemas/requests/trading/orders/amend.yaml create mode 100644 spot-rest/schemas/requests/trading/orders/batchadd.yaml create mode 100644 spot-rest/schemas/requests/trading/orders/batchcancel.yaml create mode 100644 spot-rest/schemas/requests/trading/orders/cancel.yaml create mode 100644 spot-rest/schemas/requests/trading/orders/edit.yaml create mode 100644 spot-rest/schemas/requests/user/closedOrders.yaml create mode 100644 spot-rest/schemas/requests/user/ledgers/info.yaml create mode 100644 spot-rest/schemas/requests/user/ledgers/query.yaml create mode 100644 spot-rest/schemas/requests/user/openOrders.yaml create mode 100644 spot-rest/schemas/requests/user/orders/amends.yaml create mode 100644 spot-rest/schemas/requests/user/orders/query.yaml create mode 100644 spot-rest/schemas/requests/user/ordersInfo.yaml create mode 100644 spot-rest/schemas/requests/user/trades/balance.yaml create mode 100644 spot-rest/schemas/requests/user/trades/history.yaml create mode 100644 spot-rest/schemas/requests/user/trades/query.yaml create mode 100644 spot-rest/schemas/requests/user/trades/volume.yaml create mode 100644 spot-rest/schemas/responses/200.yaml create mode 100644 spot-rest/schemas/responses/400.yaml create mode 100644 spot-rest/schemas/responses/401.yaml create mode 100644 spot-rest/schemas/responses/404.yaml create mode 100644 spot-rest/schemas/responses/500.yaml create mode 100644 spot-rest/schemas/responses/funding/deposits/addresses.yaml create mode 100644 spot-rest/schemas/responses/funding/deposits/methods.yaml create mode 100644 spot-rest/schemas/responses/funding/deposits/recent.yaml create mode 100644 spot-rest/schemas/responses/funding/withdrawals/addresses.yaml create mode 100644 spot-rest/schemas/responses/funding/withdrawals/info.yaml create mode 100644 spot-rest/schemas/responses/funding/withdrawals/methods.yaml create mode 100644 spot-rest/schemas/responses/funding/withdrawals/recent.yaml create mode 100644 spot-rest/schemas/responses/funding/withdrawals/withdrawal.yaml create mode 100644 spot-rest/schemas/responses/public/assets/info.yaml create mode 100644 spot-rest/schemas/responses/public/depth.yaml create mode 100644 spot-rest/schemas/responses/public/ohlc.yaml create mode 100644 spot-rest/schemas/responses/public/spread.yaml create mode 100644 spot-rest/schemas/responses/public/ticker.yaml create mode 100644 spot-rest/schemas/responses/public/time.yaml create mode 100644 spot-rest/schemas/responses/public/trades.yaml create mode 100644 spot-rest/schemas/responses/trading/orders/add.yaml create mode 100644 spot-rest/schemas/responses/trading/orders/amend.yaml create mode 100644 spot-rest/schemas/responses/trading/orders/batchadd.yaml create mode 100644 spot-rest/schemas/responses/trading/orders/batchcancel.yaml create mode 100644 spot-rest/schemas/responses/trading/orders/cancel.yaml create mode 100644 spot-rest/schemas/responses/trading/orders/edit.yaml create mode 100644 spot-rest/schemas/responses/user/account/balance.yaml create mode 100644 spot-rest/schemas/responses/user/account/balanceex.yaml create mode 100644 spot-rest/schemas/responses/user/account/creditlines.yaml create mode 100644 spot-rest/schemas/responses/user/ledgers/info.yaml create mode 100644 spot-rest/schemas/responses/user/ledgers/query.yaml create mode 100644 spot-rest/schemas/responses/user/orders/amends.yaml create mode 100644 spot-rest/schemas/responses/user/orders/closed.yaml create mode 100644 spot-rest/schemas/responses/user/orders/open.yaml create mode 100644 spot-rest/schemas/responses/user/orders/query.yaml create mode 100644 spot-rest/schemas/responses/user/trades/balance.yaml create mode 100644 spot-rest/schemas/responses/user/trades/history.yaml create mode 100644 spot-rest/schemas/responses/user/trades/volume.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..9d0117f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: / + schedule: + interval: monthly + - package-ecosystem: "cargo" # See documentation for possible values + directories: + - "/" + - "/crates/**/" + schedule: + interval: "weekly" diff --git a/.github/workflows/api-specs.yml b/.github/workflows/api-specs.yml new file mode 100644 index 0000000..122ccdf --- /dev/null +++ b/.github/workflows/api-specs.yml @@ -0,0 +1,25 @@ +name: API Specs + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + format: + name: Check Format + runs-on: ubuntu-latest + steps: + - name: No Operation + run: echo "This job does nothing." + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: No Operation + run: echo "This job does nothing." diff --git a/.github/workflows/email-check.yml b/.github/workflows/email-check.yml new file mode 100644 index 0000000..0fb397c --- /dev/null +++ b/.github/workflows/email-check.yml @@ -0,0 +1,45 @@ +name: Email Address Check + +on: [push] + +jobs: + check-emails: + name: Check Commit Emails + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for all branches and tags + + - name: Check commit emails + run: | + # Get all commits in the current branch + COMMITS=$(git rev-list HEAD) + + # Initialize error flag + ERROR=0 + + # Check each commit + for commit in $COMMITS; do + # Get author and committer emails + AUTHOR_EMAIL=$(git log -1 --format='%ae' $commit) + COMMITTER_EMAIL=$(git log -1 --format='%ce' $commit) + COMMIT_SHA=$(git rev-parse --short $commit) + + if [[ "$AUTHOR_EMAIL" == *"@kraken.com" ]]; then + echo "❌ Error: Commit $COMMIT_SHA has author email ($AUTHOR_EMAIL) from @kraken.com domain" + ERROR=1 + fi + + if [[ "$COMMITTER_EMAIL" == *"@kraken.com" ]]; then + echo "❌ Error: Commit $COMMIT_SHA has committer email ($COMMITTER_EMAIL) from @kraken.com domain" + ERROR=1 + fi + done + + if [ $ERROR -eq 1 ]; then + echo "::error::Found commits with @kraken.com email addresses. Please use a different email address." + exit 1 + else + echo "✅ No @kraken.com email addresses found in commits." + fi diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8817a71 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Payward, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index ebac1ba..b12a500 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,78 @@ -# api-specs -Official open-source specifications for the Kraken API, including OpenAPI and AsyncAPI standards. +# Kraken API Specifications + +Official open-source specifications for the Kraken API ecosystem, including OpenAPI 3.0 standards for all Kraken services. For API documentation, visit: https://docs.kraken.com/. + +## Overview + +This repository contains comprehensive API specifications for Kraken's trading platform and related services. All specifications follow OpenAPI 3.0 standards and are organized by service domain. + +## APIs + +### Spot Trading REST API (`spot-rest/`) +Complete specification for Kraken's spot trading REST API, including: +- **Public endpoints**: Market data, asset information, order books, trades, OHLC data +- **Private endpoints**: Account management, trading operations, order management, funding +- **User data**: Account balances, trade history, ledger information +- **Trading**: Order placement, modification, cancellation, batch operations + +### Futures REST API (`futures-rest/`) + +Specification for Kraken's futures trading platform: +- **Authentication**: API authentication endpoints +- **Charts**: Chart data and market visualization +- **History**: Historical data and trade records +- **Statistics**: Trading statistics and metrics +- **Trading**: Futures-specific trading operations + +### OAuth API (`oauth/`) + +OAuth 2.0 authentication and authorization specification: +- Authorization code flow +- Token management +- Scope definitions +- Client authentication + +### OTC API (`otc/`) + +Specification for institutional OTC trading: +- Quote request creation and management +- Active and historical quotes +- Client verification +- Exposure management +- Trading pair information + +### Pay API (`pay/`) +Kraken Pay service specification: +- Payment request creation and management +- Payment transfers +- Paylink code generation and configuration +- Payment cancellation + +**Main file**: `pay/openapi_v3.yaml` + +## Viewing Specifications +You can view these specifications using any OpenAPI-compatible tool: +- [Swagger UI](https://swagger.io/tools/swagger-ui/) +- [Redoc](https://redoc.ly/) +- [Postman](https://www.postman.com/) +- [Insomnia](https://insomnia.rest/) + +## Authentication +Most private endpoints require API key authentication. Refer to the [individual service specifications](https://docs.kraken.com/api/docs/guides/global-intro) on our website for detailed authentication requirements and permissions. + +## Standards Compliance + +- **OpenAPI Version**: 3.0.0 - 3.0.4 +- **Format**: YAML +- **Validation**: All specifications should pass OpenAPI validation +- **Documentation**: Comprehensive descriptions for all endpoints, parameters, and schemas + +## Support + +For questions about these API specifications or the Kraken API: +- [Kraken API Documentation](https://docs.kraken.com/rest/) +- [Kraken Support](https://support.kraken.com/) + +## License + +These specifications are open-source and available for public use in accordance with Kraken's API terms of service. diff --git a/futures-rest/auth/api-public.yml b/futures-rest/auth/api-public.yml new file mode 100644 index 0000000..865d9ae --- /dev/null +++ b/futures-rest/auth/api-public.yml @@ -0,0 +1,1104 @@ +openapi: 3.1.0 +info: + title: Auth + version: v1.0 +servers: + - url: https://futures.kraken.com/api/auth/v1 + description: Kraken Futures Production +tags: + - name: PoW + - name: Authentication + - name: MFA + - name: Verify + - name: Sign Up + - name: Password Reset + - name: Mobile Token + - name: Account + - name: API Keys + - name: Regions +paths: + /api-keys/v3/check: + get: + operationId: checkV3ApiKey + tags: + - API Keys + summary: Check v3 API key + description: Verify API key access and return the authenticated key's details. + responses: + '200': + $ref: '#/components/responses/CheckV3ApiKey' + '401': + description: API key is not found or request signature is invalid. + $ref: '#/components/responses/Error' + security: + - api-key-any: [] + request-signature: [] +components: + schemas: + AccountInfo: + title: Account Info + type: object + properties: + uid: + type: string + format: uuid + email: + type: string + format: email + example: ernest@example.com + iiban: + $ref: '#/components/schemas/Iiban' + platform: + description: Account's platform. Represents a regulatory grouping. + type: string + example: dlt + fullname: + type: + - string + - 'null' + example: Ernest Rutherford + countryCode: + type: + - string + - 'null' + example: GBR + memberSince: + $ref: '#/components/schemas/Rfc3339DateTime' + lastLoginDate: + oneOf: + - type: 'null' + - $ref: '#/components/schemas/Rfc3339DateTime' + lastLoginIpAddress: + type: + - string + - 'null' + roles: + type: array + items: + $ref: '#/components/schemas/Role' + mfaPriority: + type: array + items: + type: string + enum: + - totp + - fido2 + required: + - uid + - email + - iiban + - platform + - fullname + - countryCode + - memberSince + - lastLoginDate + - lastLoginIpAddress + - roles + - mfaPriority + ApiKeyPermissionMap: + type: object + properties: + general: + $ref: '#/components/schemas/ApiKeyV3AccessLevel' + transfer: + $ref: '#/components/schemas/ApiKeyV3AccessLevel' + required: + - general + - transfer + CheckedV3ApiKeyDetails: + type: object + properties: + apiKey: + description: API key that signed the request. + type: string + format: base64 + example: Gom9BsP75m41c9fuY6oJk/unMWaDZjYIcTP4/5kqPvtzdbj5JU5/Fyeb + accountUid: + description: UID of the account that the API key belongs to. + type: string + format: uuid + iiban: + description: IIBAN of the account that the API key belongs to. + oneOf: + - $ref: '#/components/schemas/Iiban' + - type: 'null' + createdAt: + description: Date-time that the API key was created. + $ref: '#/components/schemas/Rfc3339DateTime' + permissions: + description: Permissions of the API key. + $ref: '#/components/schemas/ApiKeyPermissionMap' + required: + - apiKey + - accountUid + - iiban + - createdAt + - permissions + Login: + title: Login + type: object + properties: + token: + description: |- + The JWT used to authenticate future requests. Token is parseable with schema `Claims`. + Token could be up to 1KB in size. + type: string + example: eyJ0eXAiO.eyJ2IjoxLCyb2xzIjpbXX0.5Yo8xqCqyYe + required: + - token + MfaConfirmationRequestId: + title: MFA Confirmation Request Id + type: object + properties: + mfaRequestId: + type: string + format: uuid + required: + - mfaRequestId + MfaConfirmationRequestInfo: + description: MFA Confirmation Request Info + type: object + allOf: + - $ref: '#/components/schemas/MfaConfirmationRequestId' + - type: object + properties: + mfaRequired: + description: Precedence list of configured MFA methods + type: array + items: + type: string + enum: + - totp + - fido2 + challenge: + description: WebAuthn challenge object + type: + - object + - 'null' + required: + - mfaRequired + - challenge + MfaEitherCredentials: + title: MFA Credentials + oneOf: + - type: object + properties: + totp: + type: string + required: + - totp + - type: object + properties: + cred: + type: object + required: + - cred + MobileTokenConfirmationCode: + title: Mobile Token Confirmation Code + type: object + properties: + confirmationCode: + type: string + minLength: 6 + maxLength: 6 + example: '958531' + required: + - confirmationCode + MobileTokenRequest: + title: Mobile Token Request + type: object + properties: + uid: + type: string + format: uuid + requesterToken: + type: string + format: uuid + createdAt: + $ref: '#/components/schemas/Rfc3339DateTime' + required: + - uid + - requesterToken + - createdAt + NewV3ApiKey: + type: object + properties: + id: + type: integer + format: int64 + permissions: + $ref: '#/components/schemas/ApiKeyPermissionMap' + privateKey: + type: string + format: base64 + publicKey: + type: string + format: base64 + creationDate: + $ref: '#/components/schemas/Rfc3339DateTime' + required: + - id + - permissions + - privateKey + - publicKey + - creationDate + PasswordChangeRequest: + title: Password Change Request + type: object + properties: + currentPassword: + type: string + newPassword: + type: string + newPasswordVerify: + type: string + allowPwned: + type: boolean + default: false + pow: + $ref: '#/components/schemas/PowSolve' + required: + - currentPassword + - newPassword + - newPasswordVerify + - pow + RefreshForm: + title: Refresh Form + type: object + properties: + lifespan: + $ref: '#/components/schemas/TokenLifespanSeconds' + RegionRestriction: + type: object + properties: + country: + $ref: '#/components/schemas/CountryCodeAlpha2' + province: + description: Province + type: + - string + - 'null' + example: Ontario + restrict: + $ref: '#/components/schemas/RegionRestrictionTier' + required: + - country + - province + - restrict + RegionRestrictionTier: + type: string + enum: + - all + - new + - none + RevokeResult: + title: Revoke Result + type: object + properties: + tokensRevoked: + type: array + items: + type: string + revokeErrors: + type: array + items: + type: string + required: + - tokensRevoked + - revokeErrors + Role: + title: Role + type: object + properties: + level: + type: string + enum: + - READ_ONLY + - FULL_ACCESS + role: + type: string + example: GENERAL + required: + - role + - level + SSOLogin: + title: SSO Login Form + type: object + properties: + iiban: + description: IIBAN of user logging in. + $ref: '#/components/schemas/Iiban' + key: + description: Base64url-encoded temporary Kraken API key. + type: string + example: WbcGAw7bRytoylN2bH1C16+yLI0Y6w+FCg + expires: + description: Validity duration (in seconds) of temporary API key. + type: integer + example: 900 + exchange: + type: string + example: kraken + required: + - iiban + - key + - expires + TestResult: + title: Test Result + type: object + properties: + valid: + type: boolean + example: true + position: + type: + - string + - 'null' + enum: + - cookies + - authorization_header + tokenUid: + description: Unique ID of the primary token detected. + type: + - string + - 'null' + format: uuid + error: + type: + - string + - 'null' + example: + required: + - valid + - position + - tokenUid + - error + TokenDetails: + title: Token Details + type: object + properties: + uid: + type: string + format: uuid + token: + type: string + issuedAt: + $ref: '#/components/schemas/Rfc3339DateTime' + expiresAt: + $ref: '#/components/schemas/Rfc3339DateTime' + revokedAt: + oneOf: + - type: 'null' + - $ref: '#/components/schemas/Rfc3339DateTime' + revokeReason: + type: + - string + - 'null' + createdByIp: + type: string + format: ip + createdByUserAgent: + type: string + required: + - uid + - token + - issuedAt + - expiresAt + - revokedAt + - revokeReason + - createdByIp + - createdByUserAgent + V3ApiKey: + type: object + properties: + id: + type: integer + format: int64 + permissions: + $ref: '#/components/schemas/ApiKeyPermissionMap' + publicKey: + type: string + format: base64 + creationDate: + $ref: '#/components/schemas/Rfc3339DateTime' + required: + - id + - permissions + - publicKey + - creationDate + VerifyResult: + title: Verify Result + type: object + properties: + token: + type: string + example: eyJ0eXAiOiJKV1.eyJ2IjoxLCJqRfT05MWSJ9XX0.tFPxmuN4xWTLkuUcU + valid: + type: boolean + invalidReason: + type: + - string + - 'null' + example: invalid signature + required: + - token + - valid + - invalidReason + Iiban: + description: Account IIBAN, if Kraken customer. + type: string + example: AA08 N84G CPAR UN7A + pattern: ^AA[A-Z0-9]{2} [A-Z0-9]{4} [A-Z0-9]{4} [A-Z0-9]{4}$ + x-rustType: iiban::Iiban + AccountExists: + description: Whether the provided Futures account exists + type: object + properties: + exists: + type: boolean + canTrade: + type: boolean + required: + - exists + TokenLifespanSeconds: + title: Token Lifespan + description: |- + How long (in seconds) the token should be valid for. + + An issued token's lifespan will be clamped to at least 10 seconds and at most 10 years (or 3 + hours for admin logins). + type: integer + format: uint64 + minimum: 10 + maximum: 316224000 + PowSolve: + title: PoW Solution + type: object + description: A Proof-of-Work solution. + properties: + seed: + description: The initial seed to pass into a PoW solver. + type: string + format: hex + minLength: 64 + maxLength: 64 + pattern: '[0-9a-f]{64}' + example: 079fa564e7574f30c4a64b06d2e363998e55c11cd15f347a1b945ef3d281d039 + solution: + description: PoW solution is the list of nonces for each step of the process. + type: array + items: + type: integer + format: uint32 + example: + - 664 + - 99 + - 1055 + - 116 + duration: + description: How long it took to solve PoW challenge in milliseconds. + type: integer + format: u64 + example: 50 + required: + - seed + - solution + - duration + LoginForm: + title: Login Form + type: object + properties: + email: + type: string + format: email + example: ernest@example.com + password: + type: string + format: password + example: Password1 + totp: + description: The TOTP 2FA password (if the account has it set up). + type: string + example: '012345' + cred: + description: Authenticator response object. Base64url encoded. + type: + - object + - 'null' + example: + scopes: + description: Specifies which type of endpoints should be accessible. + type: array + items: + type: string + example: + - admin + lifespan: + $ref: '#/components/schemas/TokenLifespanSeconds' + pow: + $ref: '#/components/schemas/PowSolve' + required: + - email + - password + ErrorDescriptor: + type: object + properties: + error: + type: string + message: + type: string + suberror: + type: + - string + - 'null' + required: + - error + - message + - suberror + Rfc3339DateTime: + description: RFC 3339 formatted date-time + type: string + format: date-time + example: '2019-08-24T14:15:22Z' + PowChallenge: + title: PoW Challenge + type: object + description: A Proof-of-Work challenge to be solved in order to use certain endpoints. + properties: + seed: + description: The initial seed to pass into a PoW solver. + type: string + format: hex + minLength: 64 + maxLength: 64 + pattern: '[0-9a-f]{64}' + example: 079fa564e7574f30c4a64b06d2e363998e55c11cd15f347a1b945ef3d281d039 + target: + description: |- + Indicates solve difficulty. + + When represented in binary, number will always be n 0s followed by m 1s. + The lower the number, the harder the solve. + type: integer + example: 4194303 + steps: + description: |- + Number of steps PoW solver algorithm should make and therefore the number of items in + solution array. + type: integer + format: uint32 + example: 16 + expires: + description: Instant after which a solution will no longer be accepted for this seed. + $ref: '#/components/schemas/Rfc3339DateTime' + required: + - seed + - target + - steps + - expires + WhoAmI: + title: Account Identifiers + type: object + properties: + uid: + description: Futures account UID. + type: string + format: uuid + iiban: + description: Account IIBAN, if Kraken customer. + type: + - string + - 'null' + example: AA39 N84G C4XO 6B2V + x-rustType: iiban::Iiban + required: + - uid + - iiban + ApiKeyV3AccessLevel: + description: Tier of access granted to an API key. + type: string + enum: + - NO_ACCESS + - READ_ONLY + - FULL_ACCESS + x-exhaustive: true + CountryCodeAlpha2: + description: Alpha-2 country code + type: string + minLength: 2 + maxLength: 2 + example: CA + requestBodies: + ActivateAccount: + required: true + content: + application/json: + schema: + type: object + properties: + uid: + type: string + format: uuid + required: + - uid + AddApiKeyRequest: + required: true + content: + application/json: + schema: + allOf: + - type: object + properties: + permissions: + $ref: '#/components/schemas/ApiKeyPermissionMap' + required: + - permissions + - $ref: '#/components/schemas/MfaConfirmationRequestId' + DeleteApiKeyRequest: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MfaConfirmationRequestId' + MfaConfirmationAuthorize: + required: true + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/MfaEitherCredentials' + - $ref: '#/components/schemas/MfaConfirmationRequestId' + MfaConfirmationVerify: + required: true + content: + application/json: + schema: + allOf: + - type: object + properties: + accUid: + type: string + requireMfaConfigured: + description: |- + When set to false, the verification result will always be successful on + accounts without MFA configured. + type: boolean + default: true + required: + - accUid + - $ref: '#/components/schemas/MfaConfirmationRequestId' + MobileTokenConfirm: + required: true + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/MobileTokenConfirmationCode' + - $ref: '#/components/schemas/MobileTokenRequest' + MobileTokenRequest: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MfaConfirmationRequestId' + MobileTokenScan: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MobileTokenRequest' + PasswordChange: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PasswordChangeRequest' + PasswordResetConfirm: + required: true + content: + application/json: + schema: + type: object + properties: + code: + type: string + example: ibxB7BlgHTFfLyQtDaBbJhOmJtc55ZNhe7JcI7v9RSyWjZDd4prkkwOLbNfZ + newPassword: + type: string + example: Password1 + newPasswordVerify: + type: string + example: Password1 + allowPwned: + type: boolean + default: false + totp: + type: string + example: '000000' + minLength: 6 + maxLength: 6 + required: + - code + - newPassword + - newPasswordVerify + PasswordResetRequest: + required: true + content: + application/json: + schema: + type: object + properties: + email: + type: string + format: email + example: ernest@example.com + required: + - email + RefreshToken: + description: Refresh form + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RefreshForm' + SSOLogin: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SSOLogin' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/SSOLogin' + example: + iiban: AA52 E25P MHAW YANF + key: WbcGAw7bRytoylN2bH1C16+yLI0Y6w+FCg + expires: 900 + exchange: kraken + SignUp: + required: true + content: + application/json: + schema: + type: object + properties: + email: + type: string + format: email + password: + type: string + minLength: 8 + verifyPassword: + type: string + minLength: 8 + allowPwned: + type: boolean + default: false + newsletter: + type: boolean + affiliateUid: + type: string + format: uuid + accountType: + type: string + enum: + - individual + - corporate + x-exhaustive: true + pow: + $ref: '#/components/schemas/PowSolve' + required: + - email + - password + - verifyPassword + - pow + TokenLifespanUpdate: + description: Set the default token lifespan (session length) + required: true + content: + application/json: + schema: + type: object + properties: + lifespan: + $ref: '#/components/schemas/TokenLifespanSeconds' + required: + - lifespan + TokenVerify: + required: true + content: + application/json: + schema: + type: object + properties: + token: + type: string + example: eyJ0eXAiOiJKV1.eyJ2IjoxLCJq...RfT05MWSJ9XX0.tFPxmuN4xWTLkuUcU + required: + - token + examples: + revoked: + value: + token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2IjoxLCJqdGkiOiI2YzEwZWYzZi1kOWVkLTQ5YTctOWQ5ZC0yZWUyOWE4YWZhYjgiLCJzdWIiOiI1M2FkMDg0ZS1jYTZlLTQ3NWQtYTlmMy00YjE4NDk5OWIyNDQiLCJpc3MiOiJhbmNpbGUiLCJpYXQiOjE1NjU3ODY3MzEsImV4cCI6MTU2ODM3ODczMSwibGZzcCI6MjU5MjAwMCwidHlwIjoiYXQiLCJyb2xzIjpbeyJyb2xlIjoiR0VORVJBTCIsImxldmVsIjoiUkVBRF9PTkxZIn0seyJyb2xlIjoiQUNDT1VOVF9BQ0NFU1MiLCJsZXZlbCI6IlJFQURfT05MWSJ9XX0.NZIrjIzrgcEmyBPYXe-ELsBXZjHVfFMTx2rXI1YXu84 + DirectSignin: + description: Login form + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LoginForm' + examples: + basic: + value: + email: admin1account@cryptofacilities.co.uk + password: Password1 + pow: + seed: 079fa564e7574f30c4a64b06d2e363998e55c11cd15f347a1b945ef3d281d039 + solution: + - 664 + - 99 + - 1055 + - 116 + duration: 50 + unregistered: + value: + email: nobody@example.com + password: nobody + pow: + seed: 079fa564e7574f30c4a64b06d2e363998e55c11cd15f347a1b945ef3d281d039 + solution: + - 664 + - 99 + - 1055 + - 116 + duration: 50 + PowSolve: + description: A PoW solution. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PowSolve' + responses: + AccountExists: + description: Whether a Futures account exists for the Spot account + content: + application/json: + schema: + $ref: '#/components/schemas/AccountExists' + AccountInfo: + description: Account information relevant to authentication and authorization + content: + application/json: + schema: + $ref: '#/components/schemas/AccountInfo' + CheckV3ApiKey: + description: API key authentication is valid and details have been returned. + content: + application/json: + schema: + $ref: '#/components/schemas/CheckedV3ApiKeyDetails' + Login: + description: Logged in + content: + application/json: + schema: + $ref: '#/components/schemas/Login' + examples: + success: + $ref: '#/components/examples/LoginSuccessBody' + MfaConfirmRequest: + description: MFA Confirmation Request Info + content: + application/json: + schema: + $ref: '#/components/schemas/MfaConfirmationRequestInfo' + examples: + totpOnly: + $ref: '#/components/examples/MfaConfirmationRequestTotpOnly' + fidoOnly: + $ref: '#/components/examples/MfaConfirmationRequestFido2Only' + both: + $ref: '#/components/examples/MfaConfirmationRequestBoth' + MobileTokenConfirmationCode: + description: Confirmation code + content: + application/json: + schema: + $ref: '#/components/schemas/MobileTokenConfirmationCode' + MobileTokenRequest: + description: Mobile token request payload + content: + application/json: + schema: + $ref: '#/components/schemas/MobileTokenRequest' + RegionRestrictionList: + description: Country info list + content: + application/json: + schema: + type: object + properties: + regionRestrictions: + type: array + items: + $ref: '#/components/schemas/RegionRestriction' + required: + - regionRestrictions + Revoke: + description: Results of token revocation process + content: + application/json: + schema: + $ref: '#/components/schemas/RevokeResult' + Test: + description: Auth token debug information + content: + application/json: + schema: + $ref: '#/components/schemas/TestResult' + Tokens: + description: List of tokens for account + content: + application/json: + schema: + type: object + properties: + tokens: + type: array + items: + $ref: '#/components/schemas/TokenDetails' + required: + - tokens + Verify: + description: Token validity information + content: + application/json: + schema: + $ref: '#/components/schemas/VerifyResult' + examples: + valid: + $ref: '#/components/examples/VerifyValidBody' + revoked: + $ref: '#/components/examples/VerifyRevokedBody' + Error: + description: Error descriptor + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorDescriptor' + PowChallenge: + description: PoW challenge solver inputs + content: + application/json: + schema: + $ref: '#/components/schemas/PowChallenge' + PowTester: + description: PoW test result + content: + application/json: + schema: + type: object + properties: + valid: + type: boolean + required: + - valid + WhoAmI: + description: Account identifiers extracted from auth token + content: + application/json: + schema: + $ref: '#/components/schemas/WhoAmI' + examples: + LoginSuccessBody: + value: + token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2IjoxLCJqdGkiOiJkMDJlMDUzZS01NzRjLTQ5MWMtOWZiNi0xMjY0YTIyNzA2MDAiLCJzdWIiOiI1M2FkMDg0ZS1jYTZlLTQ3NWQtYTlmMy00YjE4NDk5OWIyNDQiLCJpc3MiOiJhbmNpbGUiLCJpYXQiOjE1NjU3ODY4OTksImV4cCI6MTU2ODM3ODg5OSwibGZzcCI6MjU5MjAwMCwidHlwIjoiYXQiLCJyb2xzIjpbeyJyb2xlIjoiR0VORVJBTCIsImxldmVsIjoiUkVBRF9PTkxZIn0seyJyb2xlIjoiQUNDT1VOVF9BQ0NFU1MiLCJsZXZlbCI6IlJFQURfT05MWSJ9XX0.oIU1_3Ap5Ytc6ox3_b4S3e60moRVdxth39tGOu-2baM + MfaConfirmationRequestBoth: + summary: Both FIDO (Yubikey) and TOTP configured + value: + mfaRequestId: 67caff42-2d8d-4dd2-bf47-898f097641a1 + mfaRequired: + - fido2 + - totp + challenge: {} + MfaConfirmationRequestFido2Only: + summary: Only FIDO (Yubikey) configured + value: + mfaRequestId: 67caff42-2d8d-4dd2-bf47-898f097641a1 + mfaRequired: + - fido2 + challenge: {} + MfaConfirmationRequestTotpOnly: + summary: Only TOTP configured + value: + mfaRequestId: 67caff42-2d8d-4dd2-bf47-898f097641a1 + mfaRequired: + - totp + challenge: null + VerifyRevokedBody: + value: + token: + valid: false + invalidReason: token revoked + VerifyValidBody: + value: + token: + valid: true + invalidReason: null + parameters: + TokensFilter: + name: filter + in: query + description: Filter for tokens list. + schema: + type: string + enum: + - active + - inactive + - all + UserAgentHeader: + name: User-Agent + in: header + required: true + description: User agent + schema: + type: string + HostHeader: + name: Host + in: header + description: Host and port number of the server to which the request is being sent + schema: + type: string + XForwardedForHeader: + name: X-Forwarded-For + in: header + description: Client's IP sourced from trusted X-Forwarded-For header. + schema: + type: string + format: ip + x-internalOnly: true + ApiKeyId: + name: keyId + in: path + required: true + schema: + type: integer + format: int64 + securitySchemes: + api-key-any: + type: apiKey + description: API Key with any permissions. + in: header + name: apikey + x-inlineDescription: true + header_jwt: + type: http + scheme: bearer + bearerFormat: JWT + request-signature: + type: apiKey + description: Request signature. + in: header + name: authent + x-inlineDescription: true diff --git a/futures-rest/charts/api-public.yml b/futures-rest/charts/api-public.yml new file mode 100644 index 0000000..ffb3250 --- /dev/null +++ b/futures-rest/charts/api-public.yml @@ -0,0 +1,708 @@ +openapi: 3.1.0 +info: + title: Charts + version: v1.0 +servers: + - url: 'https://futures.kraken.com/api/charts/v1' + description: Kraken Futures + x-kfOnly: true +tags: + - name: Candles + - name: Analytics +paths: + /: + get: + operationId: tickTypes + tags: + - Candles + summary: Tick Types + description: |- + Returns all available tick types to use with the [markets](#operation/symbols) endpoint. + security: [] + responses: + '200': + description: Tick types list + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TickTypes' + /analytics/liquidity-pool: + get: + operationId: liquidityPoolStats + tags: + - Analytics + summary: Get liquidity pool statistic + description: Get liquidity pool statistic including usd value + security: [] + parameters: + - name: since + in: query + required: true + description: epoch time in seconds + schema: + type: integer + format: int64 + example: 1676556478 + - name: interval + in: query + required: true + schema: + $ref: '#/components/schemas/Interval' + - name: to + in: query + required: false + description: epoch time in seconds, default now + schema: + type: integer + example: 1676556478 + responses: + '200': + description: Available analytics by type and symbol + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsResponse' + '400': + description: Query has invalid arguments + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsResponse' + '404': + description: Symbol or analytics type could not be found + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsResponse' + /analytics/{symbol}/{analytics_type}: + get: + operationId: marketAnalytics + tags: + - Analytics + summary: Market Analytics + description: Analytics data divided into time buckets + security: [] + parameters: + - name: symbol + in: path + required: true + description: Market symbol + schema: + type: string + - name: analytics_type + in: path + required: true + schema: + $ref: '#/components/schemas/AnalyticsType' + - name: since + in: query + required: true + description: epoch time in seconds + schema: + type: integer + format: int64 + example: 1676556478 + - name: interval + in: query + required: true + schema: + $ref: '#/components/schemas/Interval' + - name: to + in: query + required: false + description: epoch time in seconds, default now + schema: + type: integer + example: 1676556478 + responses: + '200': + description: Available analytics by type and symbol + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsResponse' + '400': + description: Query has invalid arguments + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsResponse' + '404': + description: Symbol or analytics type could not be found + content: + application/json: + schema: + $ref: '#/components/schemas/AnalyticsResponse' + /{tick_type}: + get: + operationId: symbols + tags: + - Candles + summary: Markets + description: |- + Markets available for specified tick type. + + List of available tick types can be fetched from the [tick types](#operation/tickTypes) + endpoint. + security: [] + parameters: + - name: tick_type + in: path + required: true + schema: + $ref: '#/components/schemas/TickTypes' + responses: + '200': + description: Markets list + content: + application/json: + schema: + type: array + items: + type: string + example: + - PI_XRPUSD + - FI_XRPUSD_210625 + - FI_XBTUSD_210528 + - PI_XBTUSD + /{tick_type}/{symbol}: + get: + operationId: resolutions + tags: + - Candles + summary: Resolutions + description: |- + Candle resolutions available for specified tick type and market. + + List of available tick types can be fetched from the [tick types](#operation/tickTypes) + endpoint. List of available markets can be fetched from the [markets](#operation/symbols) + endpoint. + security: [] + parameters: + - name: tick_type + in: path + required: true + schema: + $ref: '#/components/schemas/TickTypes' + - name: symbol + in: path + required: true + description: Market symbol + schema: + type: string + responses: + '200': + description: All resolutions for the given `tick_type` and `symbol` + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Resolution' + /{tick_type}/{symbol}/{resolution}: + get: + operationId: candles + tags: + - Candles + summary: Market Candles + description: |- + Candles for specified tick type, market, and resolution. + + List of available tick types can be fetched from the [tick types](#operation/tickTypes) + endpoint. List of available markets can be fetched from the [markets](#operation/symbols) + endpoint. List of available resolutions can be fetched from the + [resolutions](#operation/resolutions) endpoint. + security: [] + parameters: + - name: tick_type + in: path + required: true + schema: + $ref: '#/components/schemas/TickTypes' + - name: symbol + in: path + required: true + description: Market symbol + schema: + type: string + - name: resolution + in: path + required: true + schema: + $ref: '#/components/schemas/Resolution' + - name: from + in: query + description: From date in epoch seconds + schema: + type: number + - name: to + in: query + description: To date in epoch seconds + schema: + type: number + - name: count + in: query + description: Number of candles to return. + schema: + type: integer + minimum: 0 + responses: + '200': + $ref: '#/components/responses/Candles' +components: + responses: + Candles: + description: OHLC candles + content: + application/json: + schema: + $ref: '#/components/schemas/CandlesResponse' + schemas: + AnalyticsLiquidityData: + title: Orderbook liquidity data + type: object + properties: + liquidity_005: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity_01: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity_025: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity_05: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity_10: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity_100: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + required: + - liquidity_005 + - liquidity_01 + - liquidity_025 + - liquidity_05 + - liquidity_10 + - liquidity_100 + AnalyticsOrderbookData: + title: Orderbook analytics data + type: object + properties: + bid: + title: 'Bids statistics' + oneOf: + - $ref: '#/components/schemas/AnalyticsSpreadsData' + - $ref: '#/components/schemas/AnalyticsLiquidityData' + - $ref: '#/components/schemas/AnalyticsSlippageData' + - $ref: '#/components/schemas/AnalyticsFullOrderbookData' + ask: + title: 'Asks statistics' + oneOf: + - $ref: '#/components/schemas/AnalyticsSpreadsData' + - $ref: '#/components/schemas/AnalyticsLiquidityData' + - $ref: '#/components/schemas/AnalyticsSlippageData' + - $ref: '#/components/schemas/AnalyticsFullOrderbookData' + required: + - bid + - ask + AnalyticsResponse: + title: Analytics response + type: object + properties: + result: + $ref: '#/components/schemas/AnalyticsResponseResult' + errors: + type: array + items: + $ref: '#/components/schemas/AnalyticsResponseError' + required: + - result + - errors + AnalyticsResponseError: + title: Analytics response error + type: object + properties: + severity: + type: string + error_class: + type: string + type: + type: string + msg: + type: string + value: + type: string + field: + type: string + required: + - severity + - error_class + - type + AnalyticsResponseResult: + title: Result container for analytics response + type: object + properties: + timestamp: + type: array + items: + type: integer + more: + type: boolean + description: True if there are more candles in time range + data: + oneOf: + - type: array + items: + oneOf: + - type: number + - type: string + format: big-decimal + - type: array + title: Ohlc + minItems: 4 + maxItems: 4 + items: + type: number + - $ref: '#/components/schemas/AnalyticsLongShortData' + - $ref: '#/components/schemas/AnalyticsOrderbookData' + - $ref: '#/components/schemas/AnalyticsCvdData' + - $ref: '#/components/schemas/AnalyticsTopTradersData' + - $ref: '#/components/schemas/AnalyticsLiquidityPoolData' + - $ref: '#/components/schemas/AnalyticsFutureBasisData' + required: + - timestamp + - data + - more + AnalyticsSlippageData: + title: Orderbook slippage data + type: object + properties: + slippage_1k: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + slippage_10k: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + slippage_100k: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + slippage_1m: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + required: + - slippage_1k + - slippage_10k + - slippage_100k + - slippage_1m + AnalyticsFullOrderbookData: + title: Combination of all orderbook metrics + type: object + properties: + slippage1k: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + slippage10k: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + slippage100k: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + slippage1m: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + bestPrice: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity005: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity01: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity025: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity05: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity10: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + liquidity100: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + required: + - slippage1k + - slippage10k + - slippage100k + - slippage1m + - bestPrice + - liquidity005 + - liquidity01 + - liquidity025 + - liquidity05 + - liquidity10 + - liquidity100 + AnalyticsSpreadsData: + title: Orderbook spread data + type: object + properties: + best_price: + type: array + items: + $ref: '#/components/schemas/NullableBigDecimal' + required: + - best_price + AnalyticsLongShortData: + title: Statistic of long and short positions + type: 'object' + properties: + longCount: + type: 'array' + items: + type: 'integer' + shortCount: + type: 'array' + items: + type: 'integer' + longPercent: + type: 'array' + items: + type: 'string' + format: big-decimal + shortPercent: + type: 'array' + items: + type: 'string' + format: big-decimal + ratio: + type: 'array' + items: + type: 'string' + format: big-decimal + required: + - long_count + - short_count + - long_percent + - short_percent + - ratio + AnalyticsCvdData: + type: object + properties: + buyVolume: + type: 'array' + items: + type: string + format: big-decimal + sellVolume: + type: 'array' + items: + type: string + format: big-decimal + cvd: + type: 'array' + items: + type: string + format: big-decimal + required: + - buyVolume + - sellVolume + - cvd + AnalyticsLiquidityPoolData: + type: object + properties: + usdValue: + type: 'array' + items: + type: string + format: big-decimal + required: + - usdValue + AnalyticsTopTradersData: + type: object + properties: + top20Percent: + $ref: '#/components/schemas/AnalyticsTopTradersLevelData' + required: + - top20Percent + AnalyticsTopTradersLevelData: + type: object + properties: + openInterest: + type: 'array' + items: + type: string + format: big-decimal + longCount: + type: 'array' + items: + type: 'integer' + shortCount: + type: 'array' + items: + type: 'integer' + longPercent: + type: 'array' + items: + type: 'string' + format: big-decimal + shortPercent: + type: 'array' + items: + type: 'string' + format: big-decimal + ratio: + type: 'array' + items: + type: 'string' + format: big-decimal + required: + - openInterest + - longCount + - shortCount + - longPercent + - shortPercent + - ratio + AnalyticsFutureBasisData: + type: object + properties: + basis: + type: 'array' + items: + type: string + format: big-decimal + required: + - basis + AnalyticsType: + title: Type of analytics + type: string + enum: + - open-interest + - aggressor-differential + - trade-volume + - trade-count + - liquidation-volume + - rolling-volatility + - long-short-ratio + - long-short-info + - cvd + - top-traders + - orderbook + - spreads + - liquidity + - slippage + - future-basis + Candlestick: + title: Candlestick + type: object + properties: + time: + description: Epoch in ms + type: integer + format: int64 + example: 1620816960000 + high: + type: string + format: big-decimal + example: '56475.00000000000' + low: + type: string + format: big-decimal + example: '55935.00000000000' + open: + type: string + format: big-decimal + example: '56294.00000000000' + close: + type: string + format: big-decimal + example: '56250.00000000000' + volume: + type: number + format: int64 + example: 10824 + required: + - time + - high + - low + - open + - close + - volume + CandlesResponse: + type: object + properties: + candles: + type: array + description: OHLC candles + items: + $ref: '#/components/schemas/Candlestick' + more_candles: + type: boolean + description: True if there are more candles in time range + required: + - candles + - more_candles + Interval: + title: Resolution in seconds + type: integer + enum: + - 60 + - 300 + - 900 + - 1800 + - 3600 + - 14400 + - 43200 + - 86400 + - 604800 + NullableBigDecimal: + type: + - 'string' + - 'null' + format: big-decimal + Resolution: + title: Resolution + type: string + enum: + - 1m + - 5m + - 15m + - 30m + - 1h + - 4h + - 12h + - 1d + - 1w + TickTypes: + title: Tick Types + type: string + enum: + - spot + - mark + - trade diff --git a/futures-rest/history/_parameters.yml b/futures-rest/history/_parameters.yml new file mode 100644 index 0000000..7dc6a3a --- /dev/null +++ b/futures-rest/history/_parameters.yml @@ -0,0 +1,263 @@ +AccountUid: + name: accountUid + in: path + description: UID of the account + required: true + schema: { $ref: "_schemas.yml#/AccountUid" } +BeforeDateFilter: + name: before + in: query + description: Timestamp in milliseconds. + schema: { $ref: "_schemas.yml#/TimestampMilliseconds" } +ClosedOrder: + name: closed + in: query + schema: + type: boolean + description: | + Determines status of the order that should be included in response(s). + + - `true` = return orders that have been closed/cancelled/rejected within given time range. + - `false` = don't return orders that have been closed/cancelled/rejected within given time range. + required: false +ClosedTrigger: + name: closed + in: query + schema: + type: boolean + description: | + Determines status of the trigger that should be included in response(s). + + - `true` = return triggers that have been closed/cancelled/rejected within given time range. + - `false` = don't return triggers that have been closed/cancelled/rejected within given time range. + required: false +ContinuationToken: + name: continuation_token + in: query + description: | + Opaque token from the `Next-Continuation-Token` header used to continue listing events. The + `sort` parameter must be the same as in the previous request to continue listing in the same + direction. + schema: + type: string + format: base64 +Count: + name: count + in: query + description: + The maximum number of results to return. The upper bound is determined by a global limit. + schema: + type: integer + format: int64 + minimum: 1 + x-rustType: usize +IncludeClosedPositions: + name: closed + in: query + schema: + type: boolean + description: | + True if results should include closed position events. Setting this to + false has no effect. + + If multiple position change filters (opened/closed/increased/decreased/reversed/no_change) + are provided, then positions matching any of these will be included. + + When combined with update reason filters (trades/funding_realization/settlement), + positions must match at least one position change filter AND at least one + update reason filter. + + If no filters are provided for the request, all position events will be included. + required: false +IncludeDecreasedPositions: + name: decreased + in: query + schema: + type: boolean + description: | + True if results should include decreased position events. Setting this to + false has no effect. + + If multiple position change filters (opened/closed/increased/decreased/reversed/no_change) + are provided, then positions matching any of these will be included. + + When combined with update reason filters (trades/funding_realization/settlement), + positions must match at least one position change filter AND at least one + update reason filter. + + If no filters are provided for the request, all position events will be included. + required: false +IncludeFundingRealizationPositions: + name: funding_realization + in: query + schema: + type: boolean + description: | + True if results should include position events caused by a funding + realisation. Setting this to false has no effect. + + If multiple update reason filters (trades/funding_realization/settlement) + are provided, then positions matching any of these will be included. + + When combined with position change filters (opened/closed/increased/decreased/reversed/no_change), + positions must match at least one update reason filter AND at least one + position change filter. + + If no filters are provided for the request, all position events will be included. + required: false +IncludeIncreasedPositions: + name: increased + in: query + schema: + type: boolean + description: | + True if results should include increased position events. Setting this to + false has no effect. + + If multiple position change filters (opened/closed/increased/decreased/reversed/no_change) + are provided, then positions matching any of these will be included. + + When combined with update reason filters (trades/funding_realization/settlement), + positions must match at least one position change filter AND at least one + update reason filter. + + If no filters are provided for the request, all position events will be included. + required: false +IncludeNoChangePositions: + name: no_change + in: query + schema: + type: boolean + description: | + True if results should include "no change" position events - where the + position has not changed. Setting this to false has no effect. + + If multiple position change filters (opened/closed/increased/decreased/reversed/no_change) + are provided, then positions matching any of these will be included. + + When combined with update reason filters (trades/funding_realization/settlement), + positions must match at least one position change filter AND at least one + update reason filter. + + If no filters are provided for the request, all position events will be included. + required: false +IncludeOpenedPositions: + name: opened + in: query + schema: + type: boolean + description: | + True if results should include opened position events. Setting this to + false has no effect. + + If multiple position change filters (opened/closed/increased/decreased/reversed/no_change) + are provided, then positions matching any of these will be included. + + When combined with update reason filters (trades/funding_realization/settlement), + positions must match at least one position change filter AND at least one + update reason filter. + + If no filters are provided for the request, all position events will be included. + required: false +IncludeReversedPositions: + name: reversed + in: query + schema: + type: boolean + description: | + True if results should include reversed position events. Setting this to + false has no effect. + + If multiple position change filters (opened/closed/increased/decreased/reversed/no_change) + are provided, then positions matching any of these will be included. + + When combined with update reason filters (trades/funding_realization/settlement), + positions must match at least one position change filter AND at least one + update reason filter. + + If no filters are provided for the request, all position events will be included. + required: false +IncludeSettlementPositions: + name: settlement + in: query + schema: + type: boolean + description: | + True if results should include position events caused by a settlement. + Setting this to false has no effect. + + If multiple update reason filters (trades/funding_realization/settlement) + are provided, then positions matching any of these will be included. + + When combined with position change filters (opened/closed/increased/decreased/reversed/no_change), + positions must match at least one update reason filter AND at least one + position change filter. + + If no filters are provided for the request, all position events will be included. + required: false +IncludeTradePositions: + name: trades + in: query + schema: + type: boolean + description: | + True if results should include position events caused by a trade. + Setting this to false has no effect. + + If multiple update reason filters (trades/funding_realization/settlement) + are provided, then positions matching any of these will be included. + + When combined with position change filters (opened/closed/increased/decreased/reversed/no_change), + positions must match at least one update reason filter AND at least one + position change filter. + + If no filters are provided for the request, all position events will be included. + required: false +IsMultiCollateral: + name: isMultiCollateral + in: query + description: True if results should contain only data from multi-collateral markets. + required: false + schema: + type: boolean +OpenedOrder: + name: opened + in: query + schema: + type: boolean + description: | + Determines status of the orders that should be included in response(s). + + - `true` = return orders that have been placed within given time range. + - `false` = don't return orders that have been placed within given time range. + required: false +OpenedTrigger: + name: opened + in: query + schema: + type: boolean + description: | + Determines status of the triggers that should be included in response(s). + + - `true` = return triggers that have been placed within given time range. + - `false` = don't return triggers that have been placed within given time range. + required: false +SinceDateFilter: + name: since + in: query + description: Timestamp in milliseconds. + schema: { $ref: "_schemas.yml#/TimestampMilliseconds" } +SortOrder: + name: sort + in: query + description: | + Determines the order of events in response(s). + + - `asc` = chronological + - `desc` = reverse-chronological + required: false + schema: + type: string + enum: [asc, desc] + default: desc + x-exhaustive: true diff --git a/futures-rest/history/_responses.yml b/futures-rest/history/_responses.yml new file mode 100644 index 0000000..69ba02e --- /dev/null +++ b/futures-rest/history/_responses.yml @@ -0,0 +1,50 @@ +HistoryResponse: + description: History response + content: + application/json: + schema: + type: object + required: + - elements + - len + properties: + elements: + type: array + items: + type: object + required: + - uid + - timestamp + - event + properties: + uid: + type: string + timestamp: + type: integer + format: int64 + sequenceNumber: + type: integer + format: int64 + event: {} # TODO + accountUid: + type: string + format: uuid + len: + type: integer + x-rustType: usize + minimum: 0 + continuationToken: + type: string +RateLimited: + description: Rate limited. + content: + text/plain: + schema: + type: string + headers: + rate-limit-reset: + description: |- + Time remaining (in seconds) until repeat request (i.e., same cost) will be accepted. + schema: + type: integer + minimum: 1 diff --git a/futures-rest/history/_schemas.yml b/futures-rest/history/_schemas.yml new file mode 100644 index 0000000..81cf03d --- /dev/null +++ b/futures-rest/history/_schemas.yml @@ -0,0 +1,244 @@ +AccountLogEntry: + description: Account log entry + type: object + properties: + asset: + description: Asset related with the entry. + type: string + booking_uid: + description: UID of the log entry. + type: string + format: uuid + collateral: + description: Currency of the associated entry. + type: [string, "null"] + contract: + type: [string, "null"] + date: + $ref: "#/Rfc3339DateTime" + execution: + description: | + UID of the associated execution or transfer. + + For orders and trades, this is always a UUID. However, this field is also populated with + "cross-exchange transfer" references, which are not always UUIDs. + type: [string, "null"] + fee: + description: Fee paid + type: [number, "null"] + format: double + funding_rate: + description: Absolute funding rate at time of entry. + type: [number, "null"] + format: double + id: + description: Log entry ID. + type: integer + format: int64 + minimum: 1 + info: + description: Short description of the entry. + type: string + enum: + - futures trade + - futures liquidation + - futures assignor + - futures assignee + - futures unwind counterparty + - futures unwind bankrupt + - covered liquidation + - funding rate change + - conversion + - interest payment + - transfer + - cross-exchange transfer + - kfee applied + - subaccount transfer + - settlement + - admin transfer + margin_account: + description: Name of the wallet associated with the entry. + type: string + mark_price: + description: Mark price at the time the trade was executed. + type: [number, "null"] + format: double + new_average_entry_price: + description: Average entry price of the position after this trade. + type: [number, "null"] + format: double + new_balance: + description: | + New balance of wallet or new size of the position after the described in info action. + type: number + format: double + old_average_entry_price: + description: Average entry price of the position prior to this trade. + type: [number, "null"] + format: double + old_balance: + description: Account balance before the described in info action. + type: number + format: double + realized_funding: + description: Funding realized due to change in position size or end of funding rate period. + type: [number, "null"] + format: double + realized_pnl: + description: PnL that is realized by reducing the position. + type: [number, "null"] + format: double + trade_price: + description: Price at which the trade was executed. + type: [number, "null"] + format: double + conversion_spread_percentage: + description: Percentage conversion spread used in a currency conversion. + type: [number, "null"] + format: double + liquidation_fee: + description: | + Liquidation fee associated with a liquidation/assignment entry. + + Not applicable for inverse futures. + type: [number, "null"] + format: double + exchange_rate: + description: The exchange rate used for the conversion, USD quote. + type: [number] + format: double + conversion_fee: + description: The percentage fee charged for the conversion. E.g. 0.05 = 0.05%. + type: [number] + format: double + exchange_rate_from: + description: The currency code of the base currency in the exchange rate. + type: [string] + required: + - asset + - booking_uid + - collateral + - contract + - date + - execution + - fee + - funding_rate + - id + - info + - margin_account + - mark_price + - new_average_entry_price + - new_balance + - old_average_entry_price + - old_balance + - realized_funding + - realized_pnl + - trade_price + - conversion_spread_percentage + - liquidation_fee +AccountUid: + description: UID of the account + type: string + format: uuid +Decimal: + type: string + format: decimal + example: "1234.56789" +HistoricalPositionUpdateElement: + type: object + properties: + accountUid: + description: Account UID + type: string + tradeable: + type: string + oldPosition: + type: string + oldAverageEntryPrice: + type: [string, "null"] + newPosition: + type: string + newAverageEntryPrice: + type: string + fillTime: + type: [integer, "null"] + format: timestamp-milliseconds + fee: + type: string + feeCurrency: + type: string + realizedPnL: + type: string + positionChange: + type: string + enum: [open, close, increase, decrease, reverse, noChange] + executionUid: + type: string + executionPrice: + type: string + executionSize: + type: string + tradeType: + type: string + enum: [userExecution, liquidation, assignment, unwind] + fundingRealizationTime: + type: integer + format: timestamp-milliseconds + realizedFunding: + type: string + settlementPrice: + type: string + timestamp: + $ref: "#/TimestampMilliseconds" + updateReason: + type: string + enum: [trade, fundingRealisation, settlement] + required: + - accountUid + - tradeable + - oldPosition + - newPosition + - newAverageEntryPrice + - positionChange + - timestamp + - updateReason +MarkPriceChanged: + type: object + properties: + price: + $ref: "#/Decimal" + required: + - price +PriceElement: + type: object + properties: + uid: + type: string + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + event: + $ref: "#/MarkPriceChanged" + required: + - uid + - timestamp + - event +RegulatoryData: + type: object + properties: + venue: + type: string + counterparty: + type: string + externalUid: + type: string + format: uuid + required: [] +Rfc3339DateTime: + description: RFC 3339 formatted date-time + type: string + format: date-time + example: 2019-08-24T14:15:22Z +TimestampMilliseconds: + type: integer + format: timestamp-milliseconds + example: 1604937694000 diff --git a/futures-rest/history/api-public.yml b/futures-rest/history/api-public.yml new file mode 100644 index 0000000..9169fce --- /dev/null +++ b/futures-rest/history/api-public.yml @@ -0,0 +1,1172 @@ +openapi: 3.1.0 +info: + title: History + version: v3.0 +servers: + - url: https://futures.kraken.com/api/history/v3 + description: Kraken Futures + x-kfOnly: true +tags: + - name: Account History + description: | + Account History provides account-specific data, including account logs ( history of all balance and position changes) and history for executions, orders, and triggers. + + * The `/account-log` endpoint provides a paginated JSON response, with access to all account log history specified by ranges of timestamp or ID. + * The `/accountlogcsv` endpoint provides a CSV formatted response of 500,000 rows of most recent account logs. + See also the websocket feed of account log snapshots + * The `/executions` endpoint provides a paginated JSON response, with access to all private execution history specified by ranges of timestamp or ID + * The `/orders` endpoint provides a paginated JSON response, with access to all private order history specified by ranges of timestamp or ID + * The `/triggers` endpoint provides a paginated JSON response, with access to all private trigger history specified by ranges of timestamp or ID + - name: Market History +paths: + /market/{tradeable}/executions: + get: + operationId: getPublicExecutionEvents + tags: + - Market History + summary: Get public execution events + description: | + Lists trades for a market. + parameters: + - $ref: "_parameters.yml#/SinceDateFilter" + - $ref: "_parameters.yml#/BeforeDateFilter" + - $ref: "_parameters.yml#/SortOrder" + - $ref: "_parameters.yml#/ContinuationToken" + - $ref: "_parameters.yml#/Count" + - name: tradeable + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + type: object + properties: + len: + type: integer + format: uint64 + elements: + type: array + items: + $ref: "#/components/schemas/HistoricalExecutionElementSanitized" + continuationToken: + $ref: "#/components/schemas/NextContinuationToken" + required: + - elements + - len + /market/{tradeable}/orders: + get: + operationId: getPublicOrderEvents + tags: + - Market History + summary: Get public order events + description: | + Lists order events for a market. + parameters: + - $ref: "_parameters.yml#/SinceDateFilter" + - $ref: "_parameters.yml#/BeforeDateFilter" + - $ref: "_parameters.yml#/SortOrder" + - $ref: "_parameters.yml#/ContinuationToken" + - $ref: "_parameters.yml#/Count" + - name: tradeable + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + type: object + properties: + len: + type: integer + format: uint64 + elements: + type: array + items: + $ref: "#/components/schemas/HistoricalOrderElementSanitized" + continuationToken: + $ref: "#/components/schemas/NextContinuationToken" + required: + - len + - elements + /market/{tradeable}/price: + get: + operationId: getPublicPriceEvents + tags: + - Market History + summary: Get public mark price events + description: | + Lists price events for a market. + parameters: + - $ref: "_parameters.yml#/SinceDateFilter" + - $ref: "_parameters.yml#/BeforeDateFilter" + - $ref: "_parameters.yml#/SortOrder" + - $ref: "_parameters.yml#/ContinuationToken" + - $ref: "_parameters.yml#/Count" + - name: tradeable + in: path + required: true + schema: + type: string + responses: + "200": + description: "" + content: + application/json: + schema: + type: object + properties: + len: + type: integer + format: uint64 + elements: + type: array + items: + $ref: "_schemas.yml#/PriceElement" + continuationToken: + $ref: "#/components/schemas/NextContinuationToken" + required: + - len + - elements + /executions: + get: + operationId: getExecutionEvents + tags: + - Account History + summary: Get execution events + description: | + Lists executions/trades for authenticated account. + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - $ref: "_parameters.yml#/SinceDateFilter" + - $ref: "_parameters.yml#/BeforeDateFilter" + - $ref: "_parameters.yml#/SortOrder" + - $ref: "_parameters.yml#/ContinuationToken" + - $ref: "_parameters.yml#/Count" + - $ref: "#/components/parameters/Tradeable" + responses: + "200": + description: "" + content: + application/json: + schema: + type: object + properties: + accountUid: + type: string + format: uuid + len: + type: integer + format: uint64 + serverTime: + type: string + format: date-time + elements: + type: array + items: + $ref: "#/components/schemas/HistoricalExecutionElement" + continuationToken: + $ref: "#/components/schemas/NextContinuationToken" + required: + - accountUid + - len + - elements + /orders: + get: + operationId: getOrderEvents + tags: + - Account History + summary: Get order events + description: | + Lists order events for authenticated account. + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - $ref: "_parameters.yml#/SinceDateFilter" + - $ref: "_parameters.yml#/BeforeDateFilter" + - $ref: "_parameters.yml#/SortOrder" + - $ref: "_parameters.yml#/ContinuationToken" + - $ref: "_parameters.yml#/Count" + - $ref: "#/components/parameters/Tradeable" + - $ref: "_parameters.yml#/OpenedOrder" + - $ref: "_parameters.yml#/ClosedOrder" + responses: + "200": + description: "" + content: + application/json: + schema: + type: object + properties: + accountUid: + type: string + format: uuid + len: + type: integer + format: uint64 + serverTime: + type: string + format: date-time + elements: + type: array + items: + $ref: "#/components/schemas/HistoricalOrderElement" + continuationToken: + $ref: "#/components/schemas/NextContinuationToken" + required: + - accountUid + - len + - elements + /triggers: + get: + operationId: getTriggerEvents + tags: + - Account History + summary: Get trigger events + description: | + Lists trigger events for authenticated account. + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - $ref: "_parameters.yml#/SinceDateFilter" + - $ref: "_parameters.yml#/BeforeDateFilter" + - $ref: "_parameters.yml#/SortOrder" + - $ref: "_parameters.yml#/ContinuationToken" + - $ref: "_parameters.yml#/Count" + - $ref: "#/components/parameters/Tradeable" + - $ref: "_parameters.yml#/OpenedTrigger" + - $ref: "_parameters.yml#/ClosedTrigger" + responses: + "200": + description: "" + content: + application/json: + schema: + type: object + properties: + accountUid: + type: string + format: uuid + len: + type: integer + format: uint64 + serverTime: + type: string + format: date-time + elements: + type: array + items: + $ref: "#/components/schemas/HistoricalTriggerElement" + continuationToken: + $ref: "#/components/schemas/NextContinuationToken" + required: + - accountUid + - len + - elements + /positions: + get: + operationId: getPositionEvents + tags: + - Account History + summary: Get position update events + description: Lists position events for authenticated account. + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - $ref: "_parameters.yml#/SinceDateFilter" + - $ref: "_parameters.yml#/BeforeDateFilter" + - $ref: "_parameters.yml#/SortOrder" + - $ref: "_parameters.yml#/ContinuationToken" + - $ref: "_parameters.yml#/Count" + - $ref: "_parameters.yml#/IncludeOpenedPositions" + - $ref: "_parameters.yml#/IncludeClosedPositions" + - $ref: "_parameters.yml#/IncludeIncreasedPositions" + - $ref: "_parameters.yml#/IncludeDecreasedPositions" + - $ref: "_parameters.yml#/IncludeReversedPositions" + - $ref: "_parameters.yml#/IncludeNoChangePositions" + - $ref: "_parameters.yml#/IncludeTradePositions" + - $ref: "_parameters.yml#/IncludeFundingRealizationPositions" + - $ref: "_parameters.yml#/IncludeSettlementPositions" + - $ref: "#/components/parameters/Tradeable" + responses: + "200": + description: "" + content: + application/json: + schema: + type: object + properties: + accountUid: + type: string + format: uuid + len: + type: integer + format: uint64 + serverTime: + type: string + format: date-time + elements: + type: array + items: + $ref: "_schemas.yml#/HistoricalPositionUpdateElement" + continuationToken: + $ref: "#/components/schemas/NextContinuationToken" + required: + - accountUid + - len + - elements + /account-log: + get: + operationId: accountLog + tags: + - Account History + summary: Get account log + description: | + Lists account log entries, paged by timestamp or by ID. + + To request entries by time range, use the `since` and `before` parameters. + To request entries by ID range, use the `from` and `to` parameters. + Any combination of `since`, `before`, `from` and `to` can be used to restrict the requested range of entries. + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - description: "Unix timestamp in milliseconds." + name: since + in: query + required: false + schema: {$ref: "_schemas.yml#/TimestampMilliseconds"} + - description: "Unix timestamp in milliseconds." + name: before + in: query + required: false + schema: {$ref: "_schemas.yml#/TimestampMilliseconds"} + - description: "ID of the first entry (inclusive). IDs start at 1." + name: from + in: query + required: false + schema: + type: integer + example: 1 + - description: "ID of the last entry (inclusive)." + name: to + in: query + required: false + schema: + type: integer + example: 100 + - description: | + Order of events in response. `asc` = chronological, `desc` = reverse-chronological. + name: sort + in: query + required: false + schema: + type: string + enum: + - asc + - desc + default: desc + - description: "Type of entry to filter by. Only this type will be returned." + name: info + in: query + required: false + schema: + type: string + enum: + - futures trade + - futures liquidation + - futures assignor + - futures assignee + - futures unwind counterparty + - futures unwind bankrupt + - covered liquidation + - funding rate change + - conversion + - interest payment + - transfer + - cross-exchange transfer + - kfee applied + - subaccount transfer + - settlement + - admin transfer + - tax withheld + - tax refund + example: futures trade + - description: Amount of entries to be returned. + name: count + in: query + required: false + schema: + type: integer + default: 500 + - description: Include exchange rate and conversion fee for conversions. + name: conversion_details + in: query + required: false + schema: + type: boolean + default: false + responses: + "200": + description: Account log. + content: + application/json: + schema: + title: "Account Log Response" + type: object + properties: + accountUid: + $ref: "_schemas.yml#/AccountUid" + logs: + type: array + items: + $ref: "_schemas.yml#/AccountLogEntry" + required: + - accountUid + - logs + "429": + $ref: _responses.yml#/RateLimited + /accountlogcsv: + get: + operationId: accountLogCsv + tags: + - Account History + summary: Account log (CSV) + description: | + Lists recent account log entries in CSV format. + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - description: Include exchange rate, exchange rate from currency, and conversion fee for conversions. + name: conversion_details + in: query + required: false + schema: + type: boolean + default: false + responses: + "200": + description: A CSV formatted response of most recent account log entries. + "401": + description: Credentials required. + "429": + $ref: _responses.yml#/RateLimited +components: + securitySchemes: + authent: + type: apiKey + description: Authentication string + in: header + name: Authent + x-inlineDescription: true + general-api-key-read-only: + type: apiKey + description: General API key with at least **read-only** access + in: header + name: APIKey + x-inlineDescription: true + parameters: + Tradeable: + description: If present events of other tradeables are filtered out. + name: tradeable + in: query + required: false + schema: + type: string + schemas: + FeeCalculationInfoElement: + type: object + properties: + percentageFee: + $ref: "_schemas.yml#/Decimal" + userFeeDiscountApplied: + oneOf: + - $ref: "_schemas.yml#/Decimal" + - type: "null" + marketShareRebateCredited: + oneOf: + - $ref: "_schemas.yml#/Decimal" + - type: "null" + required: + - percentageFee + - userFeeDiscountApplied + - marketShareRebateCredited + HistoricalExecution: + type: object + properties: + uid: + type: string + format: uuid + makerOrder: + $ref: "#/components/schemas/HistoricalOrder" + takerOrder: + $ref: "#/components/schemas/HistoricalOrder" + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + quantity: + $ref: "_schemas.yml#/Decimal" + price: + $ref: "_schemas.yml#/Decimal" + markPrice: + $ref: "_schemas.yml#/Decimal" + limitFilled: + type: boolean + oldTakerOrder: + $ref: "#/components/schemas/HistoricalOrder" + usdValue: + $ref: "_schemas.yml#/Decimal" + makerOrderData: + $ref: "#/components/schemas/MakerOrderData" + nullable: true + takerOrderData: + $ref: "#/components/schemas/TakerOrderData" + nullable: true + regulatoryData: + $ref: "_schemas.yml#/RegulatoryData" + required: + - uid + - makerOrder + - takerOrder + - timestamp + - quantity + - price + - markPrice + - limitFilled + - usdValue + - makerOrderData + - takerOrderData + HistoricalExecutionDetails: + type: object + properties: + execution: + $ref: "#/components/schemas/HistoricalExecution" + takerReducedQuantity: + description: sometimes empty string + type: string + required: + - execution + - takerReducedQuantity + HistoricalExecutionDetailsSanitized: + type: object + properties: + execution: + $ref: "#/components/schemas/HistoricalExecutionSanitized" + takerReducedQuantity: + description: sometimes empty string + type: string + required: + - execution + - takerReducedQuantity + HistoricalExecutionElement: + type: object + properties: + uid: + type: string + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + event: + $ref: "#/components/schemas/HistoricalExecutionEvent" + required: + - uid + - timestamp + - event + HistoricalExecutionElementSanitized: + type: object + properties: + uid: + type: string + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + event: + $ref: "#/components/schemas/HistoricalExecutionEventSanitized" + required: + - uid + - timestamp + - event + HistoricalExecutionEvent: + type: object + properties: + Execution: + $ref: "#/components/schemas/HistoricalExecutionDetails" + required: + - Execution + HistoricalExecutionEventSanitized: + type: object + properties: + Execution: + $ref: "#/components/schemas/HistoricalExecutionDetailsSanitized" + required: + - Execution + HistoricalExecutionSanitized: + type: object + properties: + uid: + type: string + format: uuid + makerOrder: + $ref: "#/components/schemas/HistoricalOrderSanitized" + takerOrder: + $ref: "#/components/schemas/HistoricalOrderSanitized" + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + quantity: + $ref: "_schemas.yml#/Decimal" + price: + $ref: "_schemas.yml#/Decimal" + markPrice: + $ref: "_schemas.yml#/Decimal" + limitFilled: + type: boolean + oldTakerOrder: + $ref: "#/components/schemas/HistoricalOrderSanitized" + usdValue: + $ref: "_schemas.yml#/Decimal" + required: + - uid + - makerOrder + - takerOrder + - timestamp + - quantity + - price + - markPrice + - limitFilled + - usdValue + HistoricalOrder: + type: object + properties: + uid: + type: string + format: uuid + accountUid: + type: string + format: uuid + tradeable: + type: string + direction: + type: string + enum: + - Buy + - Sell + quantity: + $ref: "_schemas.yml#/Decimal" + filled: + $ref: "_schemas.yml#/Decimal" + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + limitPrice: + $ref: "_schemas.yml#/Decimal" + orderType: + type: string + enum: + - Limit + - IoC + - Post + - Market + - Liquidation + - Assignment + - Unwind + clientId: + type: string + reduceOnly: + type: boolean + lastUpdateTimestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + spotData: + type: + - string + - "null" + regulatoryExternalUid: + type: string + format: uuid + required: + - uid + - accountUid + - tradeable + - direction + - quantity + - filled + - timestamp + - limitPrice + - orderType + - clientId + - reduceOnly + - lastUpdateTimestamp + - spotData + HistoricalOrderElement: + type: object + properties: + uid: + type: string + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + event: + $ref: "#/components/schemas/HistoricalOrderEvent" + required: + - uid + - timestamp + - event + HistoricalOrderElementSanitized: + type: object + properties: + uid: + type: string + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + event: + $ref: "#/components/schemas/HistoricalOrderEventSanitized" + required: + - uid + - timestamp + - event + HistoricalOrderEvent: + type: object + oneOf: + - type: object + properties: + OrderPlaced: {$ref: "#/components/schemas/OrderPlaced"} + required: + - OrderPlaced + - type: object + properties: + OrderUpdated: {$ref: "#/components/schemas/OrderUpdated"} + required: + - OrderUpdated + - type: object + properties: + OrderRejected: {$ref: "#/components/schemas/OrderRejected"} + required: + - OrderRejected + - type: object + properties: + OrderCancelled: {$ref: "#/components/schemas/OrderCancelled"} + required: + - OrderCancelled + - type: object + properties: + OrderNotFound: {$ref: "#/components/schemas/OrderNotFound"} + required: + - OrderNotFound + - type: object + properties: + OrderEditRejected: {$ref: "#/components/schemas/OrderEditRejected"} + required: + - OrderEditRejected + HistoricalOrderEventSanitized: + type: object + oneOf: + - type: object + properties: + OrderPlaced: {$ref: "#/components/schemas/OrderPlacedSanitized"} + required: + - OrderPlaced + - type: object + properties: + OrderUpdated: {$ref: "#/components/schemas/OrderUpdatedSanitized"} + required: + - OrderUpdated + - type: object + properties: + OrderCancelled: {$ref: "#/components/schemas/OrderCancelledSanitized"} + required: + - OrderCancelled + HistoricalOrderSanitized: + type: object + properties: + uid: + type: string + format: uuid + tradeable: + type: string + direction: + type: string + enum: + - Buy + - Sell + quantity: + $ref: "_schemas.yml#/Decimal" + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + limitPrice: + $ref: "_schemas.yml#/Decimal" + orderType: + type: string + reduceOnly: + type: boolean + lastUpdateTimestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + required: + - uid + - tradeable + - direction + - quantity + - timestamp + - limitPrice + - orderType + - reduceOnly + - lastUpdateTimestamp + HistoricalTrigger: + type: object + properties: + uid: + type: string + format: uuid + accountId: + type: number + format: uint64 + accountUid: + type: string + format: uuid + tradeable: + type: string + direction: + type: string + enum: + - Buy + - Sell + quantity: + $ref: "_schemas.yml#/Decimal" + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + limitPrice: + $ref: "_schemas.yml#/Decimal" + orderType: + type: string + clientId: + type: string + reduceOnly: + type: boolean + lastUpdateTimestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + triggerOptions: + $ref: "#/components/schemas/TriggerOptions" + required: + - uid + - accountId + - accountUid + - tradeable + - direction + - quantity + - timestamp + - limitPrice + - orderType + - clientId + - reduceOnly + - lastUpdateTimestamp + - triggerOptions + HistoricalTriggerElement: + type: object + properties: + uid: + type: string + timestamp: + $ref: "_schemas.yml#/TimestampMilliseconds" + event: + $ref: "#/components/schemas/HistoricalTriggerEvent" + required: + - uid + - timestamp + - event + HistoricalTriggerEvent: + type: object + oneOf: + - type: object + properties: + OrderTriggerPlaced: {$ref: "#/components/schemas/TriggerPlaced"} + required: + - OrderTriggerPlaced + - type: object + properties: + OrderTriggerCancelled: {$ref: "#/components/schemas/TriggerCancelled"} + required: + - OrderTriggerCancelled + - type: object + properties: + OrderTriggerUpdated: {$ref: "#/components/schemas/TriggerUpdated"} + required: + - OrderTriggerUpdated + - type: object + properties: + OrderTriggerActivated: {$ref: "#/components/schemas/TriggerActivated"} + required: + - OrderTriggerActivated + - type: object + properties: + OrderTriggerEditRejected: {$ref: "#/components/schemas/TriggerEditRejected"} + required: + - OrderTriggerEditRejected + MakerOrderData: + type: object + properties: + fee: + $ref: "_schemas.yml#/Decimal" + positionSize: + $ref: "_schemas.yml#/Decimal" + feeCalculationInfo: + type: array + items: + $ref: "#/components/schemas/FeeCalculationInfoElement" + required: + - fee + - positionSize + - feeCalculationInfo + NextContinuationToken: + description: | + Opaque token to pass to the next request to continue listing events. The `sort` parameter + must be the same as in the previous request to continue listing in the same direction. + type: string + format: base64 + OrderCancelled: + type: object + properties: + order: + $ref: "#/components/schemas/HistoricalOrder" + reason: + type: string + required: + - order + - reason + OrderCancelledSanitized: + type: object + properties: + order: + $ref: "#/components/schemas/HistoricalOrderSanitized" + reason: + type: string + required: + - order + - reason + OrderEditRejected: + type: object + properties: + oldOrder: + $ref: "#/components/schemas/HistoricalOrder" + attemptedOrder: + $ref: "#/components/schemas/HistoricalOrder" + orderError: + type: string + required: + - oldOrder + - attemptedOrder + - orderError + OrderNotFound: + type: object + properties: + accountUid: + type: string + format: uuid + orderId: + type: string + example: Uuid(uuid=2ceb1d31-f619-457b-870c-fd4ddbb10d45) + required: + - accountUid + - orderId + OrderPlaced: + type: object + properties: + order: + $ref: "#/components/schemas/HistoricalOrder" + reason: + type: string + reducedQuantity: + description: always empty string + type: string + required: + - order + - reason + - reducedQuantity + OrderPlacedSanitized: + type: object + properties: + order: + $ref: "#/components/schemas/HistoricalOrderSanitized" + reason: + type: string + reducedQuantity: + description: always empty string + type: string + required: + - order + - reason + - reducedQuantity + OrderRejected: + type: object + properties: + order: + $ref: "#/components/schemas/HistoricalOrder" + orderError: + type: string + reason: + type: string + required: + - order + - orderError + - reason + OrderUpdated: + type: object + properties: + oldOrder: + $ref: "#/components/schemas/HistoricalOrder" + newOrder: + $ref: "#/components/schemas/HistoricalOrder" + reason: + type: string + reducedQuantity: + $ref: "_schemas.yml#/Decimal" + required: + - oldOrder + - newOrder + - reason + - reducedQuantity + OrderUpdatedSanitized: + type: object + properties: + oldOrder: + $ref: "#/components/schemas/HistoricalOrderSanitized" + newOrder: + $ref: "#/components/schemas/HistoricalOrderSanitized" + reason: + type: string + reducedQuantity: + $ref: "_schemas.yml#/Decimal" + required: + - oldOrder + - newOrder + - reason + - reducedQuantity + PriceOffset: + type: object + properties: + priceOffset: + $ref: "_schemas.yml#/Decimal" + unit: + type: string + enum: + - Percent + - QuoteCurrency + required: + - priceOffset + - unit + TakerOrderData: + type: object + properties: + fee: + $ref: "_schemas.yml#/Decimal" + positionSize: + $ref: "_schemas.yml#/Decimal" + feeCalculationInfo: + type: array + items: + $ref: "#/components/schemas/FeeCalculationInfoElement" + required: + - fee + - positionSize + - feeCalculationInfo + TrailingStopOptions: + type: object + properties: + maxDeviation: + $ref: "_schemas.yml#/Decimal" + unit: + type: string + enum: + - Percent + - QuoteCurrency + required: + - maxDeviation + - unit + TriggerActivated: + type: object + properties: + order: + $ref: "#/components/schemas/HistoricalTrigger" + required: + - order + TriggerCancelled: + type: object + properties: + order: + $ref: "#/components/schemas/HistoricalTrigger" + reason: + type: string + required: + - order + - reason + TriggerEditRejected: + type: object + properties: + attemptedOrderTrigger: + $ref: "#/components/schemas/HistoricalTrigger" + oldOrderTrigger: + $ref: "#/components/schemas/HistoricalTrigger" + reason: + type: string + orderError: + type: string + required: + - attemptedOrderTrigger + - oldOrderTrigger + - reason + - orderError + TriggerOptions: + type: object + properties: + triggerPrice: + $ref: "_schemas.yml#/Decimal" + triggerSignal: + type: string + enum: + - "MarkPrice" + - "LastPrice" + - "SpotPrice" + triggerSide: + type: string + enum: + - "Above" + - "Below" + trailingStopOptions: + $ref: "#/components/schemas/TrailingStopOptions" + limitPriceOffset: + $ref: "#/components/schemas/PriceOffset" + required: + - triggerPrice + - triggerSignal + - triggerSide + - trailingStopOptions + - limitPriceOffset + TriggerPlaced: + type: object + properties: + order: + $ref: "#/components/schemas/HistoricalTrigger" + reason: + type: string + required: + - order + - reason + TriggerUpdated: + type: object + properties: + oldOrderTrigger: + $ref: "#/components/schemas/HistoricalTrigger" + newOrderTrigger: + $ref: "#/components/schemas/HistoricalTrigger" + reason: + type: string + required: + - oldOrderTrigger + - newOrderTrigger + - reason diff --git a/futures-rest/stats/public.yml b/futures-rest/stats/public.yml new file mode 100644 index 0000000..b471f34 --- /dev/null +++ b/futures-rest/stats/public.yml @@ -0,0 +1,234 @@ +openapi: 3.1.0 +info: + title: Stats + version: 1.0.0 +servers: + - url: 'https://futures.kraken.com/api/stats/v1' + description: Production +tags: + - name: Market Share +paths: + /rebates/self-market-share: + get: + operationId: rebates::get_self_market_share + tags: + - Market Share + summary: Get account's market share + description: | + Get account's market share, volumes, and accrued rebates data in contracts configured for + rebates. + + The data may not be available immediately. In these cases HTTP 204 is returned. + security: + - bearerAuth: [] + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: User's market share in contracts they have traded in. + content: + application/json: + schema: + $ref: '#/components/schemas/UserMarketShareResponse' + examples: + success: + $ref: "#/components/examples/RebatesMarketShareExample" + '204': + description: Market shares not yet aggregated. +components: + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + authent: + description: Authentication string + in: header + name: authent + type: apiKey + x-inlineDescription: true + general-api-key-read-only: + description: General API key with at least **read-only** access + in: header + name: apikey + type: apiKey + x-inlineDescription: true + parameters: + LeaderboardId: + description: Id of a leaderboard + in: path + name: leaderboardId + required: true + schema: + type: string + format: uuid + examples: + RebatesMarketShareExample: + value: + contracts: + PF_ETHUSD: + marketShare: "0.002" + usdRebateCredited: "500.10" + volume: "120132.45" + PF_FETUSD: + marketShare: "0.08" + usdRebateCredited: "120.00" + volume: "44862.81" + PF_XBTUSD: + marketShare: "0.015" + usdRebateCredited: "1250.75" + volume: "892456.32" + schemas: + Leaderboard: + type: object + required: + - id + - startAt + - endAt + - refreshedAt + - rollDurationMicros + - rankBy + properties: + id: + type: string + format: uuid + startAt: + type: string + format: date-time + endAt: + type: + - string + - 'null' + format: date-time + refreshedAt: + type: + - string + - 'null' + format: date-time + rollDurationMicros: + type: + - integer + - 'null' + format: int64 + rankBy: + $ref: '#/components/schemas/RankBy' + RankBy: + type: string + enum: + - 'pnl' + - 'roi' + - 'volume' + Account: + type: object + required: + - nickname + - rank + - roi + - pnl + - volume + properties: + nickname: + type: string + rank: + type: integer + format: int64 + roi: + type: number + format: double + pnl: + type: number + format: double + volume: + type: number + format: double + MyselfResponseRegistrations: + type: object + required: + - leaderboardId + - banned + - registeredAt + - rank + - roi + - pnl + - volume + properties: + leaderboardId: + type: string + format: uuid + banned: + type: boolean + registeredAt: + type: string + format: date-time + rank: + type: + - integer + - 'null' + format: int64 + roi: + type: + - number + - 'null' + format: double + pnl: + type: + - number + - 'null' + format: double + volume: + type: + - number + - 'null' + format: double + MyselfResponse: + type: object + required: + - nickname + - registeredTo + properties: + nickname: + type: + - string + - 'null' + registeredTo: + type: array + items: + $ref: '#/components/schemas/MyselfResponseRegistrations' + UserMarketShareResponse: + type: object + required: + - contracts + properties: + contracts: + type: object + description: | + Map of contracts. The key is the contract symbol and the value is an object containing + user's volume, market share, and rebate accrued in USD terms in that contract + over configured observation period. + additionalProperties: + type: object + required: + - marketShare + - volume + - usdRebateCredited + properties: + marketShare: + type: string + format: decimal + volume: + type: string + format: decimal + usdRebateCredited: + type: string + format: decimal + example: {"contracts": {"PF_ETHUSD": {"volume": "120132.45", "marketShare": "0.002", "usdRebateCredited": "500.10"}, "PF_FETUSD": {"volume": "44862.81", "marketShare": "0.08", "usdRebateCredited": "120.00"}}} + SerializedError: + type: object + required: + - kind + - description + properties: + kind: + type: string + description: + type: string diff --git a/futures-rest/trading/_parameters.yml b/futures-rest/trading/_parameters.yml new file mode 100644 index 0000000..61c90b3 --- /dev/null +++ b/futures-rest/trading/_parameters.yml @@ -0,0 +1,116 @@ +AccountUidPath: + description: Account UID + name: accountUid + in: path + required: true + schema: + type: string + format: uuid +AlgoIdPath: + description: Algorithm ID + name: algoId + in: path + required: true + schema: + type: string + example: M1V4ZS2OQ51EIH8D4XB1JI4PMA03G0Q +ContractTypesQuery: + description: |- + Contract type(s) to return statuses for. + + By default, includes all futures instrument types. + + Multi-value example: `?contractType=futures_inverse&contractType=futures_vanilla` + name: contractType + in: query + required: false + style: form + explode: true + schema: + type: array + items: + $ref: "_schemas.yml#/ContractType" + x-internalOnly: true # may remove when instrument endpoints contract type filter is enabled in prod +CountryCodeIso2Path: + description: ISO-2 country code, upper case + name: country + in: path + required: true + schema: + type: string + example: GB +CurrencyPairPath: + name: currencyPair + in: path + required: true + schema: + type: string + example: BTC:USD +CurrencyPath: + description: Currency code, the string identifier for a currency. + name: code + in: path + required: true + schema: + type: string + example: BTC +DocumentNamePath: + description: Name of document to be signed + name: documentName + in: path + required: true + schema: + $ref: _schemas.yml#/PlatformDocumentName +FeeScheduleUidPath: + description: Fee schedule UID + name: feeScheduleUid + in: path + required: true + schema: + type: string + format: uuid +IndexProviderUidPath: + description: Index Provider UID + name: indexProviderUid + in: path + required: true + schema: + type: string + format: uuid +IndexUidPath: + description: Index UID + name: indexUid + in: path + required: true + schema: + type: string + format: uuid +MarketSymbolPath: + description: Market symbol. + name: symbol + in: path + required: true + schema: + $ref: _schemas.yml#/MarketSymbol +MarketSymbolQueryRequired: + description: Market symbol. + name: symbol + in: query + required: true + schema: + $ref: _schemas.yml#/MarketSymbol +PlatformPath: + description: Platform name + name: platform + in: path + required: true + schema: + $ref: _schemas.yml#/PlatformName +UserAppUidPath: + description: Application UID. + name: userAppUid + in: path + required: true + schema: + type: string + format: uuid diff --git a/futures-rest/trading/_responses.yml b/futures-rest/trading/_responses.yml new file mode 100644 index 0000000..c3cebb4 --- /dev/null +++ b/futures-rest/trading/_responses.yml @@ -0,0 +1,54 @@ +Default: + description: OK + content: + application/json: + schema: + $ref: "_schemas.yml#/ResponseJson" +Error: + description: Error + content: + application/json: + schema: + $ref: "_schemas.yml#/ErrorResponse" +MissingPermission: + description: This admin account does not have the required permission. +RateLimited: + x-summary: Rate limited + description: | + Rate limit exceeded. + + Wait for your account's rate limiter bucket to refill sufficiently before trying again. + + - Error `code`: 10 + content: + application/json: + schema: + allOf: + - type: object + properties: + status: + type: string + enum: [TOO_MANY_REQUESTS] + required: + - status + - $ref: "_schemas.yml#/ErrorResponse" +RfaSubmitted: + description: Request for approval submitted +Unauthenticated: + x-summary: Unauthenticated + description: | + Authentication details are missing or invalid. + + - Error `code`: 18 + content: + application/json: + schema: + allOf: + - type: object + properties: + status: + type: string + enum: [UNAUTHORIZED] + required: + - status + - $ref: "_schemas.yml#/ErrorResponse" diff --git a/futures-rest/trading/_schemas.yml b/futures-rest/trading/_schemas.yml new file mode 100644 index 0000000..890bdad --- /dev/null +++ b/futures-rest/trading/_schemas.yml @@ -0,0 +1,526 @@ +AdminAccessLevel: + description: Tier of access granted with an admin role. + type: string + enum: + - READ_ONLY + - READ_AND_WRITE + - FULL_ACCESS +AdminRole: + description: Role given to an account that enables access to a set of admin resources. + type: string + enum: + - GENERAL + - ACCOUNT_ACCESS + - KYC + - TRADING + - ADVANCED_TRADING + - ADVANCED_KYC + - TRANSFERS + - FIAT + - AUDIT_LOG_DETAILS + - HOLDS + - SURVEILLANCE + - OTHER + - ADMIN_MANAGEMENT + - EMAIL_TEMPLATES + - FEES_ACCOUNT_CHANGES + - MARKET + - MTF_MEMBER_DETAILS + - COMPETITIONS + - LEADERBOARD + - REGION_RESTRICTIONS + - ACCOUNT_RESTRICTIONS + - EXTERNAL_CUSTODY + - MARKET_RESTRICTIONS + - BROKER_API +AssetSymbol: + description: Asset symbol + type: string + pattern: "[A-Z0-9]+" + example: BTC +BigDecimalString: + type: string + format: big-decimal + example: "12.0353200" +ContractType: + type: string + enum: + - futures_inverse + - futures_vanilla + - flexible_futures + # - options +CountryCodeAlpha2: + description: Alpha-2 country code, upper case. + type: string + example: GB +CountryCodeIso2: + description: ISO-2 country code, upper case. + type: string + example: GB +CurrencyCode: + description: Currency code, upper case. + type: string + example: EUR +DecimalDouble: + type: number + format: double + example: 12.03532 +DecimalString: + type: string + format: decimal + example: "12.0353200" +Error: + type: object + properties: + code: + type: [number, "null"] + message: + type: string + required: + - code + - message +ErrorResponse: + type: object + properties: + result: + type: string + enum: [error] + serverTime: + type: string + format: date-time + errors: + type: array + items: + $ref: "#/Error" + required: + - result + - serverTime + - errors +IdentifierSchema: + type: string + enum: + - CONCAT + - NIDN + - CCPT +IndexCode: + description: Index code + type: string + pattern: "[0-9A-Za-z-_:]+" + example: LTCUSD_RTI +MarketSymbol: + description: Market symbol + type: string + pattern: "[A-Z0-9_.]+" + example: PF_BTCUSD +NonNegativeDecimalDouble: + type: number + format: double + example: 12.03532 + minimum: 0.0 +OpenPositionJson: + type: object + properties: + symbol: + type: string + description: The symbol of the Futures. + side: + type: string + enum: + - long + - short + description: The direction of the position. + size: + format: double + type: number + description: The size of the position. + price: + format: double + type: number + description: The average price at which the position was entered into. + fillTime: + type: string + description: |- + The date and time the position was entered into (Deprecated field, fills endpoint for + fill time is recommended). + unrealizedFunding: + type: [number, "null"] + format: double + description: Unrealised funding on the position. + pnlCurrency: + x-kfOnly: true + type: [string, "null"] + enum: + - USD + - EUR + - GBP + - USDC + - USDT + - BTC + - ETH + description: |- + Selected pnl currency for the position (default: USD) + maxFixedLeverage: + x-kfOnly: true + type: [number, "null"] + format: double + description: Max leverage selected for isolated position. + greeks: + x-kfOnly: true + x-internalOnly: true + $ref: "#/OptionGreeks" + description: The position Greeks, if this is an option position. + required: + - symbol + - side + - size + - price + - fillTime + - unrealizedFunding +OptionGreeks: + description: Option Greeks + type: object + properties: + iv: + type: number + format: double + description: + The implied volatility. Displays an IV of -1.0 whenever the IV is impossible to calculate or + outside of the bounds allowed. + delta: + type: number + format: double + gamma: + type: [number, "null"] + format: double + vega: + type: [number, "null"] + format: double + theta: + type: [number, "null"] + format: double + rho: + type: [number, "null"] + format: double + required: + - iv + - delta + - gamma + - vega + - theta + - rho +OptionIvInstrument: + type: object + properties: + instrument: + type: string + price: + type: number + format: double + required: + - instrument + - price +OptionIvInstrumentWithIv: + type: object + properties: + instrument: + type: string + price: + type: number + format: double + iv: + type: number + format: double + description: + Returns an IV of -1.0 whenever the IV request is impossible to calculate or outside of the + bounds allowed. + required: + - instrument + - price + - iv +OptionsUserLimits: + type: object + properties: + maxNetPositionDelta: + $ref: "#/DecimalDouble" + limitsPerBaseCurrency: + description: User limits per option contract base currency + type: object + additionalProperties: + $ref: "#/OptionsUserLimitsPerBaseCurrency" + required: + - maxNetPositionDelta + - limitsPerBaseCurrency +OptionsUserLimitsPerBaseCurrency: + type: object + properties: + maxTotalPositionSize: + $ref: "#/DecimalDouble" + maxTotalOpenOrdersSize: + $ref: "#/DecimalDouble" + required: + - maxTotalPositionSize + - maxTotalOpenOrdersSize +OrderDirection: + description: Order direction + type: string + enum: + - buy + - sell +OrderType: + description: Order type. + type: string + enum: + - limit + - market + - stop + - take_profit + - post + - ioc + - fok + - trailing_stop +PlatformDocumentName: + type: string + minLength: 3 + maxLength: 60 + pattern: "[a-z_]+" + example: terms_and_conditions +PlatformName: + type: string + minLength: 3 + maxLength: 30 + pattern: "[a-z_]+" + example: mtf +PortfolioMarginBreakdown: + description: Breakdown of components that make up the portfolio margin calculation. + type: object + properties: + totalCrossAssetNettedMarketRisk: + type: number + format: double + totalMarketRisk: + type: number + format: double + totalScenarioPnls: + type: array + items: + type: number + format: double + totalAbsoluteOptionPositionDeltaNotional: + type: number + format: double + netPortfolioDelta: + type: number + format: double + totalPremium: + type: number + format: double + isBuyOnly: + type: boolean + futuresMaintenanceMargin: + type: number + format: double + required: + - totalCrossAssetNettedMarketRisk + - totalMarketRisk + - totalAbsoluteOptionPositionDeltaNotional + - netPortfolioDelta + - totalPremium + - isBuyOnly + - futuresMaintenanceMargin +PortfolioMarginingParameters: + type: object + properties: + crossAssetNettingFactor: + $ref: "#/DecimalDouble" + extremePriceShockMultiplier: + $ref: "#/DecimalDouble" + volShockMultiplicationFactor: + $ref: "#/DecimalDouble" + volShockExponentFactor: + $ref: "#/DecimalDouble" + optionExpiryTimeShockHours: + type: number + format: uint64 + optionsInitialMarginFactor: + $ref: "#/DecimalDouble" + totalOptionOrdersConsideredInInitialMarginCalc: + type: number + format: uint64 + priceShockLevels: + type: array + items: + $ref: "#/DecimalDouble" + optionsUserLimits: + $ref: "#/OptionsUserLimits" + required: + - crossAssetNettingFactor + - extremePriceShockMultiplier + - volShockMultiplicationFactor + - volShockExponentFactor + - optionExpiryTimeShockHours + - optionsInitialMarginFactor + - totalOptionOrdersConsideredInInitialMarginCalc + - priceShockLevels + - optionsUserLimits +PortfolioSimulationPosition: + type: object + properties: + instrument: + type: string + example: PF_BTCUSD + size: + $ref: "#/DecimalDouble" + entryPrice: + $ref: "#/DecimalDouble" + required: + - instrument + - size + - entryPrice +PortfolioSimulationRequest: + type: object + properties: + positions: + type: array + items: + $ref: "#/PortfolioSimulationPosition" + required: + - positions +PortfolioSimulationResponse: + type: object + properties: + maintenanceMargin: + type: number + format: double + initialMargin: + type: number + format: double + pnl: + type: number + format: double + portfolioMarginBreakdown: + $ref: "#/PortfolioMarginBreakdown" + greeks: + type: object + additionalProperties: + $ref: "#/OptionGreeks" + required: + - maintenanceMargin + - initialMargin + - pnl + - portfolioMarginBreakdown + - greeks +ReportName: + description: Report name. + type: string + enum: + - client-balances + - client-positions + - client-open-orders + - funding-pnl-fees + - net-transfers-deposits + - net-transfers-withdrawals + - market-data + - flex-conversions +ResponseJson: + type: object + properties: + result: + type: string + enum: [success] + serverTime: + type: string + format: date-time + required: + - result + - serverTime +Rfc3339DateTime: + description: RFC 3339 formatted date-time + type: string + format: date-time + example: 2019-08-24T14:15:22Z +Rfc3339DateTimeZoneless: + description: RFC 3339 formatted date-time (without timezone) + type: string + example: 2019-08-24T14:15:22 +SimpleInvestorType: + description: Investor type + type: string + enum: + - RETAIL + - PROFESSIONAL +SimulateIvRequest: + type: object + properties: + options: + type: array + items: + $ref: "#/OptionIvInstrument" + required: + - options +SimulateIvResponse: + type: object + properties: + options: + type: array + items: + $ref: "#/OptionIvInstrumentWithIv" + required: + - options +TeOrderDirection: + description: Order direction + type: string + enum: + - BUY + - SELL +TeOrderType: + description: Order type. + type: string + enum: + - LIMIT + - IMMEDIATE_OR_CANCEL + - POST_ONLY + - LIQUIDATION + - ASSIGNMENT + - STOP + - UNWIND + - MARKET + - COVERED_LIQUIDATION + - HEDGE_IMMEDIATE_OR_CANCEL + - HEDGE_ASSIGNMENT +TeTriggerOffsetUnit: + description: Trigger offset unit. + type: string + enum: + - QUOTE_CURRENCY + - PERCENT +TeTriggerSide: + description: Trigger side. + type: string + enum: + - TRIGGER_ABOVE + - TRIGGER_BELOW +TeTriggerSignal: + description: Trigger signal. + type: string + enum: + - MARK_PRICE + - LAST_PRICE + - SPOT_PRICE +TeTriggerType: + description: Trigger type. + type: string + enum: + - TAKE_PROFIT + - STOP_LOSS +TriggerSignal: + description: Trigger signal. + type: string + enum: + - mark + - index + - last +UtcTimestampMilliseconds: + description: UTC Timestamp (milliseconds) + type: number + format: uint64 + example: 1701466700000 diff --git a/futures-rest/trading/public.yml b/futures-rest/trading/public.yml new file mode 100644 index 0000000..3377d44 --- /dev/null +++ b/futures-rest/trading/public.yml @@ -0,0 +1,5955 @@ +openapi: 3.1.0 +info: + title: Trading + version: v3 +servers: +- url: https://futures.kraken.com/derivatives/api/v3 + description: Kraken Futures +tags: +- name: Market Data +- name: Instrument Details + description: '- The `/instruments/status` endpoint provides a list of statuses for + all instruments. + + - The `/instruments/{symbol}/status` endpoint provides the status of a single + instrument.' +- name: Order Management +- name: Multi-Collateral + description: Endpoints pertaining to the multi-collateral (MC) futures markets. +- name: Account Information +- name: Assignment Program +- name: Fee Schedules +- name: General +- name: Historical Data +- name: Historical Funding Rates +- name: Trading Settings +- name: Subaccounts +- name: Transfers +- name: RFQs +paths: + /pnlpreferences: + get: + operationId: getPnlCurrencyPreference + tags: + - Multi-Collateral + summary: Get PNL currency preference for a market + description: 'The PNL currency preference is used to determine which currency + to pay out when realizing + + PNL gains.' + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: OK + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + preferences: + type: array + items: + $ref: '#/components/schemas/PnlPreference' + required: + - preferences + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/GetPnlPreferencesExample' + put: + operationId: setPnlCurrencyPreference + tags: + - Multi-Collateral + summary: Set PNL currency preference for a market + description: "The PNL currency preference is used to determine which currency\ + \ to pay out when realizing\nPNL gains. Calling this API can result in the\ + \ following error codes:\n\n\n 87: Contract does not exist\n\n 88: Contract\ + \ not a multi-collateral futures contract\n\n 89: Currency does not exist\n\ + \n 90: Currency is not enabled for multi-collateral futures\n\n 41: Would\ + \ cause liquidation" + security: + - general-api-key: [] + authent: [] + parameters: + - description: The symbol for the PnL preference. + name: symbol + in: query + required: true + schema: + type: string + - description: The asset in which profit will be realised for the specific symbol. + name: pnlPreference + in: query + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/SuccessExample' + /leveragepreferences: + get: + operationId: getLeverageSetting + tags: + - Multi-Collateral + summary: Get the leverage setting for a market + description: Returns list of configured leverage preferences. + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: OK + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + leveragePreferences: + type: array + items: + $ref: '#/components/schemas/LeveragePreference' + required: + - leveragePreferences + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/GetLeveragePreferencesExample' + put: + operationId: setLeverageSetting + tags: + - Multi-Collateral + summary: Set the leverage setting for a market + description: 'Sets a contract''s margin mode, either "isolated" or "cross" margin. + + + When specifying a max leverage, the contract''s margin mode will be isolated. + + + Calling this endpoint can result in the following error codes: + + - 87: Contract does not exist + + - 88: Contract not a multi-collateral futures contract + + - 41: Would cause liquidation' + security: + - general-api-key: [] + authent: [] + parameters: + - description: Symbol for the leverage preference. + name: symbol + in: query + required: true + schema: + type: string + - description: 'Max leverage to set. + + + When present, the symbol''s margin mode will be set to "isolated". + + When missing, the symbol''s margin mode will be set to "cross". + + ' + name: maxLeverage + in: query + required: false + schema: + type: number + responses: + '200': + description: OK + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/SuccessExample' + /accounts: + get: + operationId: getAccounts + tags: + - Account Information + summary: Get wallets + description: 'This endpoint returns key information relating to all your accounts + which may either be + + cash accounts or margin accounts. This includes digital asset balances, instrument + balances, + + margin requirements, margin trigger estimates and auxiliary information such + as available + + funds, PnL of open positions and portfolio value.' + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: '' + content: + application/json: + schema: + title: Accounts Response + oneOf: + - title: Success Response + allOf: + - type: object + properties: + accounts: + $ref: '#/components/schemas/Account' + description: 'A structure containing structures with account-related + information for + + all margin and cash accounts.' + required: + - accounts + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/AccountsExample' + /batchorder: + post: + operationId: sendBatchOrder + tags: + - Order Management + summary: Batch order management + description: 'This endpoint allows sending limit or stop order(s) and/or cancelling + open order(s) and/or + + editing open order(s) for a currently listed Futures contract in batch. + + + When editing an order, if the `trailingStopMaxDeviation` and `trailingStopDeviationUnit` + + parameters are sent unchanged, the system will recalculate a new stop price + upon successful + + order modification.' + security: + - general-api-key: [] + authent: [] + parameters: [] + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + required: + - batchStatus + properties: + batchStatus: + type: array + items: + $ref: '#/components/schemas/BatchInstructionResult' + description: A structure containing information on the send + order request. + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/BatchOrderExample' + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + ProcessBefore: + $ref: '#/components/parameters/ProcessBefore' + json: + title: Batch Order + type: object + additionalProperties: false + required: + - batchOrder + properties: + batchOrder: + type: array + items: + title: Batch Instruction + discriminator: + propertyName: order + mapping: + send: '#/components/schemas/BatchOrderSend' + edit: '#/components/schemas/BatchOrderEdit' + cancel: '#/components/schemas/BatchOrderCancel' + oneOf: + - $ref: '#/components/schemas/BatchOrderSend' + - $ref: '#/components/schemas/BatchOrderEdit' + - $ref: '#/components/schemas/BatchOrderCancel' + description: 'A list containing structures of order sending + and order cancellation + + instructions. The list is in no particular order.' + examples: + - batchOrder: + - order: send + order_tag: '1' + orderType: lmt + symbol: PI_XBTUSD + side: buy + size: 1 + limitPrice: 1.0 + cliOrdId: my_another_client_id + - order: send + order_tag: '2' + orderType: stp + symbol: PI_XBTUSD + side: buy + size: 1 + limitPrice: 2.0 + stopPrice: 3.0 + - order: cancel + order_id: e35d61dd-8a30-4d5f-a574-b5593ef0c050 + - order: cancel + cliOrdId: my_client_id + description: ':::info + + This parameter is required to be encoded as a json string. + + :::' + required: + - json + /cancelallorders: + post: + operationId: cancelAllOrders + tags: + - Order Management + summary: Cancel all orders + description: 'This endpoint allows cancelling orders which are associated with + a future''s contract or a + + margin account. If no arguments are specified all open orders will be cancelled.' + security: + - general-api-key: [] + authent: [] + parameters: + - description: A futures product to cancel all open orders. + name: symbol + in: query + required: false + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + cancelStatus: + description: A structure containing information on the cancellation + request. + $ref: '#/components/schemas/CancelAllOrdersStatusJson' + required: + - cancelStatus + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/CancelAllOrdersExample' + /cancelallordersafter: + post: + operationId: cancelAllOrdersAfter + tags: + - Order Management + summary: Dead man's switch + description: 'This endpoint provides a Dead Man''s Switch mechanism to protect + the user from network malfunctions. The user can send a request with a timeout + in seconds which will trigger a countdown timer that will cancel all user + orders when timeout expires. The user has to keep sending request to push + back the timeout expiration or they can deactivate the mechanism by specifying + a timeout of zero (0). + + + The recommended mechanism usage is making a call every 15 to 20 seconds and + provide a timeout of 60 seconds. This allows the user to keep the orders in + place on a brief network failure, while keeping them safe in case of a network + breakdown.' + security: + - general-api-key: [] + authent: [] + parameters: + - description: The timeout specified in seconds. + name: timeout + in: query + required: false + schema: + type: number + format: uint32 + example: 60 + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + status: + $ref: '#/components/schemas/DeadManSwitchStatusJson' + description: The status of the switch. + required: + - status + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/CancelAllOrdersAfterSuccessExample' + cancel: + $ref: '#/components/examples/CancelAllOrdersAfterCancelExample' + failure: + $ref: '#/components/examples/CancelAllOrdersAfterFailureExample' + /cancelorder: + post: + operationId: cancelOrder + tags: + - Order Management + summary: Cancel order + description: This endpoint allows cancelling an open order for a Futures contract. + security: + - general-api-key: [] + authent: [] + parameters: + - $ref: '#/components/parameters/ProcessBefore' + - name: order_id + in: query + schema: + type: string + description: The unique identifier of the order to be cancelled. + description: The unique identifier of the order to be cancelled. + - name: cliOrdId + in: query + schema: + type: string + description: The client unique identifier of the order to be cancelled. + description: The client unique identifier of the order to be cancelled. + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + cancelStatus: + $ref: '#/components/schemas/CancelOrderStatusJson' + description: A structure containing information on the cancellation + request. + required: + - cancelStatus + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/CancelOrderExample' + /editorder: + post: + operationId: editOrderSpring + tags: + - Order Management + summary: Edit order + description: 'This endpoint allows editing an existing order for a currently + listed Futures contract. + + + When editing an order, if the `trailingStopMaxDeviation` and `trailingStopDeviationUnit` + + parameters are sent unchanged, the system will recalculate a new stop price + upon successful + + order modification.' + security: + - general-api-key: [] + authent: [] + parameters: + - $ref: '#/components/parameters/ProcessBefore' + - description: ID of the order you wish to edit. (Required if CliOrdId is not + included) + name: orderId + in: query + schema: + type: string + - description: 'The order identity that is specified from the user. It must + be globally unique (Required + + if orderId is not included)' + name: cliOrdId + in: query + schema: + type: string + - description: The size associated with the order + name: size + in: query + schema: + type: number + - description: The limit price associated with the order. Must not exceed the + tick size of the contract. + name: limitPrice + in: query + schema: + type: number + - description: 'The stop price associated with a stop order. Required if old + orderType is stp. + + Must not exceed tick size of the contract. Note that for stp orders, limitPrice + is also + + required and denotes the worst price at which the stp order can get filled.' + name: stopPrice + in: query + schema: + type: number + - name: trailingStopMaxDeviation + in: query + schema: + type: number + description: 'Only relevant for trailing stop orders. Maximum value of 50%, + minimum value of 0.1% for ''PERCENT'' ''maxDeviationUnit''. + + + Is the maximum distance the trailing stop''s trigger price may trail behind + the requested trigger signal. + + It defines the threshold at which the trigger price updates.' + minimum: 0.1 + maximum: 50 + description: 'Only relevant for trailing stop orders. Maximum value of 50%, + minimum value of 0.1% for ''PERCENT'' ''maxDeviationUnit''. + + + Is the maximum distance the trailing stop''s trigger price may trail behind + the requested trigger signal. + + It defines the threshold at which the trigger price updates.' + - name: trailingStopDeviationUnit + in: query + schema: + type: string + enum: + - PERCENT + - QUOTE_CURRENCY + description: 'Only relevant for trailing stop orders. + + + This defines how the trailing trigger price is calculated from the requested + trigger signal. + + For example, if the max deviation is set to 10, the unit is ''PERCENT'', + and the underlying order is a sell, + + then the trigger price will never be more then 10% below the trigger signal. + + Similarly, if the deviation is 100, the unit is ''QUOTE_CURRENCY'', the + underlying order is a sell, and the + + contract is quoted in USD, then the trigger price will never be more than + $100 below the trigger signal.' + description: 'Only relevant for trailing stop orders. + + + This defines how the trailing trigger price is calculated from the requested + trigger signal. + + For example, if the max deviation is set to 10, the unit is ''PERCENT'', + and the underlying order is a sell, + + then the trigger price will never be more then 10% below the trigger signal. + + Similarly, if the deviation is 100, the unit is ''QUOTE_CURRENCY'', the + underlying order is a sell, and the + + contract is quoted in USD, then the trigger price will never be more than + $100 below the trigger signal.' + - name: qtyMode + in: query + schema: + type: string + enum: + - ABSOLUTE + - RELATIVE + description: 'Determines how the updated size is interpreted, defaulting + to ''RELATIVE''. + + + ''ABSOLUTE'' means that the total order size, including past fills, is + set to `size`. + + ''RELATIVE'' means that the current open order size is set to `size`.' + description: 'Determines how the updated size is interpreted, defaulting to + ''RELATIVE''. + + + ''ABSOLUTE'' means that the total order size, including past fills, is set + to `size`. + + ''RELATIVE'' means that the current open order size is set to `size`.' + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + editStatus: + description: A structure containing information on the send + order request + $ref: '#/components/schemas/EditOrderStatus' + required: + - editStatus + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/EditOrderExample' + /feeschedules: + get: + operationId: getFeeSchedulesV3 + tags: + - Fee Schedules + summary: Get fee schedules + description: This endpoint lists all fee schedules. + security: [] + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + feeSchedules: + type: array + items: + $ref: '#/components/schemas/FeeSchedule' + required: + - feeSchedules + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/FeeSchedulesExample' + /feeschedules/volumes: + get: + operationId: getUserFeeScheduleVolumesV3 + tags: + - Fee Schedules + summary: Get fee schedule volumes + description: Returns your fee schedule volumes for each fee schedule. + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + volumesByFeeSchedule: + $ref: '#/components/schemas/FeeScheduleVolumes' + description: List containing the 30-day volume. + required: + - volumesByFeeSchedule + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/FeeSchedulesValuesExample' + /fills: + get: + operationId: getFills + tags: + - Historical Data + summary: Get your fills + description: This endpoint returns information on your filled orders for all + futures contracts. + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - description: 'If not provided, returns the last 100 fills in any futures contract. + If provided, + + returns the 100 entries before lastFillTime.' + name: lastFillTime + in: query + required: false + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + fills: + type: array + items: + $ref: '#/components/schemas/FillJson' + description: 'A list containing structures with information + on filled orders. The + + list is sorted descending by `fillTime`.' + required: + - fills + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/FillsExample' + /history: + get: + operationId: getHistory + tags: + - Market Data + summary: Get trade history + description: 'This endpoint returns the most recent 100 trades prior to the + specified `lastTime` value up + + to past 7 days or recent trading engine restart (whichever is sooner). + + + If no `lastTime` specified, it will return 100 most recent trades.' + security: [] + parameters: + - description: The symbol of the Futures. + name: symbol + in: query + required: true + schema: + type: string + - description: Returns the last 100 trades from the specified lastTime value. + name: lastTime + in: query + required: false + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + history: + type: array + items: + $ref: '#/components/schemas/HistoryJson' + description: 'A list containing structures with historical + price information. The + + list is sorted descending by time.' + required: + - history + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /instruments: + get: + operationId: getInstruments + tags: + - Instrument Details + summary: Get instruments + description: Returns specifications for all currently listed markets and indices. + security: [] + parameters: + - $ref: _parameters.yml#/ContractTypesQuery + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + instruments: + type: array + items: + $ref: '#/components/schemas/Instrument' + description: 'A list containing structures for each available + instrument. The list + + is in no particular order.' + required: + - instruments + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/InstrumentsExample' + /instruments/status: + get: + operationId: instrumentsStatus + tags: + - Instrument Details + summary: Get instrument status list + description: Returns price dislocation and volatility details for all markets. + parameters: + - $ref: _parameters.yml#/ContractTypesQuery + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + instrumentStatus: + type: array + items: + $ref: '#/components/schemas/InstrumentStatus' + required: + - instrumentStatus + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /instruments/{symbol}/status: + parameters: + - $ref: _parameters.yml#/MarketSymbolPath + get: + operationId: instrumentStatus + tags: + - Instrument Details + summary: Get instrument status + description: Returns price dislocation and volatility details for given market. + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - $ref: '#/components/schemas/InstrumentStatus' + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /notifications: + get: + operationId: getNotifications + tags: + - General + summary: Get notifications + description: This endpoint provides the platform's notifications. + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + notifications: + type: array + items: + $ref: '#/components/schemas/NotificationJson' + description: A list containing the notifications. + required: + - notifications + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/NotificationsSuccessExample' + failure: + $ref: '#/components/examples/NotificationsFailureExample' + /openorders: + get: + operationId: getOpenOrders + tags: + - Order Management + summary: Get open orders + description: This endpoint returns information on all open orders for all Futures + contracts. + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + openOrders: + type: array + items: + $ref: '#/components/schemas/OpenOrderJson' + description: 'A list containing structures with information + on open orders. The list + + is sorted descending by receivedTime.' + required: + - openOrders + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/OpenOrdersExample' + /openpositions: + get: + operationId: getOpenPositions + tags: + - Account Information + summary: Get open positions + description: 'This endpoint returns the size and average entry price of all + open positions in Futures + + contracts. This includes Futures contracts that have matured but have not + yet been settled.' + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + openPositions: + type: array + items: + $ref: _schemas.yml#/OpenPositionJson + description: 'A list containing structures with information + on open positions. + + + The list is sorted descending by fillTime.' + required: + - openPositions + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/OpenPositionsSuccessExample' + failure: + $ref: '#/components/examples/OpenPositionsFailureExample' + /unwindqueue: + get: + operationId: getUnwindQueue + tags: + - Account Information + summary: Get position percentile of unwind queue + description: This endpoint returns the percentile of the open position in case + of unwinding. + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + queue: + type: array + items: + $ref: '#/components/schemas/UnwindQueueJson' + description: 'A list containing structures with information + on open positions'' + + percentile rank in the unwind/termination queue.' + required: + - queue + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/UnwindQueueExample' + /orderbook: + get: + operationId: getOrderbook + tags: + - Market Data + summary: Get orderbook + description: 'This endpoint returns the entire non-cumulative order book of + currently listed Futures + + contracts.' + security: [] + parameters: + - description: The symbol of the Futures. + name: symbol + in: query + required: true + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + orderBook: + $ref: '#/components/schemas/OrderBook' + description: A structure containing lists with bid and ask + prices and sizes. + required: + - orderBook + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /sendorder: + post: + operationId: sendOrder + tags: + - Order Management + summary: Send order + description: 'This endpoint allows sending a limit, stop, take profit or immediate-or-cancel + order for a + + currently listed Futures contract.' + security: + - general-api-key: [] + authent: [] + parameters: + - $ref: '#/components/parameters/ProcessBefore' + - description: 'The order type: + + + - `lmt` - a limit order + + - `post` - a post-only limit order + + - `mkt` - an immediate-or-cancel order with 1% price protection + + - `stp` - a stop order + + - `take_profit` - a take profit order + + - `ioc` - an immediate-or-cancel order + + - `trailing_stop` - a trailing stop order' + name: orderType + in: query + required: true + schema: + type: string + enum: + - lmt + - post + - ioc + - mkt + - stp + - take_profit + - trailing_stop + - fok + - name: symbol + in: query + required: true + schema: + type: string + description: The symbol of the Futures + description: The symbol of the Futures + - name: side + in: query + required: true + schema: + type: string + enum: + - buy + - sell + description: The direction of the order + description: The direction of the order + - name: size + in: query + required: true + schema: + type: number + description: 'The size associated with the order. Note that different Futures + have different + + contract sizes.' + description: 'The size associated with the order. Note that different Futures + have different + + contract sizes.' + - name: limitPrice + in: query + schema: + type: number + description: 'The limit price associated with the order. Note that for stop + orders, limitPrice denotes the worst price at + + which the `stp` or `take_profit` order can get filled at. If no `limitPrice` + is + + provided the `stp` or `take_profit` order will trigger a market order. + If placing a `trailing_stop` order then leave undefined.' + description: 'The limit price associated with the order. Note that for stop + orders, limitPrice denotes the worst price at + + which the `stp` or `take_profit` order can get filled at. If no `limitPrice` + is + + provided the `stp` or `take_profit` order will trigger a market order. If + placing a `trailing_stop` order then leave undefined.' + - name: stopPrice + in: query + schema: + type: number + description: 'The stop price associated with a stop or take profit order. + + + Required if orderType is `stp` or `take_profit`, but if placing a `trailing_stop` + then + + leave undefined. Note that for stop orders, limitPrice denotes the worst + price at + + which the `stp` or `take_profit` order can get filled at. If no `limitPrice` + is + + provided the `stp` or `take_profit` order will trigger a market order.' + description: 'The stop price associated with a stop or take profit order. + + + Required if orderType is `stp` or `take_profit`, but if placing a `trailing_stop` + then + + leave undefined. Note that for stop orders, limitPrice denotes the worst + price at + + which the `stp` or `take_profit` order can get filled at. If no `limitPrice` + is + + provided the `stp` or `take_profit` order will trigger a market order.' + - name: cliOrdId + in: query + schema: + type: string + maxLength: 100 + description: The order identity that is specified from the user. It must + be globally unique. + description: The order identity that is specified from the user. It must be + globally unique. + - name: triggerSignal + in: query + schema: + type: string + enum: + - mark + - index + - last + description: 'If placing a `stp`, `take_profit` or `trailing_stop`, the + signal used for trigger. + + + - `mark` - the mark price + + - `index` - the index price + + - `last` - the last executed trade' + description: 'If placing a `stp`, `take_profit` or `trailing_stop`, the signal + used for trigger. + + + - `mark` - the mark price + + - `index` - the index price + + - `last` - the last executed trade' + - name: reduceOnly + in: query + schema: + type: boolean + description: 'Set as true if you wish the order to only reduce an existing + position. + + + Any order which increases an existing position will be rejected. Default + false.' + description: 'Set as true if you wish the order to only reduce an existing + position. + + + Any order which increases an existing position will be rejected. Default + false.' + - name: trailingStopMaxDeviation + in: query + schema: + type: number + description: 'Required if the order type is `trailing_stop`. Maximum value + of 50%, minimum value of 0.1% for ''PERCENT'' ''maxDeviationUnit''. + + + Is the maximum distance the trailing stop''s trigger price may trail behind + the + + requested trigger signal. It defines the threshold at which the trigger + price updates.' + minimum: 0.1 + maximum: 50 + description: 'Required if the order type is `trailing_stop`. Maximum value + of 50%, minimum value of 0.1% for ''PERCENT'' ''maxDeviationUnit''. + + + Is the maximum distance the trailing stop''s trigger price may trail behind + the + + requested trigger signal. It defines the threshold at which the trigger + price updates.' + - name: trailingStopDeviationUnit + in: query + schema: + type: string + enum: + - PERCENT + - QUOTE_CURRENCY + description: 'Required if the order type is `trailing_stop`. + + + This defines how the trailing trigger price is calculated from the requested + trigger + + signal. For example, if the max deviation is set to 10, the unit is ''PERCENT'', + and the + + underlying order is a sell, then the trigger price will never be more + then 10% below + + the trigger signal. Similarly, if the deviation is 100, the unit is ''QUOTE_CURRENCY'', + + the underlying order is a sell, and the contract is quoted in USD, then + the trigger + + price will never be more than $100 below the trigger signal.' + description: 'Required if the order type is `trailing_stop`. + + + This defines how the trailing trigger price is calculated from the requested + trigger + + signal. For example, if the max deviation is set to 10, the unit is ''PERCENT'', + and the + + underlying order is a sell, then the trigger price will never be more then + 10% below + + the trigger signal. Similarly, if the deviation is 100, the unit is ''QUOTE_CURRENCY'', + + the underlying order is a sell, and the contract is quoted in USD, then + the trigger + + price will never be more than $100 below the trigger signal.' + - name: limitPriceOffsetValue + in: query + schema: + type: number + description: 'Can only be set for triggers, e.g. order types `take_profit`, + `stop` and `trailing_stop`. + + If set, `limitPriceOffsetUnit` must be set as well. + + This defines a relative limit price depending on the trigger `stopPrice`. + The price is determined + + when the trigger is activated by the `triggerSignal`. The offset can be + positive or negative, there + + might be restrictions on the value depending on the `limitPriceOffsetUnit`.' + description: 'Can only be set for triggers, e.g. order types `take_profit`, + `stop` and `trailing_stop`. + + If set, `limitPriceOffsetUnit` must be set as well. + + This defines a relative limit price depending on the trigger `stopPrice`. + The price is determined + + when the trigger is activated by the `triggerSignal`. The offset can be + positive or negative, there + + might be restrictions on the value depending on the `limitPriceOffsetUnit`.' + - name: limitPriceOffsetUnit + in: query + schema: + type: string + enum: + - QUOTE_CURRENCY + - PERCENT + description: 'Can only be set together with `limitPriceOffsetValue`. + + This defines the unit for the relative limit price distance from the trigger''s + `stopPrice`.' + description: 'Can only be set together with `limitPriceOffsetValue`. + + This defines the unit for the relative limit price distance from the trigger''s + `stopPrice`.' + - name: broker + in: query + schema: + type: string + maxLength: 100 + description: 'Valid Broker identifier on whose behalf the order is sent. + + + Note: This is currently available exclusively in the Kraken Futures DEMO + environment.' + description: 'Valid Broker identifier on whose behalf the order is sent. + + + Note: This is currently available exclusively in the Kraken Futures DEMO + environment.' + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + sendStatus: + $ref: '#/components/schemas/SendOrderJson' + description: A structure containing information on the send + order request. + required: + - sendStatus + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + placed: + $ref: '#/components/examples/PlacedOrderExample' + rejected: + $ref: '#/components/examples/RejectedOrderExample' + executed: + $ref: '#/components/examples/ExecutedOrderExample' + /subaccount/{subaccountUid}/trading-enabled: + parameters: + - name: subaccountUid + in: path + required: true + schema: + type: string + format: uuid + get: + operationId: getSubaccountTradingCapability + tags: + - Subaccounts + summary: Check if a subaccount has trading enabled or disabled + description: Returns trading capability info for given subaccount. + security: + - general-api-key: [] + authent: [] + responses: + '200': + description: Trading enabled status. + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SubaccountEnabledJson' + - $ref: '#/components/schemas/ErrorResponse' + '404': + description: The account or subaccount could not be found + put: + operationId: updateSubaccountTradingCapability + tags: + - Subaccounts + summary: Enable or disable trading on a subaccount + description: Updates trading capabilities for given subaccount. + security: + - general-api-key: [] + authent: [] + parameters: + - name: tradingEnabled + in: query + required: true + schema: + type: boolean + responses: + '200': + description: Trading was successfully enabled/disabled. + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SubaccountEnabledJson' + - $ref: '#/components/schemas/ErrorResponse' + '404': + description: The account or subaccount could not be found + /subaccounts: + get: + operationId: listSubaccounts + tags: + - Subaccounts + summary: Get subaccounts + description: Return information about subaccounts, including balances and UIDs. + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + masterAccountUid: + type: string + description: Master account UID + subaccounts: + type: array + items: + $ref: '#/components/schemas/SubAccount' + description: The sub-accounts. + required: + - masterAccountUid + - subaccounts + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + kfSuccess: + $ref: '#/components/examples/SubaccountsWithFlexExample' + /tickers: + get: + operationId: getTickers + tags: + - Market Data + summary: Get tickers + description: 'This endpoint returns current market data for all currently listed + Futures contracts and + + indices.' + security: [] + parameters: + - $ref: _parameters.yml#/ContractTypesQuery + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + tickers: + type: array + items: + $ref: '#/components/schemas/AnyTicker' + description: 'A list containing a structures for each available + instrument. The list + + is in no particular order.' + required: + - tickers + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/TickersExample' + /tickers/{symbol}: + parameters: + - $ref: _parameters.yml#/MarketSymbolPath + get: + operationId: getTicker + tags: + - Market Data + summary: Get ticker by symbol + description: Get market data for contract or index by symbol + security: [] + responses: + '200': + description: '' + content: + application/json: + schema: + allOf: + - type: object + properties: + ticker: + type: object + $ref: '#/components/schemas/AnyTicker' + required: + - ticker + - $ref: '#/components/schemas/SuccessResponse' + examples: + success: + $ref: '#/components/examples/TickerExample' + '404': + description: Contract could not be found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /transfer: + post: + operationId: transfer + tags: + - Transfers + summary: Initiate wallet transfer + description: 'This endpoint allows you to transfer funds between two margin + accounts with the same + + collateral currency, or between a margin account and your cash account.' + security: + - general-api-key: [] + authent: [] + parameters: + - description: The wallet (cash or margin account) from which funds should be + debited + name: fromAccount + in: query + required: true + schema: + type: string + example: fi_ethusd + - description: The wallet (cash or margin account) to which funds should be + credited + name: toAccount + in: query + required: true + schema: + type: string + example: flex + - description: The currency unit to transfer + name: unit + in: query + required: true + schema: + type: string + example: eth + - description: The amount to transfer + name: amount + in: query + required: true + schema: + type: number + format: decimal + exclusiveMinimum: 0 + example: 0.1 + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /transfer/subaccount: + post: + operationId: subAccountTransfer + tags: + - Transfers + summary: Initiate sub account transfer + description: 'This endpoint allows you to transfer funds between the current + account and a sub account, + + between two margin accounts with the same collateral currency, or between + a margin account + + and your cash account.' + security: + - general-api-key: [] + authent: [] + parameters: + - description: The user account (this or a sub account) from which funds should + be debited + name: fromUser + in: query + required: true + schema: + type: string + - description: The user account (this or a sub account) to which funds should + be credited + name: toUser + in: query + required: true + schema: + type: string + - description: The wallet (cash or margin account) from which funds should be + debited + name: fromAccount + in: query + required: true + schema: + type: string + - description: The wallet (cash or margin account) to which funds should be + credited + name: toAccount + in: query + required: true + schema: + type: string + - description: The currency unit to transfer + name: unit + in: query + required: true + schema: + type: string + - description: The amount to transfer + name: amount + in: query + required: true + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + $ref: '#/components/examples/SuccessExample' + failure: + $ref: '#/components/examples/TransferSubaccountFailureExample' + /withdrawal: + post: + operationId: withdrawal + tags: + - Transfers + summary: Initiate withdrawal to Spot wallet + description: 'This endpoint allows you to request to withdraw digital assets + to your Kraken Spot wallet. + + + Wallet names can be found in the ''accounts'' structure in the Get Wallets + /accounts response.' + security: + - withdrawal-api-key: [] + authent: [] + parameters: + - description: The digital asset that shall be withdrawn back to spot wallet. + name: currency + in: query + required: true + schema: + type: string + example: eth + - description: The amount of currency that shall be withdrawn back to spot wallet. + name: amount + in: query + required: true + schema: + type: number + format: decimal + exclusiveMinimum: 0 + example: 0.1 + - description: 'The wallet from which the funds shall be withdrawn back to spot + wallet. Default is + + "cash" wallet.' + name: sourceWallet + in: query + required: false + schema: + type: string + example: flex + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/WithdrawalResponse' + - $ref: '#/components/schemas/ErrorResponse' + examples: + success: + value: + uid: 9053db5f-0d5e-48dd-b606-a5c92576b706 + result: success + serverTime: '2022-06-28T14:48:58.711Z' + failure: + $ref: '#/components/examples/WithdrawalFailureExample' + /assignmentprogram/current: + get: + operationId: getAssignmentProgramCurrent + tags: + - Assignment Program + summary: Lists current assignment programs + description: This endpoint returns information on currently active assignment + programs + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + participants: + type: array + items: + $ref: '#/components/schemas/AssignmentParticipantDetails' + required: + - participants + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /assignmentprogram/add: + post: + operationId: addAssignmentProgram + tags: + - Assignment Program + summary: Adds an assignment program preference + description: This endpoint adds an assignment program preference + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - description: Type of contract for the assignment program preference. Options + can be found in the 'accounts' structure in the Get Wallets /accounts response + name: contractType + in: query + required: true + schema: + type: string + - description: A specific contract for this assignment program preference. Required + for "flex" contracts if base/quote currencies are not included. + name: contract + in: query + required: false + schema: + type: string + - description: The maximum size for an assignment + name: maxSize + in: query + required: false + schema: + type: number + - description: The maximum position + name: maxPosition + in: query + required: false + schema: + type: number + - description: Accept to take long positions + name: acceptLong + in: query + required: true + schema: + type: boolean + - description: Accept to take short positions + name: acceptShort + in: query + required: true + schema: + type: boolean + - description: When is the program preference valid + name: timeFrame + in: query + required: true + schema: + type: string + - description: enabled assignment + name: enabled + in: query + required: true + schema: + type: boolean + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - $ref: '#/components/schemas/AssignmentParticipantDetails' + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /assignmentprogram/delete: + post: + operationId: deleteAssignmentProgram + tags: + - Assignment Program + summary: deletes an assignment program preference + description: This endpoint deletes an assignment program preference + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - description: Id of program to delete + name: id + in: query + required: true + schema: + type: number + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - $ref: '#/components/schemas/AssignmentParticipantDetails' + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /assignmentprogram/history: + get: + operationId: getAssignmentProgramHistory + tags: + - Assignment Program + summary: Lists all changes in assignment program preferences + description: This endpoint returns information on assignment program preferences + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + participants: + type: array + items: + $ref: '#/components/schemas/AssignmentParticipantHistoryJson' + required: + - participants + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /orders/status: + post: + operationId: getOrderStatus + tags: + - Order Management + summary: Get Specific Orders' Status + description: 'Returns information on specified orders which are open or were + filled/cancelled in the last + + 5 seconds.' + security: + - general-api-key: [] + authent: [] + parameters: + - description: UIDs associated with orders or triggers. + name: orderIds + in: query + required: false + schema: + type: array + items: + type: string + format: uuid + - description: Client Order IDs associated with orders or triggers. + name: cliOrdIds + in: query + required: false + schema: + type: array + items: + type: string + example: + - testOrder1 + - testOrder2 + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + orders: + type: array + items: + $ref: '#/components/schemas/OrderStatusDetailsJson' + required: + - orders + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /historical-funding-rates: + get: + operationId: historicalFundingRates + tags: + - Historical Funding Rates + summary: Historical funding rates + description: Returns list of historical funding rates for given market. + parameters: + - $ref: _parameters.yml#/MarketSymbolQueryRequired + responses: + '200': + description: Historical funding rates for given market. + content: + application/json: + schema: + title: Success Response + allOf: + - type: object + properties: + rates: + description: 'A list containing structures with historical funding + rate information. + + The list is sorted ascending by timestamp.' + type: array + items: + $ref: '#/components/schemas/HistoricalFundingRateJson' + required: + - rates + - $ref: '#/components/schemas/SuccessResponse' + examples: + success: + $ref: '#/components/examples/HistoricalFundingRatesExample' + '400': + description: Symbol is invalid or does not reference a perpetual market. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /self-trade-strategy: + get: + operationId: getSelfTradeStrategy + tags: + - Trading Settings + summary: Get current self trade strategy + description: Returns account-wide self-trade matching strategy. + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: Get current self trade strategy + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - $ref: '#/components/schemas/SelfTradeStrategyJson' + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + put: + operationId: setSelfTradeStrategy + tags: + - Trading Settings + summary: Update self trade strategy + description: Updates account-wide self-trade matching behavior to given strategy. + security: + - general-api-key: [] + authent: [] + parameters: + - description: Defines self trade behaviour + name: strategy + in: query + required: true + schema: + $ref: '#/components/schemas/SelfTradeStrategy' + responses: + '200': + description: Self trade strategy was successfully updated + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - $ref: '#/components/schemas/SelfTradeStrategyJson' + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + /portfolio-margining/parameters: + get: + operationId: getPortfolioMarginingParameters + tags: + - Account Information + summary: Get current portfolio margin calculation parameters and options trading + limits. + description: 'Retrieve current portfolio margin calculation parameters. + + + Also includes user specific limits related to options trading. + + + Note: This is currently available exclusively in the Kraken Futures DEMO environment.' + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: Portfolio margining parameters + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - $ref: _schemas.yml#/PortfolioMarginingParameters + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + servers: + - url: https://demo-futures.kraken.com/derivatives/api/v3 + /portfolio-margining/simulate: + post: + operationId: simulatePortfolio + tags: + - Account Information + summary: Calculate provided portfolio's margin, pnl and option greeks. + description: 'For a given portfolio of balances and positions (futures and options), + calculate the + + margin requirements, pnl and option greeks. + + + Note: This is currently available exclusively in the Kraken Futures DEMO environment.' + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - description: Request body as a JSON string + name: json + in: query + required: true + content: + application/json: + schema: + $ref: _schemas.yml#/PortfolioSimulationRequest + responses: + '200': + description: Simulated portfolio calculations + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - $ref: _schemas.yml#/PortfolioSimulationResponse + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + servers: + - url: https://demo-futures.kraken.com/derivatives/api/v3 + /rfqs: + get: + operationId: getAllOpenRfqs + tags: + - RFQs + summary: List all open RFQs + description: 'Retrieve all currently open RFQs + + + Note: This is currently available exclusively in the Kraken Futures DEMO environment.' + responses: + '200': + description: RFQs + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - $ref: '#/components/schemas/OpenRfqsResponse' + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + servers: + - url: https://demo-futures.kraken.com/derivatives/api/v3 + /rfqs/{rfqUid}: + get: + operationId: getSingleOpenRfq + tags: + - RFQs + summary: Retrieve a single open RFQ + description: 'Retrieve a specific open RFQ by its unique identifier + + + Note: This is currently available exclusively in the Kraken Futures DEMO environment.' + parameters: + - description: Unique identifier for the RFQ + name: rfqUid + in: path + required: true + schema: + type: string + format: uuid + responses: + '200': + description: A single RFQ object + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + required: + - rfq + properties: + rfq: + $ref: '#/components/schemas/OpenRfq' + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + servers: + - url: https://demo-futures.kraken.com/derivatives/api/v3 + /rfqs/open-offers: + get: + operationId: getOpenRfqOffers + tags: + - RFQs + summary: List your open offer on open RFQs + description: 'Retrieve all open offers for the account on currently open RFQs + + + Note: This is currently available exclusively in the Kraken Futures DEMO environment.' + security: + - general-api-key-read-only: [] + authent: [] + responses: + '200': + description: Open Offers + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - $ref: '#/components/schemas/OpenRfqOffersResponse' + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + servers: + - url: https://demo-futures.kraken.com/derivatives/api/v3 + /rfqs/{rfqUid}/place-offer: + post: + operationId: placeRfqOffer + tags: + - RFQs + summary: Place a new offer on an open RFQ + description: 'Place a new offer for the given amount in USD on the specified + open RFQ, bid and ask are optional but at least one must be provided + + + Note: This is currently available exclusively in the Kraken Futures DEMO environment.' + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - description: Unique identifier for the RFQ + name: rfqUid + in: path + required: true + schema: + type: string + format: uuid + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + bid: + type: number + format: number + description: The bid price (optional) + ask: + type: number + format: number + description: The ask price (optional) + example: + bid: 100.5 + ask: 101.75 + responses: + '200': + description: Placed bid + content: + application/json: + schema: + oneOf: + - title: Success Response + allOf: + - type: object + properties: + offerUid: + type: string + format: uuid + required: + - offerUid + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + servers: + - url: https://demo-futures.kraken.com/derivatives/api/v3 + /rfqs/{rfqUid}/replace-offer: + put: + operationId: replaceRfqOffer + tags: + - RFQs + summary: Replace an open offer on an open RFQ + description: 'Replace the current open offer on the specified open RFQ, bid + and ask are optional but at least one must be provided + + + Note: This is currently available exclusively in the Kraken Futures DEMO environment.' + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - description: Unique identifier for the RFQ + name: rfqUid + in: path + required: true + schema: + type: string + format: uuid + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + bid: + type: number + format: number + description: The bid price (optional) + ask: + type: number + format: number + description: The ask price (optional) + example: + bid: 100.5 + ask: 101.75 + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + servers: + - url: https://demo-futures.kraken.com/derivatives/api/v3 + /rfqs/{rfqUid}/cancel-offer: + delete: + operationId: cancelRfqOffer + tags: + - RFQs + summary: Cancel the open offer on an open RFQ + description: 'Cancel the current open offer on the specified open RFQ + + + Note: This is currently available exclusively in the Kraken Futures DEMO environment.' + security: + - general-api-key-read-only: [] + authent: [] + parameters: + - description: Unique identifier for the RFQ + name: rfqUid + in: path + required: true + schema: + type: string + format: uuid + responses: + '200': + description: '' + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + servers: + - url: https://demo-futures.kraken.com/derivatives/api/v3 +components: + securitySchemes: + authent: + type: apiKey + description: Authentication string + in: header + name: Authent + x-inlineDescription: true + general-api-key: + type: apiKey + description: General API key with **full** access + in: header + name: APIKey + x-inlineDescription: true + general-api-key-read-only: + type: apiKey + description: General API key with at least **read-only** access + in: header + name: APIKey + x-inlineDescription: true + withdrawal-api-key: + type: apiKey + description: '**Withdrawal** API key with **full** access + + ' + in: header + name: APIKey + x-inlineDescription: true + schemas: + Account: + description: Information for all margin and cash accounts + type: object + properties: + cash: + $ref: '#/components/schemas/CashAccount' + flex: + $ref: '#/components/schemas/FlexBalanceSummary' + description: Structure showing multi-collateral wallet details. + required: + - cash + - flex + additionalProperties: + $ref: '#/components/schemas/MarginAccount' + AnyTicker: + oneOf: + - $ref: '#/components/schemas/MarketTicker' + - $ref: '#/components/schemas/IndexTicker' + AssignmentParticipantDetails: + type: object + properties: + id: + type: number + participant: + $ref: '#/components/schemas/AssignmentParticipantJson' + required: + - id + - participant + AssignmentParticipantHistoryJson: + type: object + properties: + deleted: + type: boolean + participant: + $ref: '#/components/schemas/AssignmentParticipantJson' + timestamp: + $ref: _schemas.yml#/Rfc3339DateTime + required: + - deleted + - participant + AssignmentParticipantJson: + type: object + properties: + contractType: + type: string + contract: + type: + - string + - 'null' + maxSize: + format: double + type: + - number + - 'null' + maxPosition: + format: double + type: + - number + - 'null' + acceptLong: + type: boolean + acceptShort: + type: boolean + timeFrame: + type: string + enum: + - all + - weekdays + - weekends + enabled: + type: boolean + required: + - contractType + - acceptLong + - acceptShort + - timeFrame + - enabled + example: + contractType: flex + contract: PF_BTCUSD + maxPosition: 10 + maxSize: 10 + acceptLong: true + acceptShort: true + timeFrame: weekdays + enabled: true + Auxiliary: + type: object + properties: + usd: + type: number + pv: + type: number + description: The portfolio value of the account, in currency. + pnl: + type: number + description: The PnL of current open positions of the account, in currency. + af: + type: number + description: The available funds of the account, in currency. + funding: + type: number + required: + - usd + - pv + - pnl + - af + - funding + BatchInstructionResult: + type: object + properties: + cliOrdId: + type: string + description: 'The unique client order identifier. This field is returned + only if the order has a + + client order ID.' + dateTimeReceived: + type: + - string + - 'null' + description: The date and time the order was received. + orderEvents: + type: array + items: + $ref: '#/components/schemas/OrderEvent' + order_id: + type: + - string + - 'null' + description: The unique identifier of the order. + order_tag: + type: + - string + - 'null' + description: 'The arbitrary string provided client-side when the order was + sent for the purpose of + + mapping order sending instructions to the API''s response.' + status: + type: string + enum: + - placed + - edited + - cancelled + - invalidOrderType + - invalidSide + - invalidSize + - invalidPrice + - insufficientAvailableFunds + - selfFill + - tooManySmallOrders + - marketSuspended + - marketInactive + - clientOrderIdAlreadyExist + - clientOrderIdTooLong + - outsidePriceCollar + - postWouldExecute + - iocWouldNotExecute + description: 'The status of the order: + + + - `placed` - the order was placed successfully + + - `cancelled` - the order was cancelled successfully + + - `invalidOrderType` - the order was not placed because orderType is invalid + + - `invalidSide` - the order was not placed because side is invalid + + - `invalidSize` - the order was not placed because size is invalid + + - `invalidPrice` - the order was not placed because limitPrice and/or + stopPrice are invalid + + - `insufficientAvailableFunds` - the order was not placed because available + funds are insufficient + + - `selfFill` - the order was not placed because it would be filled against + an existing order belonging to the same account + + - `tooManySmallOrders` - the order was not placed because the number of + small open orders would exceed the permissible limit + + - `marketSuspended` - the order was not placed because the market is suspended + + - `marketInactive` - the order was not placed because the market is inactive + + - `clientOrderIdAlreadyExist` - the specified client ID already exist + + - `clientOrderIdTooLong` - the client ID is longer than the permissible + limit + + - `outsidePriceCollar` - the limit order crosses the spread but is an + order of magnitude away from the mark price - fat finger control + + - `postWouldExecute` - the post-only order would be filled upon placement, + thus is cancelled + + - `iocWouldNotExecute` - the immediate-or-cancel order would not execute' + required: + - status + - orderEvents + BatchOrderCancel: + example: + order: cancel + order_id: e35d61dd-8a30-4d5f-a574-b5593ef0c050 + allOf: + - type: object + properties: + order: + description: Always `cancel`. + type: string + enum: + - cancel + required: + - order + - $ref: '#/components/schemas/CancelInstruction' + BatchOrderEdit: + allOf: + - $ref: '#/components/schemas/OrderIdElement' + - type: object + properties: + order: + type: string + description: Always `edit`. + enum: + - edit + size: + type: number + description: The size associated with the order. + limitPrice: + type: number + description: The limit price associated with the order. + stopPrice: + type: number + description: 'The stop price associated with a stop order. Required if + old orderType is stp. + + + Note that for `stp` orders, `limitPrice` is also required and denotes + the worst + + price at which the stp order can get filled.' + trailingStopMaxDeviation: + type: number + description: 'Only relevant for trailing stop orders. Maximum value of + 50%, minimum value of 0.1% + + for ''PERCENT'' ''maxDeviationUnit''. + + + Is the maximum distance the trailing stop''s trigger price may trail + behind the + + requested trigger signal. It defines the threshold at which the trigger + price + + updates.' + minimum: 0.1 + maximum: 50 + trailingStopDeviationUnit: + type: string + enum: + - PERCENT + - QUOTE_CURRENCY + description: 'Only relevant for trailing stop orders. + + + This defines how the trailing trigger price is calculated from the requested + trigger + + signal. For example, if the max deviation is set to 10, the unit is + ''PERCENT'', and + + the underlying order is a sell, then the trigger price will never be + more then 10% + + below the trigger signal. Similarly, if the deviation is 100, the unit + is + + ''QUOTE_CURRENCY'', the underlying order is a sell, and the contract + is quoted in USD, + + then the trigger price will never be more than $100 below the trigger + signal.' + qtyMode: + type: string + enum: + - ABSOLUTE + - RELATIVE + description: 'Determines how the updated size is interpreted, defaulting + to ''RELATIVE''. + + + ''ABSOLUTE'' means that the total order size, including past fills, + is set to `size`. + + ''RELATIVE'' means that the current open order size is set to `size`.' + BatchOrderSend: + type: object + required: + - symbol + - order_tag + - side + - size + - orderType + properties: + order: + type: string + description: Always `send`. + enum: + - send + order_tag: + type: string + description: 'An arbitrary string provided client-side to tag the order + for the purpose of + + mapping order sending instructions to the API''s response.' + orderType: + type: string + enum: + - lmt + - ioc + - post + - stp + - take_profit + - fok + description: 'Order type: + + + - `lmt` - a limit order, + + - `post` - a post-only limit order, + + - `take_profit` - a take profit order or + + - `stp` - a stop order + + - `trailing_stop` - a trailing stop order' + symbol: + type: string + description: The symbol of the Futures. + side: + type: string + enum: + - buy + - sell + description: The direction of the order. + size: + type: number + description: The size associated with the order. + limitPrice: + type: number + description: 'The limit price associated with the order. If placing a `trailing_stop` + order then leave + + undefined.' + stopPrice: + type: number + description: 'The stop price associated with a stop order. Required if `orderType` + is `stp`. + + Note that for `stp` orders, `limitPrice` is also required and denotes + the worst price at + + which the `stp` order can get filled' + cliOrdId: + type: string + description: The order identity that is specified from the user. It must + be globally unique. + maxLength: 100 + triggerSignal: + type: string + enum: + - mark + - index + - last + reduceOnly: + type: boolean + description: 'Set as ''true'' if you wish the order to only reduce an existing + position. Any order which + + increases an existing position will be rejected. Default ''false''.' + default: false + trailingStopMaxDeviation: + type: number + description: 'Required if the order type is `trailing_stop`. + + + Is the maximum distance the trailing stop''s trigger price may trail behind + the requested trigger signal. + + It defines the threshold at which the trigger price updates.' + trailingStopDeviationUnit: + type: string + enum: + - PERCENT + - QUOTE_CURRENCY + description: 'Required if the order type is `trailing_stop`. + + + This defines how the trailing trigger price is calculated from the requested + trigger + + signal. For example, if the max deviation is set to 10, the unit is ''PERCENT'', + and the + + underlying order is a sell, then the trigger price will never be more + then 10% below the + + trigger signal. Similarly, if the deviation is 100, the unit is ''QUOTE_CURRENCY'', + the + + underlying order is a sell, and the contract is quoted in USD, then the + trigger price + + will never be more than $100 below the trigger signal.' + example: + order: send + order_tag: '1' + orderType: lmt + symbol: PI_XBTUSD + side: buy + size: 1 + limitPrice: 1.0 + cliOrdId: my_another_client_id + CachedOrderJson: + type: object + properties: + type: + type: string + enum: + - TRIGGER_ORDER + - ORDER + orderId: + type: string + format: uuid + cliOrdId: + type: + - string + - 'null' + symbol: + type: string + side: + type: string + quantity: + type: + - number + - 'null' + filled: + type: + - number + - 'null' + limitPrice: + type: + - number + - 'null' + reduceOnly: + type: boolean + timestamp: + type: string + lastUpdateTimestamp: + type: string + priceTriggerOptions: + oneOf: + - $ref: '#/components/schemas/TriggerOptions' + - type: 'null' + triggerTime: + type: + - string + - 'null' + required: + - type + - orderId + - cliOrdId + - symbol + - side + - quantity + - filled + - limitPrice + - reduceOnly + - timestamp + - lastUpdateTimestamp + - algoId + - priceTriggerOptions + - triggerTime + CancelAllOrdersStatusJson: + type: object + properties: + cancelOnly: + type: string + description: The symbol of the futures or all. + cancelledOrders: + type: array + items: + $ref: '#/components/schemas/OrderIdElement' + description: A list of structures containing all the successfully cancelled + orders. + orderEvents: + type: array + items: + $ref: '#/components/schemas/CancelEvent' + receivedTime: + type: string + description: The date and time the order cancellation was received. + status: + type: string + enum: + - noOrdersToCancel + - cancelled + description: 'The status of the order cancellation: + + + - `cancelled` - successful cancellation + + - `noOrdersToCancel` - no open orders for cancellation' + required: + - cancelOnly + - cancelledOrders + - orderEvents + - receivedTime + - status + CancelEvent: + type: object + properties: + type: + description: Always `CANCEL`. + type: string + enum: + - CANCEL + uid: + type: string + description: The UID associated with the order. + order: + oneOf: + - $ref: '#/components/schemas/OrderJson' + description: The cancelled order. + - type: 'null' + required: + - type + - uid + - order + CancelInstruction: + type: object + description: Provide either `order_id` or `cliOrdId`. + properties: + order_id: + description: Order ID. + type: string + format: uuid + cliOrdId: + description: Unique client order identifier. + type: string + maxLength: 100 + CancelOrderStatusJson: + type: object + properties: + cliOrdId: + type: + - string + - 'null' + description: The client order ID. Shown only if client specified one. + orderEvents: + type: array + items: + $ref: '#/components/schemas/OrderEvent' + order_id: + type: string + format: uuid + description: The cancelled order UID + receivedTime: + type: string + description: The date and time the order cancellation was received. + status: + type: string + enum: + - cancelled + - filled + - notFound + description: 'The status of the order cancellation: + + + - `cancelled` - The order has been cancelled. This may only be part of + the order as part may have been filled. Check open_orders websocket feed + for status of the order. + + - `filled` - The order was found completely filled and could not be cancelled + + - `notFound` - The order was not found, either because it had already + been cancelled or it never existed' + required: + - status + CancelTriggerEvent: + type: object + properties: + type: + description: Always `CANCEL`. + type: string + enum: + - CANCEL + uid: + type: string + orderTrigger: + oneOf: + - $ref: '#/components/schemas/OrderTriggerJson' + - type: 'null' + required: + - type + - uid + - orderTrigger + CashAccount: + type: object + properties: + type: + type: string + enum: + - cashAccount + description: The type of the account (always "cashAccount"). + balances: + $ref: '#/components/schemas/CashAccountBalances' + description: A structure containing account balances. + required: + - type + - balances + CashAccountBalances: + type: object + additionalProperties: + $ref: _schemas.yml#/DecimalString + DeadManSwitchStatusJson: + type: object + properties: + currentTime: + type: string + description: The server date and time that server received the request. + triggerTime: + type: string + description: The server date and time that the switch will be activated. + required: + - currentTime + - triggerTime + EditEvent: + type: object + properties: + type: + description: Always `EDIT`. + type: string + enum: + - EDIT + old: + $ref: '#/components/schemas/OrderJson' + description: The order before the edit was applied. + new: + $ref: '#/components/schemas/OrderJson' + description: The order after the edit was applied. + reducedQuantity: + type: + - number + - 'null' + description: 'The amount of quantity that was removed from the edited order + or null if the order is + + not a reduce only.' + required: + - type + - old + - new + - reducedQuantity + EditOrderStatus: + type: object + properties: + orderId: + type: + - string + - 'null' + description: The unique identifier of the order + cliOrdId: + type: + - string + - 'null' + description: 'The unique client order identifier. + + + This field is returned only if the order has a client order ID.' + orderEvents: + type: array + items: + $ref: '#/components/schemas/OrderEvent' + receivedTime: + type: + - string + - 'null' + description: The date and time the order was received + status: + type: string + enum: + - edited + - invalidSize + - invalidPrice + - insufficientAvailableFunds + - selfFill + - tooManySmallOrders + - outsidePriceCollar + - postWouldExecute + - wouldNotReducePosition + - orderForEditNotFound + - orderForEditNotAStop + description: 'The status of the order, either of: + + + - `edited` - The order was edited successfully + + - `invalidSize` - The order was not placed because size is invalid + + - `invalidPrice` - The order was not placed because limitPrice and/or + stopPrice are invalid + + - `insufficientAvailableFunds` - The order was not placed because available + funds are insufficient + + - `selfFill` - The order was not placed because it would be filled against + an existing order belonging to the same account + + - `tooManySmallOrders` - The order was not placed because the number of + small open orders would exceed the permissible limit + + - `outsidePriceCollar` - The limit order crosses the spread but is an + order of magnitude away from the mark price - fat finger control + + - `postWouldExecute` - The post-only order would be filled upon placement, + thus is cancelled + + - `wouldNotReducePosition` - The edit cannot be applied because the reduce + only policy is violated. (Only for reduceOnly orders) + + - `orderForEditNotFound` - The requested order for edit has not been found + + - `orderForEditNotAStop` - The supplied stopPrice cannot be applied because + order is not a stop order' + required: + - status + - orderEvents + Error: + type: string + description: "Error description.\n\n - `accountInactive`: The Futures account\ + \ the request refers to is inactive\n - `apiLimitExceeded`: The API limit\ + \ for the calling IP address has been exceeded\n - `authenticationError`:\ + \ The request could not be authenticated\n - `insufficientFunds`: The amount\ + \ requested for transfer is below the amount of funds available\n - `invalidAccount`:\ + \ The Futures account the transfer request refers to is invalid\n - `invalidAmount`:\ + \ The amount the transfer request refers to is invalid\n - `invalidArgument`:\ + \ One or more arguments provided are invalid\n - `invalidUnit`: The unit\ + \ the transfer request refers to is invalid\n - `Json Parse Error`: The request\ + \ failed to pass valid JSON as an argument\n - `marketUnavailable`: The market\ + \ is currently unavailable\n - `nonceBelowThreshold`: The provided nonce\ + \ is below the threshold\n - `nonceDuplicate`: The provided nonce is a duplicate\ + \ as it has been used in a previous request\n - `notFound`: The requested\ + \ information could not be found\n - `requiredArgumentMissing`: One or more\ + \ required arguments are missing\n - `Server Error`: There was an error processing\ + \ the request\n - `Unavailable`: The endpoint being called is unavailable\n\ + \ - `unknownError`: An unknown error has occurred" + enum: + - accountInactive + - apiLimitExceeded + - authenticationError + - insufficientFunds + - invalidAccount + - invalidAmount + - invalidArgument + - invalidUnit + - Json Parse Error + - marketUnavailable + - nonceBelowThreshold + - nonceDuplicate + - notFound + - requiredArgumentMissing + - Server Error + - Unavailable + - unknownError + ErrorResponse: + allOf: + - title: Errors + type: object + properties: + errors: + type: array + items: + $ref: '#/components/schemas/Error' + error: + $ref: '#/components/schemas/Error' + required: + - error + - $ref: '#/components/schemas/ResultError' + - $ref: '#/components/schemas/ServerTime' + ExecuteEvent: + type: object + properties: + type: + description: Always `EXECUTION`. + type: string + enum: + - EXECUTION + executionId: + type: string + format: uuid + description: The UID associated with the execution. + price: + type: number + description: The price of the execution. + amount: + type: number + description: The executed amount. + orderPriorEdit: + oneOf: + - $ref: '#/components/schemas/OrderJson' + description: 'The order before the edit was applied (if the execution + is a result of an order + + edit).' + - type: 'null' + orderPriorExecution: + $ref: '#/components/schemas/OrderJson' + description: The order before it executes. + takerReducedQuantity: + type: + - number + - 'null' + description: 'The amount of quantity that was removed from the order before + execution or null if the + + order is not a reduce only.' + required: + - type + - executionId + - price + - amount + - orderPriorEdit + - orderPriorExecution + - takerReducedQuantity + FeeSchedule: + type: object + properties: + tiers: + type: array + items: + $ref: '#/components/schemas/FeeTier' + description: A list containing a structures for each fee tier, see below. + name: + type: string + description: Name of schedule. + example: PGTMainFees + uid: + type: string + description: Unique identifier of fee schedule. + example: 7fc4d7c0-464f-4029-a9bb-55856d0c5247 + required: + - tiers + - name + - uid + example: + uid: 7fc4d7c0-464f-4029-a9bb-55856d0c5247 + name: PGTMainFees + tiers: + - makerFee: 0.02 + takerFee: 0.05 + usdVolume: 0.0 + - makerFee: 0.015 + takerFee: 0.04 + usdVolume: 100000.0 + - makerFee: 0.0125 + takerFee: 0.03 + usdVolume: 1000000.0 + - makerFee: 0.01 + takerFee: 0.025 + usdVolume: 5000000.0 + - makerFee: 0.0075 + takerFee: 0.02 + usdVolume: 10000000.0 + - makerFee: 0.005 + takerFee: 0.015 + usdVolume: 20000000.0 + - makerFee: 0.0025 + takerFee: 0.0125 + usdVolume: 50000000.0 + - makerFee: 0.0 + takerFee: 0.01 + usdVolume: 100000000.0 + FeeScheduleVolumes: + type: object + description: The 30-day volume for your account. + additionalProperties: + type: number + example: + d46c2190-81e3-4370-a333-424f24387829: 10.0 + 7fc4d7c0-464f-4029-a9bb-55856d0c5247: 10.0 + FeeTier: + type: object + properties: + makerFee: + type: number + description: Percentage value of maker fee in the tier. + example: 0.015 + takerFee: + type: number + description: Percentage value of taker fee in the tier. + example: 0.04 + usdVolume: + type: number + description: Minimum 30-day USD volume for fee tier to be applicable. + example: 100000.0 + required: + - makerFee + - takerFee + - usdVolume + FillJson: + type: object + properties: + cliOrdId: + type: + - string + - 'null' + description: 'The unique client order identifier. + + + This field is returned only if the order has a client order ID.' + fillTime: + type: string + description: The date and time the order was filled. + example: '2021-11-18T02:39:41.826Z' + fillType: + type: string + enum: + - maker + - taker + - liquidation + - assignor + - assignee + - takerAfterEdit + - unwindBankrupt + - unwindCounterparty + description: 'The classification of the fill: + + + - `maker` - user has a limit order that gets filled + + - `taker` - the user makes an execution that crosses the spread + + - `liquidation` - execution is result of a liquidation + + - `assignee` - execution is a result of a counterparty receiving an Assignment + in PAS + + - `assignor` - execution is a result of user assigning their position + due to failed liquidation' + example: maker + fill_id: + type: string + format: uuid + description: 'The unique identifier of the fill. Note that several `fill_id` + can pertain to one + + `order_id` (but not vice versa)' + order_id: + type: string + format: uuid + description: The unique identifier of the order. + price: + type: number + description: The price of the fill. + example: 47000 + side: + type: string + enum: + - buy + - sell + description: The direction of the order. + example: buy + size: + type: number + description: The size of the fill. + example: 10 + symbol: + type: string + description: The symbol of the futures the fill occurred in. + example: PI_XBTUSD + required: + - fill_id + - symbol + - side + - order_id + - size + - price + - fillTime + - fillType + example: + fill_id: 98e3deeb-0385-4b25-b15e-7e8453512cb2 + fillTime: '2021-11-18T02:39:41.826Z' + fillType: maker + order_id: 06b9d509-965c-4788-b317-0e5ca11d56fb + price: 47000 + side: buy + size: 10 + symbol: PI_XBTUSD + FlexAccountBalance: + type: object + properties: + currencies: + type: array + items: + $ref: '#/components/schemas/FlexCurrencyBalance' + initialMargin: + type: number + description: The total initial margin for the multi-collateral account in + USD. + initialMarginWithOrders: + type: number + description: 'The total initial margin of open positions without the margin + held by open orders for + + the multi-collateral account in USD.' + maintenanceMargin: + type: number + description: The total maintenance margin for the multi-collateral account + in USD. + balanceValue: + type: number + description: The total balance value for the multi-collateral account in + USD. + portfolioValue: + type: number + description: The total value of the portfolio in USD (Balance Value + Total + Unrealised Profit/Loss). + collateralValue: + type: number + description: The USD value of balances in account usable for margin [(Balance + Value * (1-Haircut)]. + pnl: + type: number + description: The unrealised pnl for the multi-collateral account. + unrealizedFunding: + type: number + description: The total unrealised funding for the multi-collateral account + in USD. + totalUnrealized: + type: number + description: 'Total unrealised Profit/Loss and unrealised funding of open + positions in USD `(Unrealised + + Position(s) Profit/Loss + Unrealised Funding Rate Profit/Loss) * USD rate`.' + totalUnrealizedAsMargin: + type: number + description: 'Unrealised Profit/Loss and unrealised funding that is usable + as margin `(Unrealised + + Profit/Loss + Unrealised Funding Rate) * Haircut - Conversion Fee`.' + availableMargin: + type: number + description: 'Account-wide margin available to create new orders (Margin + Equity - Total Initial + + Margin).' + marginEquity: + type: number + description: 'The Balance Value multiplied by the dollar rate and with haircuts + applied to non-USD currencies, plus unrealised profit or loss as Margin. + + + `[Balance Value in USD * (1-Haircut)] + (Total Unrealised Profit/Loss + as Margin in USD)`' + portfolioMarginBreakdown: + $ref: _schemas.yml#/PortfolioMarginBreakdown + description: Breakdown of portfolio margin components. + required: + - currencies + - initialMargin + - initialMarginWithOrders + - maintenanceMargin + - balanceValue + - portfolioValue + - collateralValue + - pnl + - unrealizedFunding + - totalUnrealized + - totalUnrealizedAsMargin + - availableMargin + - marginEquity + FlexBalanceSummary: + type: object + properties: + type: + type: string + enum: + - multiCollateralMarginAccount + description: The type of the account (always multiCollateralMarginAccount) + currencies: + $ref: '#/components/schemas/FlexCurrencies' + description: Structure with collateral currency details. + initialMargin: + type: number + description: Total initial margin held for open positions (USD). + initialMarginWithOrders: + type: number + description: Total initial margin held for open positions and open orders + (USD). + maintenanceMargin: + type: number + description: Total maintenance margin held for open positions (USD). + balanceValue: + type: number + description: USD value of all collateral in multi-collateral wallet. + portfolioValue: + type: number + description: Balance value plus unrealised PnL in USD. + collateralValue: + type: number + description: USD value of balances in account usable for margin (Balance + Value * Haircut). + pnl: + type: number + description: Unrealised PnL in USD. + unrealizedFunding: + type: number + description: Unrealised funding from funding rate (USD). + totalUnrealized: + type: number + description: Total USD value of unrealised funding and unrealised PnL. + totalUnrealizedAsMargin: + type: number + description: 'Unrealised pnl and unrealised funding that is usable as margin + `[(Unrealised Profit/Loss + + + Unrealised Funding Rate) * Haircut - Conversion Fee]`.' + availableMargin: + type: number + description: Margin Equity - Total Initial Margin. + marginEquity: + type: number + description: '`[Balance Value in USD * (1-Haircut)] + (Total Unrealised + Profit/Loss as Margin in USD)`' + portfolioMarginBreakdown: + $ref: _schemas.yml#/PortfolioMarginBreakdown + description: Breakdown of portfolio margin components. + required: + - currencies + - initialMargin + - initialMarginWithOrders + - maintenanceMargin + - balanceValue + - portfolioValue + - collateralValue + - pnl + - unrealizedFunding + - totalUnrealized + - totalUnrealizedAsMargin + - availableMargin + - marginEquity + FlexCurrencies: + type: object + additionalProperties: + $ref: '#/components/schemas/FlexCurrencySummary' + FlexCurrencyBalance: + type: object + properties: + currency: + type: string + description: The name of the currency. + quantity: + type: number + description: The amount of currency in the multi-collateral account. + value: + type: number + description: The value of the currency quantity. + collateral: + type: number + description: The collateral value of the currency quantity (value * haircut). + available: + type: number + description: The available currency (quantity - margin requirement) + required: + - currency + - quantity + - value + - collateral + - available + FlexCurrencySummary: + type: object + properties: + quantity: + type: number + description: Quantity of asset. + value: + type: number + description: USD value of asset. + collateral: + type: number + description: USD value of the asset usable for margin (Asset Value * Haircut). + available: + type: number + description: Margin (in base currency) available for trading. + required: + - quantity + - value + - collateral + - available + FutureAccountBalance: + type: object + properties: + name: + type: string + description: The name of the futures account as the account pair. + availableMargin: + type: number + description: The amount of currency in the holding account in the quote + currency of the name pair. + required: + - name + - availableMargin + HistoricalFundingRateJson: + type: object + properties: + fundingRate: + description: The absolute funding rate for the listed time period + $ref: _schemas.yml#/DecimalDouble + relativeFundingRate: + description: The relative funding rate for the listed time period + $ref: _schemas.yml#/DecimalDouble + timestamp: + description: Start of the period to which the funding rate applies. + type: string + format: date-time + required: + - fundingRate + - relativeFundingRate + - timestamp + HistoryJson: + type: object + properties: + price: + type: number + description: 'For futures: The price of a fill + + + For indices: The calculated value' + side: + type: string + description: 'The classification of the taker side in the matched trade: + "buy" if the taker is a buyer, "sell" if the taker is a seller.' + size: + type: string + description: 'For futures: The size of a fill + + For indices: Not returned because N/A' + time: + type: string + description: 'The date and time of a trade or an index computation + + + For futures: The date and time of a trade. Data is not aggregated + + For indices: The date and time of an index computation. For real-time + indices, data is aggregated to the last computation of each full hour. + For reference rates, data is not aggregated' + trade_id: + type: integer + format: int32 + description: 'For futures: A continuous index starting at 1 for the first + fill in a Futures contract maturity + + For indices: Not returned because N/A' + type: + type: string + enum: + - fill + - liquidation + - assignment + - termination + - block + description: 'The classification of the matched trade in an orderbook: + + + - `fill` - it is a normal buyer and seller + + - `liquidation` - it is a result of a user being liquidated from their + position + + - `assignment` - the fill is the result of a users position being assigned + to a marketmaker + + - `termination` - it is a result of a user being terminated + + - `block` - it is an element of a block trade' + uid: + type: string + instrument_identification_type: + type: string + isin: + type: string + execution_venue: + type: string + price_notation: + type: string + price_currency: + type: string + notional_amount: + type: number + notional_currency: + type: string + publication_time: + type: string + publication_venue: + type: string + transaction_identification_code: + type: string + to_be_cleared: + type: boolean + required: + - time + - price + HoldingAccountBalance: + type: object + properties: + currency: + type: string + description: The currency of the account. All figures shown in this currency. + amount: + type: number + description: The amount of currency in the holding account. + required: + - currency + - amount + IndexTicker: + title: Index Ticker + type: object + properties: + symbol: + description: The symbol of the index. + type: string + example: rr_ethusd + last: + description: The last calculated value. + type: number + lastTime: + description: The date and time at which `last` was observed. + type: string + format: date-time + required: + - symbol + additionalProperties: false + Instrument: + type: object + properties: + category: + type: string + description: '''Category of the contract: "Layer 1", "Layer 2", "DeFi", + or "Privacy" (multi-collateral + + contracts only).''' + contractSize: + type: number + description: The contract size of the Futures. + contractValueTradePrecision: + type: number + description: 'Trade precision for the contract (e.g. trade precision of + 2 means trades are precise to + + the hundredth decimal place 0.01).' + fundingRateCoefficient: + type: number + impactMidSize: + type: number + description: Amount of contract used to calculated the mid price for the + mark price. + isin: + type: string + description: International Securities Identification Number (ISIN) + lastTradingTime: + type: string + format: date-time + marginSchedules: + description: A map containing margin schedules by platform. + type: object + additionalProperties: + $ref: '#/components/schemas/MarginSchedule' + retailMarginLevels: + description: Margin levels for retail clients. + type: array + items: + $ref: '#/components/schemas/MarginLevel' + marginLevels: + description: Margin levels for professional clients. + type: array + items: + $ref: '#/components/schemas/MarginLevel' + maxPositionSize: + type: number + description: Maximum number of contracts that one can hold in a position + maxRelativeFundingRate: + type: number + description: 'Perpetuals only: the absolute value of the maximum permissible + funding rate' + openingDate: + format: date-time + type: string + description: When the contract was first available for trading + postOnly: + type: boolean + description: True if the instrument is in post-only mode, false otherwise. + feeScheduleUid: + type: string + description: Unique identifier of fee schedule associated with the instrument + symbol: + description: Market symbol. + type: string + example: PF_BTCUSD + pair: + description: Asset pair. + type: string + example: BTC:USD + base: + description: Base asset. + type: string + example: BTC + quote: + description: Quote asset. + type: string + example: USD + tags: + type: array + items: + type: string + description: Tag for the contract (currently does not return a value). + tickSize: + type: number + description: Tick size of the contract being traded. + tradeable: + type: boolean + description: True if the instrument can be traded, False otherwise. + type: + type: string + enum: + - flexible_futures + - futures_inverse + - futures_vanilla + description: 'The type of the instrument: + + + - `flexible_futures` + + - `futures_inverse` + + - `futures_vanilla`' + underlying: + type: string + description: The underlying of the Futures. + underlyingFuture: + type: string + description: 'For options: The underlying future of the option. Otherwise + null.' + tradfi: + description: True if this is a non-crypto market. + type: boolean + mtf: + type: boolean + description: True if currently has MTF status. + required: + - tradeable + - symbol + - tradfi + InstrumentStatus: + type: object + properties: + tradeable: + $ref: _schemas.yml#/MarketSymbol + experiencingDislocation: + type: boolean + priceDislocationDirection: + type: + - string + - 'null' + enum: + - ABOVE_UPPER_BOUND + - BELOW_LOWER_BOUND + experiencingExtremeVolatility: + type: boolean + extremeVolatilityInitialMarginMultiplier: + type: integer + required: + - tradeable + - experiencingDislocation + - priceDislocationDirection + - experiencingExtremeVolatility + - extremeVolatilityInitialMarginMultiplier + LeveragePreference: + type: object + properties: + symbol: + type: string + maxLeverage: + type: number + required: + - symbol + - maxLeverage + MarginAccount: + type: object + properties: + type: + type: string + enum: + - marginAccount + description: The type of the account (always "marginAccount"). + currency: + type: string + description: 'The currency of the account. All figures shown in `auxiliary` + and `marginRequirements` + + are in this currency.' + balances: + $ref: '#/components/schemas/MarginAccountBalances' + description: A structure containing account balances. + auxiliary: + description: A structure containing auxiliary account information. + $ref: '#/components/schemas/Auxiliary' + marginRequirements: + $ref: '#/components/schemas/MarginRequirements' + description: A structure containing the account's margin requirements. + triggerEstimates: + $ref: '#/components/schemas/MarginRequirements' + description: A structure containing the account's margin trigger estimates. + required: + - type + - currency + - balances + - auxiliary + - marginRequirements + - triggerEstimates + MarginAccountBalances: + type: object + additionalProperties: + $ref: _schemas.yml#/DecimalString + MarginLevel: + type: object + properties: + contracts: + type: + - integer + - 'null' + format: int64 + description: 'For futures: The lower limit of the number of contracts to + which this margin level applies + + + For indices: Not returned because N/A' + numNonContractUnits: + type: + - number + - 'null' + format: double + description: 'For futures: The lower limit of the number of non-contract + units (i.e. quote currency + + units for linear futures) to which this margin level applies + + + For indices: Not returned because N/A. + + ' + initialMargin: + type: number + description: 'For futures: The initial margin requirement for this level + + + For indices: Not returned because N/A' + maintenanceMargin: + type: number + description: 'For futures: The maintenance margin requirement for this level + + + For indices: Not returned because N/A' + required: + - initialMargin + - maintenanceMargin + MarginRequirements: + type: object + properties: + im: + type: number + description: The initial margin requirement of the account. + mm: + type: number + description: The maintenance margin requirement of the account. + lt: + type: number + description: The liquidation threshold of the account. + tt: + type: number + description: The termination threshold of the account + required: + - im + - mm + - lt + - tt + MarginSchedule: + type: object + properties: + retail: + type: array + items: + $ref: '#/components/schemas/MarginLevel' + professional: + type: array + items: + $ref: '#/components/schemas/MarginLevel' + required: + - retail + - professional + MarketTicker: + title: Market Ticker + type: object + required: + - symbol + - tag + - pair + - markPrice + - vol24h + - volumeQuote + - openInterest + - suspended + - indexPrice + - postOnly + - change24h + properties: + symbol: + $ref: _schemas.yml#/MarketSymbol + last: + description: The price of the last fill. + $ref: _schemas.yml#/DecimalDouble + lastTime: + description: The date and time at which `last` was observed. + type: string + lastSize: + description: The size of the last fill. + type: number + tag: + type: string + enum: + - perpetual + - month + - quarter + - semiannual + description: 'Expiry-related grouping. + + + Currently can be ''perpetual'', ''month'', ''quarter'', or ''semiannual''. + Other tags may be + + added without notice.' + pair: + description: The currency pair of the instrument. + type: string + example: BTC:USD + markPrice: + description: The price to which Kraken Futures currently marks the Futures + for margining purposes. + type: number + bid: + description: The price of the current best bid. + type: number + bidSize: + description: The size of the current best bid. + type: number + ask: + description: The price of the current best ask. + type: number + askSize: + description: The size of the current best ask. + type: number + vol24h: + description: The sum of the sizes of all fills observed in the last 24 hours. + type: number + volumeQuote: + description: The sum of the `size * price` of all fills observed in the + last 24 hours. + type: number + openInterest: + description: The current open interest of the market. + type: number + open24h: + description: The price of the fill observed 24 hours ago. + type: number + high24h: + description: The highest fill price observed in the last 24 hours. + type: number + low24h: + description: The lowest fill price observed in the last 24 hours. + type: number + extrinsicValue: + type: number + description: "The mark price less the how much the option would be worth\ + \ if exercised now, i.e.:\n - For a call: `markPrice - ( max ( Underlying\ + \ - StrikePrice , 0) )`\n - For a put: `markPrice - ( max ( StrikePrice\ + \ - Underlying , 0) )`\n\nOnly returned for options markets." + fundingRate: + description: 'The current absolute funding rate. + + + Only returned for perpetual markets.' + type: number + fundingRatePrediction: + description: 'The estimated next absolute funding rate. + + + Only returned for perpetual markets.' + type: number + suspended: + description: True if the market is suspended. + type: boolean + indexPrice: + type: number + postOnly: + type: boolean + change24h: + description: The 24h change in price (%). + type: number + greeks: + description: 'Current greeks. + + + Only returned for options markets. + + + Note: This is currently available exclusively in the Kraken Futures DEMO + environment.' + $ref: _schemas.yml#/OptionGreeks + isUnderlyingMarketClosed: + type: boolean + description: 'True if the underlying market/index is closed. + + + Only returned for tradfi markets. + + ' + NotificationJson: + type: object + properties: + effectiveTime: + type: string + description: The time that notification is taking effect. + note: + type: string + description: 'The notification note. + + + A short description about the specific notification.' + priority: + type: string + enum: + - low + - medium + - high + description: "The notification priorities:\n\n- `low`\n- `medium`\n- `high`\n\ + \n If priority == \"high\" then it implies downtime will occur at `effective_time`\ + \ when type == \"maintenance\"." + type: + type: string + enum: + - new_feature + - bug_fix + - settlement + - general + - maintenance + - market + description: 'The notification types: + + + - `market` + + - `general` + + - `new_feature` + + - `bug_fix` + + - `maintenance` + + - `settlement` + + + If type == "maintenance" then it implies downtime will occur at `effective_time` + if priority == "high".' + expectedDowntimeMinutes: + type: integer + description: The expected downtime in minutes or absent if no downtime is + expected. + required: + - type + - priority + - effectiveTime + - note + OpenOrderJson: + type: object + properties: + order_id: + type: string + format: uuid + description: The unique identifier of the order. + cliOrdId: + type: string + description: 'The unique client order identifier. This field is returned + only if the order has a + + client order ID.' + status: + type: string + enum: + - untouched + - partiallyFilled + description: 'The status of the order: + + + - `untouched` - the entire size of the order is unfilled + + - `partiallyFilled` - the size of the order is partially but not entirely + filled' + side: + type: string + enum: + - buy + - sell + description: The direction of the order. + orderType: + type: string + enum: + - lmt + - stop + - take_profit + description: 'The order type: + + + - `lmt` - limit order + + - `stp` - stop order + + - `take_profit` - take profit order' + symbol: + type: string + description: The symbol of the futures to which the order refers. + limitPrice: + type: number + description: The limit price associated with the order. + stopPrice: + type: number + description: 'If orderType is `stp`: The stop price associated with the + order + + + If orderType is `lmt`: Not returned because N/A' + filledSize: + type: number + description: The filled size associated with the order. + unfilledSize: + type: number + description: The unfilled size associated with the order. + reduceOnly: + type: boolean + description: Is the order a reduce only order or not. + triggerSignal: + description: The trigger signal for the stop or take profit order. + type: string + enum: + - mark + - last + - spot + lastUpdateTime: + description: The date and time the order was last updated. + type: string + format: date-time + receivedTime: + description: The date and time the order was received. + type: string + format: date-time + required: + - receivedTime + - lastUpdateTime + - status + - order_id + - orderType + - symbol + - side + - filledSize + - reduceOnly + OpenRfq: + type: object + properties: + rfqUid: + type: string + format: uuid + description: The unique identifier for this RFQ + expiry: + type: string + format: date-time + description: The time at which this RFQ expires + markPrice: + type: number + format: double + description: The reference price of the RFQ + legs: + type: array + items: + $ref: '#/components/schemas/OpenRfqPosition' + description: The positions associated with the RFQ + required: + - rfqUid + - expiry + - markPrice + - legs + OpenRfqOffer: + type: object + properties: + uid: + type: string + format: uuid + description: Unique identifier for the offer + rfqUid: + type: string + format: uuid + description: Unique identifier for the RFQ + placementDate: + type: string + format: date-time + description: The date and time when the offer was placed + lastUpdateDate: + type: string + format: date-time + description: The last update date and time of the offer + bid: + type: string + format: decimal + description: The bid price, if available + ask: + type: string + format: decimal + description: The ask price, if available + required: + - uid + - rfqUid + - placementDate + - lastUpdateDate + OpenRfqOffersResponse: + type: object + properties: + openOffers: + type: array + items: + $ref: '#/components/schemas/OpenRfqOffer' + required: + - openOffers + OpenRfqPosition: + type: object + properties: + symbol: + type: string + description: The symbol of the derivatives contract + size: + type: number + format: double + description: The size of the position + markPrice: + type: number + format: double + description: The current mark price of the market + required: + - symbol + - size + - markPrice + OpenRfqsResponse: + type: object + properties: + rfqs: + type: array + items: + $ref: '#/components/schemas/OpenRfq' + required: + - rfqs + OrderBook: + type: object + properties: + asks: + description: The first value of the inner list is the ask price, the second + is the ask size. The outer list is sorted ascending by ask price. + type: array + items: + description: An array of two floats. The first value is the price. The + second value is the size. + type: array + minItems: 2 + maxItems: 2 + items: + type: number + example: + - 40178.0 + - 5.0 + bids: + description: The first value of the inner list is the bid price, the second + is the bid size. The outer list is sorted descending by bid price. + type: array + items: + description: An array of two floats. The first value is the price. The + second value is the size. + type: array + minItems: 2 + maxItems: 2 + items: + type: number + example: + - 40178.0 + - 5.0 + required: + - asks + - bids + example: + bids: + - - 40178 + - 5 + - - 40174 + - 4.2 + - - 40170 + - 7.2 + asks: + - - 40186 + - 5.0183 + - - 40190 + - 0.4183 + OrderError: + type: string + enum: + - MARKET_SUSPENDED + - MARKET_NOT_FOUND + - INVALID_PRICE + - INVALID_QUANTITY + - SMALL_ORDER_LIMIT_EXCEEDED + - INSUFFICIENT_MARGIN + - WOULD_CAUSE_LIQUIDATION + - CLIENT_ORDER_ID_IN_USE + - CLIENT_ORDER_ID_TOO_LONG + - MAX_POSITION_EXCEEDED + - PRICE_COLLAR + - PRICE_DISLOCATION + - EDIT_HAS_NO_EFFECT + - ORDER_FOR_CANCELLATION_NOT_FOUND + - ORDER_FOR_EDIT_NOT_FOUND + - ORDER_CANNOT_HAVE_TRIGGER_PRICE + - POST_WOULD_EXECUTE + - IOC_WOULD_NOT_EXECUTE + - WOULD_EXECUTE_SELF + - WOULD_NOT_REDUCE_POSITION + - REJECTED_AFTER_EXECUTION + - MARKET_IS_POST_ONLY + - ORDER_LIMIT_EXCEEDED + - FIXED_LEVERAGE_TOO_HIGH + - CANNOT_EDIT_TRIGGER_PRICE_OF_TRAILING_STOP + - CANNOT_EDIT_LIMIT_PRICE_OF_TRAILING_STOP + - TRAILING_STOP_ORDER_LIMIT_EXCEEDED + - TRAILING_STOP_PERCENT_DEVIATION_EXCEEDS_MAX_DECIMAL_PLACES + - TRAILING_STOP_QUOTE_DEVIATION_NOT_MULTIPLE_OF_TICK_SIZE + - TRAILING_STOP_MAX_DEVIATION_TOO_LARGE + - TRAILING_STOP_MAX_DEVIATION_TOO_SMALL + - INSUFFICIENT_HEADROOM_AROUND_CURRENT_PRICE_TO_EDIT_TRAILING_STOP + - NO_REFERENCE_PRICE_AVAILABLE_FOR_CALCULATING_TRAILING_STOP_TRIGGER_PRICE + - INSUFFICIENT_CLOSING_MARGIN + - LIMIT_PRICE_SET_AS_ABSOLUTE_AND_RELATIVE + - LIMIT_PRICE_OFFSET_VALUE_INVALID + - LIMIT_PRICE_OFFSET_UNIT_INVALID + - LIMIT_PRICE_OFFSET_MUST_HAVE_VALUE_AND_UNIT + - LIMIT_PRICE_OFFSET_QUOTE_CURRENCY_VALUE_MUST_BE_MULTIPLE_OF_TICK_SIZE + - LIMIT_PRICE_OFFSET_PERCENT_VALUE_TOO_MANY_DECIMAL_PLACES + - LIMIT_PRICE_OFFSET_TOO_HIGH + - LIMIT_PRICE_OFFSET_TOO_LOW + OrderEvent: + oneOf: + - $ref: '#/components/schemas/PlaceEvent' + - $ref: '#/components/schemas/CancelEvent' + - $ref: '#/components/schemas/EditEvent' + - $ref: '#/components/schemas/RejectEvent' + - $ref: '#/components/schemas/ExecuteEvent' + - $ref: '#/components/schemas/PlaceTriggerEvent' + - $ref: '#/components/schemas/CancelTriggerEvent' + - $ref: '#/components/schemas/RejectTriggerEvent' + OrderIdElement: + type: object + description: Provide either `order_id` or `cliOrdId`. + properties: + cliOrdId: + type: + - string + - 'null' + description: Unique client order identifier. + maxLength: 100 + order_id: + type: string + description: Order ID. + format: uuid + required: + - order_id + OrderJson: + type: object + properties: + orderId: + type: string + description: The UID associated with the order. + cliOrdId: + type: + - string + - 'null' + description: The client order id or null if order does not have one. + type: + type: string + enum: + - lmt + - ioc + - post + - liquidation + - assignment + - stp + - unwind + - block + - fok + description: The order type + symbol: + type: string + description: The symbol of the Futures. + side: + type: string + enum: + - buy + - sell + description: The side associated with the order + quantity: + type: number + description: The quantity (size) associated with the order. + filled: + type: number + description: The total amount of the order that has been filled. + limitPrice: + type: number + description: The limit price associated with a limit order. + reduceOnly: + type: boolean + description: Is the order a reduce only order or not. + timestamp: + type: string + description: The date and time the order was placed. + lastUpdateTimestamp: + type: string + description: The date and time the order was edited. + required: + - orderId + - cliOrdId + - type + - symbol + - side + - quantity + - filled + - limitPrice + - reduceOnly + - timestamp + - lastUpdateTimestamp + OrderStatusDetailsJson: + type: object + properties: + order: + $ref: '#/components/schemas/CachedOrderJson' + status: + $ref: '#/components/schemas/OrderStatusJson' + updateReason: + oneOf: + - $ref: '#/components/schemas/OrderUpdateReason' + - type: 'null' + error: + oneOf: + - $ref: '#/components/schemas/OrderError' + - type: 'null' + required: + - order + - status + - updateReason + - error + OrderStatusJson: + type: string + enum: + - ENTERED_BOOK + - FULLY_EXECUTED + - REJECTED + - CANCELLED + - TRIGGER_PLACED + - TRIGGER_ACTIVATION_FAILURE + OrderTriggerJson: + type: object + properties: + uid: + type: string + description: The UID associated with the order. + clientId: + type: + - string + - 'null' + description: The client order id or null if order does not have one. + type: + type: string + enum: + - lmt + - ioc + - post + - liquidation + - assignment + - stp + - unwind + - fok + description: The order type + symbol: + type: string + description: The symbol of the Futures. + side: + type: string + enum: + - buy + - sell + description: The side associated with the order + quantity: + type: + - number + - 'null' + description: The quantity (size) associated with the order. + limitPrice: + type: + - number + - 'null' + description: The limit price associated with a limit order. + triggerPrice: + type: + - number + - 'null' + triggerSide: + type: + - string + - 'null' + enum: + - trigger_above + - trigger_below + triggerSignal: + type: + - string + - 'null' + enum: + - mark_price + - last_price + - spot_price + reduceOnly: + type: boolean + description: Is the order a reduce only order or not. + timestamp: + type: string + description: The date and time the order was placed. + lastUpdateTimestamp: + type: string + description: The date and time the order was edited. + startTime: + type: + - string + - 'null' + required: + - uid + - clientId + - type + - symbol + - side + - quantity + - limitPrice + - triggerPrice + - triggerSide + - triggerSignal + - reduceOnly + - timestamp + - lastUpdateTimestamp + OrderUpdateReason: + type: string + enum: + - LOADING_MARKET + - NEW_USER_ORDER + - LIQUIDATION_ORDER + - STOP_ORDER_TRIGGERED + - LIMIT_FROM_STOP + - PARTIAL_FILL + - FULL_FILL + - CANCELLED_BY_USER + - CONTRACT_EXPIRED + - NOT_ENOUGH_MARGIN + - MARKET_INACTIVE + - DEAD_MAN_SWITCH + - CANCELLED_BY_ADMIN + - POST_WOULD_EXECUTE_REASON + - IOC_WOULD_NOT_EXECUTE_REASON + - WOULD_EXECUTE_SELF_REASON + - WOULD_NOT_REDUCE_POSITION + - EDITED_BY_USER + - ORDER_FOR_EDIT_NOT_FOUND_REASON + - EXPIRED + - TRAILING_STOP_PRICE_UPDATED + - TRAILING_STOP_CANCELLED_AND_REPLACED_BY_ADMIN + PlaceEvent: + type: object + properties: + type: + description: Always `PLACE`. + type: string + enum: + - PLACE + order: + description: The placed order. + $ref: '#/components/schemas/OrderJson' + reducedQuantity: + type: + - number + - 'null' + description: 'The amount of quantity that was removed before placement or + null if the order is not a + + reduce only.' + required: + - type + - order + - reducedQuantity + PlaceTriggerEvent: + type: object + properties: + type: + description: Always `PLACE`. + type: string + enum: + - PLACE + orderTrigger: + $ref: '#/components/schemas/OrderTriggerJson' + required: + - type + - orderTrigger + PnlPreference: + type: object + properties: + symbol: + type: string + pnlCurrency: + type: string + example: USD + required: + - symbol + - pnlCurrency + RejectEvent: + type: object + properties: + type: + description: Always `REJECT`. + type: string + enum: + - REJECT + uid: + type: string + description: The UID associated with the order. + order: + oneOf: + - $ref: '#/components/schemas/OrderJson' + description: The rejected order. + - type: 'null' + reason: + type: string + enum: + - POST_WOULD_EXECUTE + - IOC_WOULD_NOT_EXECUTE + description: 'The rejection reason: + + + - `POST_WOULD_EXECUTE` - The post-only order would be filled upon placement, + thus is cancelled. + + - `IOC_WOULD_NOT_EXECUTE` - The immediate-or-cancel order would not execute.' + x-codeReference: OrderError.toApiString() + required: + - type + - uid + - order + - reason + RejectTriggerEvent: + type: object + properties: + type: + description: Always `REJECT`. + type: string + enum: + - REJECT + uid: + type: string + orderTrigger: + oneOf: + - $ref: '#/components/schemas/OrderTriggerJson' + - type: 'null' + reason: + $ref: '#/components/schemas/OrderError' + required: + - type + - uid + - orderTrigger + - reason + ResultError: + type: object + properties: + result: + type: string + enum: + - error + example: error + required: + - result + ResultSuccess: + type: object + properties: + result: + type: string + enum: + - success + example: success + required: + - result + SelfTradeStrategy: + type: string + description: 'Self trade matching behaviour: + + + - `REJECT_TAKER` - default behaviour, rejects the taker order that would match + against a maker order from any sub-account + + - `CANCEL_MAKER_SELF` - only cancels the maker order if it is from the same + account that sent the taker order + + - `CANCEL_MAKER_CHILD` - only allows master to cancel its own maker orders + and orders from its sub-account + + - `CANCEL_MAKER_ANY` - allows both master accounts and their subaccounts to + cancel maker orders + + ' + enum: + - REJECT_TAKER + - CANCEL_MAKER_SELF + - CANCEL_MAKER_CHILD + - CANCEL_MAKER_ANY + SelfTradeStrategyJson: + type: object + description: Self trade strategy response + required: + - strategy + properties: + strategy: + $ref: '#/components/schemas/SelfTradeStrategy' + SendOrderJson: + type: object + properties: + cliOrdId: + type: string + description: 'The unique client order identifier. + + + This field is returned only if the order has a client order ID.' + orderEvents: + type: array + items: + $ref: '#/components/schemas/OrderEvent' + order_id: + type: string + format: uuid + description: The unique identifier of the order + receivedTime: + description: The date and time the order was received. + type: string + format: date-time + status: + type: string + enum: + - placed + - partiallyFilled + - filled + - cancelled + - edited + - marketSuspended + - marketInactive + - invalidPrice + - invalidSize + - tooManySmallOrders + - insufficientAvailableFunds + - wouldCauseLiquidation + - clientOrderIdAlreadyExist + - clientOrderIdTooBig + - maxPositionViolation + - outsidePriceCollar + - wouldIncreasePriceDislocation + - notFound + - orderForEditNotAStop + - orderForEditNotFound + - postWouldExecute + - iocWouldNotExecute + - selfFill + - wouldNotReducePosition + - marketIsPostOnly + - tooManyOrders + - fixedLeverageTooHigh + - clientOrderIdInvalid + - cannotEditTriggerPriceOfTrailingStop + - cannotEditLimitPriceOfTrailingStop + - wouldProcessAfterSpecifiedTime + description: 'The status of the order, either of: + + + - `placed` - the order was placed successfully + + - `cancelled` - the order was cancelled successfully + + - `invalidOrderType` - the order was not placed because orderType is invalid + + - `invalidSide` - the order was not placed because side is invalid + + - `invalidSize` - the order was not placed because size is invalid + + - `invalidPrice` - the order was not placed because limitPrice and/or + stopPrice are invalid + + - `insufficientAvailableFunds` - the order was not placed because available + funds are insufficient + + - `selfFill` - the order was not placed because it would be filled against + an existing order belonging to the same account + + - `tooManySmallOrders` - the order was not placed because the number of + small open orders would exceed the permissible limit + + - `maxPositionViolation` - Order would cause you to exceed your maximum + position in this contract. + + - `marketSuspended` - the order was not placed because the market is suspended + + - `marketInactive` - the order was not placed because the market is inactive + + - `clientOrderIdAlreadyExist` - the specified client id already exist + + - `clientOrderIdTooLong` - the client id is longer than the permissible + limit + + - `outsidePriceCollar` - the order would have executed outside of the + price collar for its order type + + - `postWouldExecute` - the post-only order would be filled upon placement, + thus is cancelled + + - `iocWouldNotExecute` - the immediate-or-cancel order would not execute. + + - `wouldCauseLiquidation` - returned when a new order would fill at a + worse price than the mark price, causing the portfolio value to fall below + maintenance margin and triggering a liquidation. + + - `wouldNotReducePosition` - the reduce only order would not reduce position. + + - `wouldProcessAfterSpecifiedTime` - order would be processed after the + time specified in `processBefore` parameter.' + required: + - status + ServerTime: + type: object + properties: + serverTime: + description: Server time in Coordinated Universal Time (UTC) + type: string + format: date-time + example: '2020-08-27T17:03:33.196Z' + required: + - serverTime + SubAccount: + type: object + properties: + accountUid: + type: string + description: The account UID + email: + type: string + description: The email associated with the account + fullName: + type: + - string + - 'null' + description: The name of the account + holdingAccounts: + type: array + items: + $ref: '#/components/schemas/HoldingAccountBalance' + description: 'Structure containing structures with holding accounts information + for a specific holding + + account asset.' + futuresAccounts: + type: array + items: + $ref: '#/components/schemas/FutureAccountBalance' + description: 'Structure containing structures with single-collateral accounts + information for a + + specific futures account asset.' + flexAccount: + type: object + $ref: '#/components/schemas/FlexAccountBalance' + description: Multi-collateral account structure. + required: + - accountUid + - email + - fullName + - holdingAccounts + - futuresAccounts + - flexAccount + SubaccountEnabledJson: + type: object + properties: + tradingEnabled: + type: boolean + required: + - tradingEnabled + SuccessResponse: + allOf: + - $ref: '#/components/schemas/ResultSuccess' + - $ref: '#/components/schemas/ServerTime' + TriggerOptions: + type: object + properties: + triggerPrice: + type: number + triggerSide: + type: string + enum: + - TRIGGER_ABOVE + - TRIGGER_BELOW + triggerSignal: + type: string + enum: + - MARK_PRICE + - LAST_PRICE + - SPOT_PRICE + required: + - triggerPrice + - triggerSide + - triggerSignal + UnwindQueueJson: + type: object + properties: + symbol: + type: string + description: The symbol of the futures to which the order refers. + percentile: + type: integer + format: int32 + description: The percentile rank of which the trader's position is in the + unwind queue (20, 40, 80, or 100). + required: + - symbol + - percentile + WithdrawalResponse: + description: Withdrawal initiated + allOf: + - type: object + properties: + uid: + description: Withdrawal/transfer reference + type: string + required: + - uid + - $ref: '#/components/schemas/SuccessResponse' + parameters: + ProcessBefore: + description: The time before which the request should be processed, otherwise + it is rejected. + name: processBefore + in: query + required: false + schema: + type: string + format: date-time + example: 2023-11-08 19:56:35.441899+00:00 + examples: + AccountsExample: + value: + accounts: + cash: + balances: + xbt: '141.31756797' + xrp: '52465.1254' + type: cashAccount + fi_xbtusd: + auxiliary: + af: 100.73891563 + funding: 100.73891563 + pnl: 12.42134766 + pv: 153.73891563 + usd: 0 + balances: + FI_XBTUSD_171215: '50000' + FI_XBTUSD_180615: '-15000' + xbt: '141.31756797' + xrp: '0' + currency: xbt + marginRequirements: + im: 52.8 + lt: 39.6 + mm: 23.76 + tt: 15.84 + triggerEstimates: + im: 3110 + lt: 2890 + mm: 3000 + tt: 2830 + type: marginAccount + flex: + type: multiCollateralMarginAccount + currencies: + XBT: + quantity: 0.1185308247 + value: 4998.721054420551 + collateral: 4886.49976674881 + available: 0.1185308247 + USD: + quantity: 5000.0 + value: 5000.0 + collateral: 5000.0 + available: 5000.0 + EUR: + quantity: 4540.5837374453 + value: 4999.137289089901 + collateral: 4886.906656949836 + available: 4540.5837374453 + balanceValue: 34995.52 + portfolioValue: 34995.52 + collateralValue: 34122.66 + initialMargin: 0.0 + initialMarginWithOrders: 0.0 + maintenanceMargin: 0.0 + pnl: 0.0 + unrealizedFunding: 0.0 + totalUnrealized: 0.0 + totalUnrealizedAsMargin: 0.0 + marginEquity: 34122.66 + availableMargin: 34122.66 + result: success + serverTime: '2016-02-25T09:45:53.818Z' + BatchOrderExample: + value: + result: success + batchStatus: + - status: placed + order_tag: '1' + order_id: 022774bc-2c4a-4f26-9317-436c8d85746d + dateTimeReceived: '2019-09-05T16:41:35.173Z' + orderEvents: + - type: PLACE + order: + orderId: 022774bc-2c4a-4f26-9317-436c8d85746d + type: lmt + symbol: PI_XBTUSD + side: buy + quantity: 1000 + filled: 0 + limitPrice: 9400.0 + reduceOnly: false + timestamp: '2019-09-05T16:41:35.173Z' + lastUpdateTimestamp: '2019-09-05T16:41:35.173Z' + - status: edited + order_id: 9c2cbcc8-14f6-42fe-a020-6e395babafd1 + orderEvents: + - type: EDIT + old: + orderId: 9c2cbcc8-14f6-42fe-a020-6e395babafd1 + type: lmt + symbol: PI_XBTUSD + side: buy + quantity: 102.0 + filled: 0.0 + limitPrice: 8500.0 + reduceOnly: false + timestamp: '2019-09-04T11:45:48.884Z' + lastUpdateTimestamp: '2019-09-04T11:45:48.884Z' + new: + orderId: 9c2cbcc8-14f6-42fe-a020-6e395babafd1 + type: lmt + symbol: PI_XBTUSD + side: buy + quantity: 1000 + filled: 0.0 + limitPrice: 9400.0 + reduceOnly: false + timestamp: '2019-09-04T11:45:48.884Z' + lastUpdateTimestamp: '2019-09-05T16:41:40.996Z' + - status: cancelled + order_id: 566942c8-a3b5-4184-a451-622b09493129 + orderEvents: + - type: CANCEL + uid: 566942c8-a3b5-4184-a451-622b09493129 + order: + orderId: 566942c8-a3b5-4184-a451-622b09493129 + type: lmt + symbol: PI_XBTUSD + side: buy + quantity: 100.0 + filled: 0.0 + limitPrice: 8500.0 + reduceOnly: false + timestamp: '2019-09-02T12:54:08.005Z' + lastUpdateTimestamp: '2019-09-02T12:54:08.005Z' + serverTime: '2019-09-05T16:41:40.996Z' + CancelAllOrdersAfterCancelExample: + value: + result: success + status: + currentTime: '2018-06-19T16:51:23.839Z' + triggerTime: '0' + serverTime: '2018-06-19T16:51:23.839Z' + CancelAllOrdersAfterFailureExample: + value: + result: error + serverTime: '2016-02-25T09:45:53.818Z' + error: apiLimitExceeded + CancelAllOrdersAfterSuccessExample: + value: + result: success + status: + currentTime: '2018-06-19T16:51:23.839Z' + triggerTime: '2018-06-19T16:52:23.839Z' + serverTime: '2018-06-19T16:51:23.839Z' + CancelAllOrdersExample: + value: + result: success + cancelStatus: + receivedTime: '2019-08-01T15:57:37.518Z' + cancelOnly: all + status: cancelled + cancelledOrders: + - order_id: 6180adfa-e4b1-4a52-adac-ea5417620dbd + - order_id: 89e3edbe-d739-4c52-b866-6f5a8407ff6e + - order_id: 0cd37a77-1644-4960-a7fb-9a1f6e0e46f7 + orderEvents: + - type: CANCEL + uid: 89e3edbe-d739-4c52-b866-6f5a8407ff6e + order: + orderId: 89e3edbe-d739-4c52-b866-6f5a8407ff6e + type: post + symbol: PI_XBTUSD + side: buy + quantity: 890 + filled: 0 + limitPrice: 10040 + reduceOnly: false + timestamp: '2019-08-01T15:57:08.508Z' + lastUpdateTimestamp: '2019-08-01T15:57:08.508Z' + - type: CANCEL + uid: 0cd37a77-1644-4960-a7fb-9a1f6e0e46f7 + order: + orderId: 0cd37a77-1644-4960-a7fb-9a1f6e0e46f7 + type: lmt + symbol: PI_XBTUSD + side: sell + quantity: 900 + filled: 0 + limitPrice: 10145 + reduceOnly: true + timestamp: '2019-08-01T15:57:14.003Z' + lastUpdateTimestamp: '2019-08-01T15:57:14.003Z' + serverTime: '2019-08-01T15:57:37.520Z' + CancelOrderExample: + value: + result: success + cancelStatus: + status: cancelled + order_id: cb4e34f6-4eb3-4d4b-9724-4c3035b99d47 + receivedTime: '2020-07-22T13:26:20.806Z' + orderEvents: + - type: CANCEL + uid: cb4e34f6-4eb3-4d4b-9724-4c3035b99d47 + order: + orderId: cb4e34f6-4eb3-4d4b-9724-4c3035b99d47 + cliOrdId: '1234568' + type: lmt + symbol: PI_XBTUSD + side: buy + quantity: 5500 + filled: 0 + limitPrice: 8000 + reduceOnly: false + timestamp: '2020-07-22T13:25:56.366Z' + lastUpdateTimestamp: '2020-07-22T13:25:56.366Z' + serverTime: '2020-07-22T13:26:20.806Z' + EditOrderExample: + value: + result: success + editStatus: + status: edited + orderId: 022774bc-2c4a-4f26-9317-436c8d85746d + receivedTime: '2019-09-05T16:47:47.521Z' + orderEvents: + - type: EDIT + old: + orderId: 022774bc-2c4a-4f26-9317-436c8d85746d + type: lmt + symbol: PI_XBTUSD + side: buy + quantity: 1000 + filled: 0 + limitPrice: 9400.0 + reduceOnly: false + timestamp: '2019-09-05T16:41:35.173Z' + lastUpdateTimestamp: '2019-09-05T16:41:35.173Z' + new: + orderId: 022774bc-2c4a-4f26-9317-436c8d85746d + type: lmt + symbol: PI_XBTUSD + side: buy + quantity: 1501 + filled: 0 + limitPrice: 7200 + reduceOnly: false + timestamp: '2019-09-05T16:41:35.173Z' + lastUpdateTimestamp: '2019-09-05T16:47:47.519Z' + serverTime: '2019-09-05T16:47:47.521Z' + ExecutedOrderExample: + value: + result: success + sendStatus: + order_id: 61ca5732-3478-42fe-8362-abbfd9465294 + status: placed + receivedTime: '2019-12-11T17:17:33.888Z' + orderEvents: + - type: EXECUTION + executionId: e1ec9f63-2338-4c44-b40a-43486c6732d7 + price: 7244.5 + amount: 10 + orderPriorExecution: + orderId: 61ca5732-3478-42fe-8362-abbfd9465294 + type: lmt + symbol: PI_XBTUSD + side: buy + quantity: 10 + filled: 0 + limitPrice: 7500 + reduceOnly: false + timestamp: '2019-12-11T17:17:33.888Z' + lastUpdateTimestamp: '2019-12-11T17:17:33.888Z' + serverTime: '2019-12-11T17:17:33.888Z' + FeeSchedulesExample: + value: + result: success + serverTime: '2022-03-31T20:38:53.677Z' + feeSchedules: + - uid: 7fc4d7c0-464f-4029-a9bb-55856d0c5247 + name: PGTMainFees + tiers: + - makerFee: 0.02 + takerFee: 0.05 + usdVolume: 0.0 + - makerFee: 0.015 + takerFee: 0.04 + usdVolume: 100000.0 + - makerFee: 0.0125 + takerFee: 0.03 + usdVolume: 1000000.0 + - makerFee: 0.01 + takerFee: 0.025 + usdVolume: 5000000.0 + - makerFee: 0.0075 + takerFee: 0.02 + usdVolume: 10000000.0 + - makerFee: 0.005 + takerFee: 0.015 + usdVolume: 20000000.0 + - makerFee: 0.0025 + takerFee: 0.0125 + usdVolume: 50000000.0 + - makerFee: 0.0 + takerFee: 0.01 + usdVolume: 100000000.0 + - uid: d46c2190-81e3-4370-a333-424f24387829 + name: mainfees + tiers: + - makerFee: 0.02 + takerFee: 0.05 + usdVolume: 0.0 + - makerFee: 0.015 + takerFee: 0.04 + usdVolume: 100000.0 + - makerFee: 0.0125 + takerFee: 0.03 + usdVolume: 1000000.0 + - makerFee: 0.01 + takerFee: 0.025 + usdVolume: 5000000.0 + - makerFee: 0.0075 + takerFee: 0.02 + usdVolume: 10000000.0 + - makerFee: 0.005 + takerFee: 0.015 + usdVolume: 20000000.0 + - makerFee: 0.0025 + takerFee: 0.0125 + usdVolume: 50000000.0 + - makerFee: 0.0 + takerFee: 0.01 + usdVolume: 100000000.0 + FeeSchedulesValuesExample: + value: + result: success + serverTime: '2016-02-25T09:45:53.818Z' + volumesByFeeSchedule: + eef90775-995b-4596-9257-0917f6134766: 53823.0 + FillsExample: + value: + result: success + fills: + - fill_id: 3d57ed09-fbd6-44f1-8e8b-b10e551c5e73 + symbol: PI_XBTUSD + side: buy + order_id: 693af756-055e-47ef-99d5-bcf4c456ebc5 + size: 5490 + price: 9400 + fillTime: '2020-07-22T13:37:27.077Z' + fillType: maker + - fill_id: 56b86ada-73b0-454d-a95a-e29e3e85b349 + symbol: PI_XBTUSD + side: buy + order_id: 3f513c4c-683d-44ab-a73b-d296abbea201 + size: 5000 + price: 9456 + fillTime: '2020-07-21T12:41:52.790Z' + fillType: taker + serverTime: '2020-07-22T13:44:24.311Z' + GetLeveragePreferencesExample: + value: + result: success + serverTime: '2022-06-28T15:01:12.762Z' + leveragePreferences: + - symbol: PF_XBTUSD + maxLeverage: 10.0 + GetPnlPreferencesExample: + value: + result: success + serverTime: '2022-06-28T15:04:06.710Z' + preferences: + - symbol: PF_XBTUSD + pnlCurrency: BTC + HistoricalFundingRatesExample: + value: + result: success + serverTime: '2022-06-28T09:29:04.243Z' + rates: + - timestamp: '2022-06-28T00:00:00.000Z' + fundingRate: -8.15861558e-10 + relativeFundingRate: -1.6898883333333e-05 + - timestamp: '2022-06-28T04:00:00.000Z' + fundingRate: -2.6115278e-11 + relativeFundingRate: -5.40935416667e-07 + - timestamp: '2022-06-28T08:00:00.000Z' + fundingRate: -4.08356853e-10 + relativeFundingRate: -8.521190625e-06 + InstrumentsExample: + value: + instruments: + - symbol: PI_XBTUSD + pair: XBT:USD + base: XBT + quote: USD + type: futures_inverse + underlying: rr_xbtusd + tickSize: 0.5 + contractSize: 1 + tradeable: true + impactMidSize: 1 + maxPositionSize: 1000000 + openingDate: '2022-01-01T00:00:00.000Z' + marginLevels: + - contracts: 0 + initialMargin: 0.02 + maintenanceMargin: 0.01 + - contracts: 500000 + initialMargin: 0.04 + maintenanceMargin: 0.02 + - contracts: 1000000 + initialMargin: 0.06 + maintenanceMargin: 0.03 + - contracts: 3000000 + initialMargin: 0.1 + maintenanceMargin: 0.05 + fundingRateCoefficient: 8 + maxRelativeFundingRate: 0.001 + isin: GB00J62YGL67 + contractValueTradePrecision: 0 + postOnly: false + feeScheduleUid: eef90775-995b-4596-9257-0917f6134766 + retailMarginLevels: + - contracts: 0 + initialMargin: 0.5 + maintenanceMargin: 0.25 + category: '' + tags: [] + tradfi: false + mtf: true + - symbol: FI_XBTUSD_220930 + pair: XBT:USD + base: XBT + quote: USD + type: futures_inverse + underlying: rr_xbtusd + lastTradingTime: '2022-09-30T15:00:00.000Z' + tickSize: 0.5 + contractSize: 1 + tradeable: true + impactMidSize: 1 + maxPositionSize: 1000000 + openingDate: '2022-01-01T00:00:00.000Z' + marginLevels: + - contracts: 0 + initialMargin: 0.02 + maintenanceMargin: 0.01 + - contracts: 500000 + initialMargin: 0.04 + maintenanceMargin: 0.02 + - contracts: 1000000 + initialMargin: 0.06 + maintenanceMargin: 0.03 + - contracts: 3000000 + initialMargin: 0.1 + maintenanceMargin: 0.05 + isin: GB00JVMLP260 + contractValueTradePrecision: 0 + postOnly: false + feeScheduleUid: eef90775-995b-4596-9257-0917f6134766 + retailMarginLevels: + - contracts: 0 + initialMargin: 0.5 + maintenanceMargin: 0.25 + category: '' + tags: [] + tradfi: false + mtf: false + - symbol: PF_XBTUSD + pair: XBT:USD + base: XBT + quote: USD + type: flexible_futures + tickSize: 1 + contractSize: 1 + tradeable: true + impactMidSize: 1 + maxPositionSize: 1000000 + openingDate: '2022-01-01T00:00:00.000Z' + marginLevels: + - numNonContractUnits: 0 + initialMargin: 0.02 + maintenanceMargin: 0.01 + - numNonContractUnits: 500000 + initialMargin: 0.04 + maintenanceMargin: 0.02 + - numNonContractUnits: 2000000 + initialMargin: 0.1 + maintenanceMargin: 0.05 + - numNonContractUnits: 5000000 + initialMargin: 0.2 + maintenanceMargin: 0.1 + - numNonContractUnits: 10000000 + initialMargin: 0.3 + maintenanceMargin: 0.15 + - numNonContractUnits: 30000000 + initialMargin: 0.5 + maintenanceMargin: 0.25 + fundingRateCoefficient: 8 + maxRelativeFundingRate: 0.001 + contractValueTradePrecision: 4 + feeScheduleUid: 5b755fea-c5b0-4307-a66e-b392cd5bd931 + postOnly: false + retailMarginLevels: + - numNonContractUnits: 0 + initialMargin: 0.02 + maintenanceMargin: 0.01 + - numNonContractUnits: 500000 + initialMargin: 0.04 + maintenanceMargin: 0.02 + - numNonContractUnits: 2000000 + initialMargin: 0.1 + maintenanceMargin: 0.05 + - numNonContractUnits: 5000000 + initialMargin: 0.2 + maintenanceMargin: 0.1 + - numNonContractUnits: 10000000 + initialMargin: 0.3 + maintenanceMargin: 0.15 + - numNonContractUnits: 30000000 + initialMargin: 0.5 + maintenanceMargin: 0.25 + category: Layer 1 + tags: [] + tradfi: false + mtf: false + result: success + serverTime: '2022-06-28T09:29:04.243Z' + NotificationsFailureExample: + value: + result: error + serverTime: '2016-02-25T09:45:53.818Z' + error: apiLimitExceeded + NotificationsSuccessExample: + value: + result: success + notifications: + - type: general + priority: low + note: We've launched a new Telegram group. + effectiveTime: '2022-03-31T20:38:52.677Z' + - type: settlement + priority: medium + note: Week contracts with maturity 29/Jun/2018 expire and settle. + effectiveTime: '2018-06-29T15:00:00Z' + serverTime: '2018-06-29T15:22:05.187Z' + OpenOrdersExample: + value: + result: success + openOrders: + - order_id: 59302619-41d2-4f0b-941f-7e7914760ad3 + symbol: PI_XBTUSD + side: sell + orderType: lmt + limitPrice: 10640 + unfilledSize: 304 + receivedTime: '2019-09-05T17:01:17.410Z' + status: untouched + filledSize: 0 + reduceOnly: true + lastUpdateTime: '2019-09-05T17:01:17.410Z' + - order_id: 022774bc-2c4a-4f26-9317-436c8d85746d + symbol: PI_XBTUSD + side: buy + orderType: lmt + limitPrice: 7200 + unfilledSize: 1501 + receivedTime: '2019-09-05T16:41:35.173Z' + status: untouched + filledSize: 0 + reduceOnly: false + lastUpdateTime: '2019-09-05T16:47:47.519Z' + - order_id: d08021f7-58cb-4f2c-9c86-da4c60de46bb + symbol: PI_XBTUSD + side: sell + orderType: lmt + limitPrice: 10640 + unfilledSize: 10000 + receivedTime: '2019-09-05T16:38:43.651Z' + status: untouched + filledSize: 0 + reduceOnly: true + lastUpdateTime: '2019-09-05T16:38:43.651Z' + - order_id: 179f9af8-e45e-469d-b3e9-2fd4675cb7d0 + symbol: PI_XBTUSD + side: buy + orderType: lmt + limitPrice: 9400 + unfilledSize: 10000 + receivedTime: '2019-09-05T16:33:50.734Z' + status: untouched + filledSize: 0 + reduceOnly: false + lastUpdateTime: '2019-09-05T16:33:50.734Z' + - order_id: 9c2cbcc8-14f6-42fe-a020-6e395babafd1 + symbol: PI_XBTUSD + side: buy + orderType: lmt + limitPrice: 9400 + unfilledSize: 1000 + receivedTime: '2019-09-04T11:45:48.884Z' + status: untouched + filledSize: 0 + reduceOnly: false + lastUpdateTime: '2019-09-05T16:41:40.996Z' + - order_id: 3deea5c8-0274-4d33-988c-9e5a3895ccf8 + symbol: PI_XBTUSD + side: buy + orderType: lmt + limitPrice: 8500 + unfilledSize: 102 + receivedTime: '2019-09-03T12:52:17.945Z' + status: untouched + filledSize: 0 + reduceOnly: false + lastUpdateTime: '2019-09-03T12:52:17.945Z' + - order_id: fcbb1459-6ed2-4b3c-a58c-67c4df7412cf + symbol: PI_XBTUSD + side: buy + orderType: lmt + limitPrice: 7200 + unfilledSize: 1501 + receivedTime: '2019-09-02T12:54:34.347Z' + status: untouched + filledSize: 0 + reduceOnly: false + lastUpdateTime: '2019-09-02T12:54:34.347Z' + serverTime: '2019-09-05T17:08:18.138Z' + OpenPositionsFailureExample: + value: + result: error + serverTime: '2016-02-25T09:45:53.818Z' + error: apiLimitExceeded + OpenPositionsSuccessExample: + value: + result: success + openPositions: + - side: short + symbol: PI_XBTUSD + price: 9392.749993345933 + fillTime: '2020-07-22T14:39:12.376Z' + size: 10000 + unrealizedFunding: 1.045432180096817e-05 + - side: long + symbol: FI_XBTUSD_201225 + price: 9399.749966754434 + fillTime: '2020-07-22T14:39:12.376Z' + size: 20000 + - side: long + symbol: PF_DEFIUSD + price: 570.0 + fillTime: '2022-04-20T19:15:25.438Z' + size: 1 + unrealizedFunding: -0.0073428045972263895 + pnlCurrency: BTC + maxFixedLeverage: 5.0 + serverTime: '2020-07-22T14:39:12.376Z' + PlacedOrderExample: + value: + result: success + sendStatus: + order_id: 179f9af8-e45e-469d-b3e9-2fd4675cb7d0 + status: placed + receivedTime: '2019-09-05T16:33:50.734Z' + orderEvents: + - type: PLACE + order: + orderId: 179f9af8-e45e-469d-b3e9-2fd4675cb7d0 + type: lmt + symbol: PI_XBTUSD + side: buy + quantity: 10000 + filled: 0 + limitPrice: 9400 + reduceOnly: false + timestamp: '2019-09-05T16:33:50.734Z' + lastUpdateTimestamp: '2019-09-05T16:33:50.734Z' + serverTime: '2019-09-05T16:33:50.734Z' + RejectedOrderExample: + value: + result: success + sendStatus: + order_id: 614a5298-0071-450f-83c6-0617ce8c6bc4 + status: iocWouldNotExecute + receivedTime: '2019-09-05T16:32:54.076Z' + orderEvents: + - type: REJECT + uid: 614a5298-0071-450f-83c6-0617ce8c6bc4 + reason: IOC_WOULD_NOT_EXECUTE + order: + orderId: 614a5298-0071-450f-83c6-0617ce8c6bc4 + type: lmt + symbol: PI_XBTUSD + side: buy + quantity: 10000 + filled: 0 + limitPrice: 9400 + reduceOnly: true + timestamp: '2019-09-05T16:32:54.076Z' + lastUpdateTimestamp: '2019-09-05T16:32:54.076Z' + serverTime: '2019-09-05T16:32:54.077Z' + SubaccountsWithFlexExample: + value: + result: success + serverTime: '2022-03-31T20:38:53.677Z' + masterAccountUid: ba598ca1-65c1-4f48-927d-0e2b647d627a + subaccounts: + - holdingAccounts: + - currency: gbp + amount: 0 + - currency: bch + amount: 4.0e-05 + - currency: xrp + amount: 13662.85078 + - currency: usd + amount: 0 + - currency: eth + amount: 3.0000485057 + - currency: usdt + amount: 0 + - currency: ltc + amount: 2.0e-05 + - currency: usdc + amount: 0 + - currency: xbt + amount: 3.46e-09 + futuresAccounts: + - name: f-xrp:usd + availableMargin: 16187.33210488726 + - name: f-eth:usd + availableMargin: 67.59768318324302 + - name: f-xbt:usd + availableMargin: -0.0009056832839642471 + - name: f-ltc:usd + availableMargin: 67.51126059691163 + - name: f-xrp:xbt + availableMargin: 2.34e-09 + - name: f-bch:usd + availableMargin: 47.151615710695495 + flexAccount: + currencies: + - currency: eth + quantity: 0.5 + value: 1646.575 + collateral: 1543.91104875 + available: 0.49999966035931903 + - currency: usdt + quantity: 0 + value: 0 + collateral: 0 + available: 0 + - currency: gbp + quantity: 0 + value: 0 + collateral: 0 + available: 0 + - currency: xbt + quantity: 0 + value: 0 + collateral: 0 + available: 0 + - currency: usdc + quantity: 0 + value: 0 + collateral: 0 + available: 0 + - currency: usd + quantity: 0 + value: 0 + collateral: 0 + available: 0 + initialMargin: 0 + initialMarginWithOrders: 0 + maintenanceMargin: 0 + balanceValue: 1646.58 + portfolioValue: 1646.58 + collateralValue: 1543.91 + pnl: 0 + unrealizedFunding: 0 + totalUnrealized: 0 + totalUnrealizedAsMargin: 0 + availableMargin: 1543.91 + marginEquity: 1543.91 + fullName: fullname redacted + email: email redacted + accountUid: 7f5c528e-2285-45f0-95f5-83d53d4bfcd2 + SuccessExample: + value: + result: success + serverTime: '2022-06-28T14:48:58.711Z' + TickerExample: + value: + result: success + ticker: + tag: perpetual + pair: XBT:USD + symbol: pi_xbtusd + markPrice: 30209.9 + bid: 8634 + bidSize: 1000 + ask: 49289 + askSize: 139984 + vol24h: 15304 + volumeQuote: 40351.34 + change24h: 1.9974017538161748 + openInterest: 149655 + open24h: 49289 + indexPrice: 21087.8 + last: 49289 + lastTime: '2022-06-17T10:46:35.705Z' + lastSize: 100 + suspended: false + fundingRate: 1.18588737106e-07 + fundingRatePrediction: 1.1852486794e-07 + postOnly: false + serverTime: '2022-06-17T11:00:31.335Z' + TickersExample: + value: + result: success + tickers: + - tag: perpetual + pair: XBT:USD + symbol: PI_XBTUSD + markPrice: 30209.9 + bid: 8634 + bidSize: 1000 + ask: 49289 + askSize: 139984 + vol24h: 15304 + volumeQuote: 7305.2 + openInterest: 149655 + open24h: 49289 + indexPrice: 21087.8 + last: 49289 + lastTime: '2022-06-17T10:46:35.705Z' + lastSize: 100 + suspended: false + fundingRate: 1.18588737106e-07 + fundingRatePrediction: 1.1852486794e-07 + postOnly: false + change24h: 1.9974017538161748 + - tag: month + pair: XBT:USD + symbol: FI_XBTUSD_211231 + markPrice: 20478.5 + bid: 28002 + bidSize: 900 + vol24h: 100 + volumeQuote: 843.9 + openInterest: 10087 + open24h: 28002 + indexPrice: 21087.8 + last: 28002 + lastTime: '2022-06-17T10:45:57.177Z' + lastSize: 100 + suspended: false + postOnly: false + change24h: 1.9974017538161748 + - symbol: in_xbtusd + last: 21088 + lastTime: '2022-06-17T11:00:30.000Z' + - symbol: rr_xbtusd + last: 20938 + lastTime: '2022-06-16T15:00:00.000Z' + serverTime: '2022-06-17T11:00:31.335Z' + TransferSubaccountFailureExample: + value: + result: error + serverTime: '2016-02-25T09:45:53.818Z' + error: invalidUnit + UnwindQueueExample: + value: + result: success + serverTime: '2022-06-13T18:01:18.695Z' + queue: + - symbol: PF_GMTUSD + percentile: 100 + - symbol: FI_ETHUSD_220624 + percentile: 20 + - symbol: PF_UNIUSD + percentile: 80 + WithdrawalFailureExample: + value: + result: error + serverTime: '2019-05-15T09:24:16.968Z' + error: Unavailable diff --git a/oauth/openapi_v3.yaml b/oauth/openapi_v3.yaml new file mode 100644 index 0000000..50eb9d5 --- /dev/null +++ b/oauth/openapi_v3.yaml @@ -0,0 +1,562 @@ +--- +openapi: 3.0.4 + +info: + title: Kraken Connect + version: 1.0.0 + +servers: + - url: https://api.kraken.com/oauth + description: Production Server + - url: https://api.vip.uat.lobster.kraken.com/oauth + description: User Acceptance Testing Server + +paths: + /oauth/authorize: + get: + tags: + - OAuth + operationId: getOAuthCode + summary: Get Authorization Code + servers: + - url: https://id.kraken.com + security: [] + description: | + Redirect users to this URL in their browser to start the OAuth flow. + parameters: + - $ref: "#/components/parameters/ClientId" + - $ref: "#/components/parameters/RedirectUri" + - $ref: "#/components/parameters/ResponseType" + - $ref: "#/components/parameters/Scope" + - $ref: "#/components/parameters/State" + - $ref: "#/components/parameters/PreferTheme" + responses: + "302": + $ref: "#/components/responses/OAuthAuthorizeRedirect" + /{language}/oauth/authorize: + get: + tags: + - OAuth + operationId: getOAuthCodeWithLanguage + summary: Get Authorization Code (with language) + servers: + - url: https://id.kraken.com + security: [] + description: | + Redirect users to this URL in their browser to start the OAuth flow with a specific language preference. + parameters: + - in: path + name: language + required: true + schema: + type: string + enum: + - en-us + - es-es + - fil-ph + - fr + - de + - it-it + - nl + - pl + - pt-br + - ru-ru + - tr-tr + - uk-ua + - vi-vn + - zh-cn + description: Language code for the authorization page + - $ref: "#/components/parameters/ClientId" + - $ref: "#/components/parameters/RedirectUri" + - $ref: "#/components/parameters/ResponseType" + - $ref: "#/components/parameters/Scope" + - $ref: "#/components/parameters/State" + - $ref: "#/components/parameters/PreferTheme" + responses: + "302": + $ref: "#/components/responses/OAuthAuthorizeRedirect" + /token: + post: + tags: + - OAuth + operationId: getOAuthToken + summary: Get Access Token + description: | + Retrieve the access token. + security: + - BasicAuth: [] + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + required: + - grant_type + properties: + grant_type: + description: Type of grant + enum: + - authorization_code + - refresh_token + type: string + code: + description: The authorization code (If grant_type = `authorization_code`) + type: string + redirect_uri: + description: The redirect URI used to obtain the authorization code (If grant_type = `authorization_code`) + type: string + refresh_token: + description: The refresh token (If grant_type = `refresh_token`) + type: string + parameters: + - in: header + name: Authorization + description: | + Basic access authentication. + + **Format:** `Basic ` + + Where `` is the base64-encoding of `:`. + + For public clients, `` is empty. As such, credentials would be equivalent to `:`. + + For confidential clients, `` is the client secret that has been base64 decrypted by your RSA private key. + schema: + type: string + required: true + responses: + "200": + description: Success response + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + access_token: + description: Access token to call other endpoints. Valid within 24 hours for private clients or 4 hours for public clients. + type: string + example: 2YotnFZFEjr1zCsicMWpAA + token_type: + description: Type of token issued + enum: + - bearer + type: string + expires_in: + description: Lifetime in seconds of the access token. + type: number + example: 14400 + refresh_token: + description: Used to obtain new access tokens using the same authorization grant. Valid within 30 days. + type: string + example: tGzv3JOkF0XG5Qx2TlKWIA + /userinfo: + get: + tags: + - OAuth + operationId: getOAuthInfo + summary: Get User Info + description: | + Returns the email address and IIBAN of the user. + + **Scopes required:** `account.info:basic` + security: + - OAuth2: [account.info:basic] + responses: + "200": + description: Success response + content: + application/json: + schema: + type: object + properties: + result: + title: UserInfo + type: object + properties: + email: + description: The email address + type: string + minLength: 1 + maxLength: 128 + format: email + iban: + description: IBAN + type: string + /fast-api-key: + post: + tags: + - Fast API + operationId: createFastAPIKey + summary: Create Key + description: | + Creates a Fast API key. + + **Scopes required:** `account.fast-api-key:write` + security: + - OAuth2: [account.fast-api-key:write] + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/APIKeyParameters" + responses: + "200": + description: Success response + content: + application/json: + schema: + type: object + properties: + result: + allOf: + - type: object + properties: + secret: + description: This is only returned once when the API key is created + type: string + - $ref: "#/components/schemas/APIKeyInfo" + + delete: + tags: + - Fast API + operationId: removeFastApikey + summary: Delete Key + description: | + Deletes a Fast API key. + + **Scopes required:** `account.fast-api-key:write` + security: + - OAuth2: [account.fast-api-key:write] + requestBody: + content: + application/json: + schema: + type: object + properties: + api_key_name: + $ref: "#/components/schemas/ApiKeyName" + responses: + "200": + description: Success response + content: + application/json: + schema: + type: object + properties: + result: + type: boolean + default: true + put: + tags: + - Fast API + operationId: updateFastApiKey + summary: Update Key + description: | + Updates a Fast API key. + + **Scopes required:** `account.fast-api-key:write` + security: + - OAuth2: [account.fast-api-key:write] + requestBody: + content: + application/json: + schema: + allOf: + - type: object + properties: + new_api_key_name: + description: New API key description + type: string + minimum: 1 + maxLength: 32 + nullable: true + - $ref: "#/components/schemas/APIKeyParameters" + responses: + "200": + description: Success response + content: + application/json: + schema: + type: object + properties: + result: + type: boolean + default: true + get: + tags: + - Fast API + operationId: listFastApiKey + summary: List Keys + description: | + List all Fast API keys. + + **Scopes required:** `account.fast-api-key:read` + security: + - OAuth2: [account.fast-api-key:read] + responses: + "200": + description: Success response + content: + application/json: + schema: + type: object + properties: + result: + type: array + items: + $ref: "#/components/schemas/APIKeyInfo" + +components: + parameters: + ClientId: + in: query + name: client_id + schema: + type: string + description: Your client ID + required: true + RedirectUri: + in: query + name: redirect_uri + schema: + type: string + description: The redirect URI for returning the user after authorization + required: true + ResponseType: + in: query + name: response_type + schema: + type: string + enum: + - code + description: The OAuth response type. For authorization code flow, this must be `code`. + required: false + Scope: + in: query + name: scope + schema: + type: string + description: A space-separated list of scopes you want to authorize (optional). If empty, all scopes registered for your Client ID will be requested. + required: false + State: + in: query + name: state + schema: + type: string + description: An opaque value to maintain state (optional). If provided, this value will be set as a query argument on the Redirect URI when the user is redirected back to your service. + required: false + PreferTheme: + in: query + name: preferTheme + schema: + type: string + enum: + - dark + - light + description: Sets the theme color of the authorization page. + required: false + + responses: + OAuthAuthorizeRedirect: + description: | + If the user authorizes, the server redirects the user's browser to your provided **redirect_uri** with an authorization code using the `application/x-www-form-urlencoded` format. + + Example: + * Success: `https://example.com/callback?code=AUTHORIZATION_CODE&state=YOUR_STATE` + * Error: `https://example.com/callback?error=access_denied&state=YOUR_STATE` + content: + application/x-www-form-urlencoded: + schema: + oneOf: + - title: Success Response + type: object + properties: + code: + description: A one-time use authorization code + type: string + state: + description: If the state parameter was provided, the exact value will be returned. + type: string + - title: Error Response + type: object + properties: + error: + description: | + Error code + * `invalid_request` - The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed + * `unauthorized_client` - Client is not authorized to request an authorization code using this method. + * `access_denied` - Request was denied by Kraken's authorization server. + * `unsupported_response_type` - Unsupported request method + * `invalid_scope` - The requested scope is invalid, unknown, or malformed. + * `server_error` - Kraken encountered an unexpected condition that prevented it from fulfilling the request + * `temporarily_unavailable` - Kraken is unable to handle the request due to temporary overloading or maintenance. + enum: + - invalid_request + - unauthorized_client + - access_denied + - unsupported_response_type + - invalid_scope + - server_error + - temporarily_unavailable + type: string + state: + description: If the state parameter was provided, the exact value will be returned. + type: string + headers: + Location: + description: The URL to redirect the user's browser to + schema: + type: string + + securitySchemes: + BasicAuth: + type: http + scheme: basic + OAuth2: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://www.kraken.com/oauth/authorize + tokenUrl: https://api.kraken.com/oauth/token + scopes: + account.fast-api-key:funds-query: See your account balance + account.fast-api-key:funds-add: Deposit funds to your account + account.fast-api-key:funds-withdraw: Withdraw funds from your account + account.fast-api-key:funds-earn: Transfer funds to earn rewards + #account.fast-api-key:withdrawal-address-add: Add withdrawal address without email confirmation (sensitive w/ badge) + #account.fast-api-key:withdrawal-address-update: Update / remove withdrawal address without email confirmation (sensitive w/ badge) + account.fast-api-key:trades-query-open: View open orders & trades + account.fast-api-key:trades-query-closed: View closed orders & trades + account.fast-api-key:trades-modify: Create and modify orders + account.fast-api-key:trades-close: Cancel and modify orders + account.fast-api-key:ledger-query: View your ledger history + account.fast-api-key:export-data: Export your ledger history + account.fast-api-key:write: Authorize the 3rd party app to create or remove a fast API key + account.info:basic: See your account information + + schemas: + ApiKeyName: + type: string + description: API key description + minLength: 1 + maxLength: 32 + APIKeyParameters: + type: object + properties: + api_key_name: + $ref: "#/components/schemas/ApiKeyName" + ip_allowlist: + description: IP allowlist for the API key, supports CIDR notation for IPv4 and IPv6. + type: array + items: + type: string + nonce_window: + description: Nonce amount to accept from highest nonce + type: number + minimum: 0 + nullable: true + permissions: + description: What this API key can and can't do + type: object + properties: + export_data: + description: Export data + type: boolean + nullable: true + funds_add: + description: Add to funds + type: boolean + nullable: true + funds_earn: + description: Staking/unstaking + type: boolean + nullable: true + funds_query: + description: Query funds info + type: boolean + nullable: true + funds_withdraw: + description: Withdraw funds + type: boolean + nullable: true + ledger_query: + description: Query ledger + type: boolean + nullable: true + trades_close: + description: Cancel trades, close positions + type: boolean + nullable: true + trades_modify: + description: Add and cancel trades + type: boolean + nullable: true + trades_query_closed: + description: Query closed orders/positions info + type: boolean + nullable: true + trades_query_open: + description: Query open orders/positions info + type: boolean + nullable: true + # Uncomment these lines once the API endpoints are public. + #withdrawal_address_add: + # description: Withdraw-address addition + # type: boolean + # nullable: true + #withdrawal_address_update: + # description: Withdraw-address update + # type: boolean + # nullable: true + query_from: + description: Unix timestamp indicating allowable starting time for queries, or 0 if no restriction + type: number + nullable: true + query_to: + description: Unix timestamp indicating allowable ending time for queries, or 0 if no restriction + type: number + nullable: true + valid_until: + description: Unix timestamp indicating when key expires, or 0 if no expiration + type: number + nullable: true + APIKeyInfo: + type: object + properties: + api_key: + description: Only set once at the time of API key creation This is only returned once when the API key is created + type: string + api_key_name: + $ref: "#/components/schemas/ApiKeyName" + created_time: + type: string + id: + description: "API Key Description encoded using a modified base64 encoding: The 62nd and 63rd characters are '_' and ',' as opposed to '+' and '/'. Padding character is '-'." + type: string + ip_allowlist: + type: array + items: + type: string + last_used: + type: number + modified_time: + type: string + nonce: + type: number + minimum: 0 + nonce_window: + type: number + minimum: 0 + oauth_client: + type: string + permissions: + type: object + purpose: + type: string + default: "standard" + query_from: + type: number + query_to: + type: number + valid_until: + type: number diff --git a/otc/examples/responses/errors/internalError.yaml b/otc/examples/responses/errors/internalError.yaml new file mode 100644 index 0000000..1e896d9 --- /dev/null +++ b/otc/examples/responses/errors/internalError.yaml @@ -0,0 +1,7 @@ +errors: +- field: null + value: null + type: Internal Error + msg: Internal error + severity: E + errorClass: General \ No newline at end of file diff --git a/otc/examples/responses/errors/invalidApiKey.yaml b/otc/examples/responses/errors/invalidApiKey.yaml new file mode 100644 index 0000000..4c07ac5 --- /dev/null +++ b/otc/examples/responses/errors/invalidApiKey.yaml @@ -0,0 +1,7 @@ +value: + errors: + - field: Kraken-Api-Key + type: Invalid key + msg: Invalid API key + severity: E + errorClass: API \ No newline at end of file diff --git a/otc/examples/responses/errors/invalidApiNonce.yaml b/otc/examples/responses/errors/invalidApiNonce.yaml new file mode 100644 index 0000000..1635ef3 --- /dev/null +++ b/otc/examples/responses/errors/invalidApiNonce.yaml @@ -0,0 +1,7 @@ +value: + errors: + - field: Kraken-Nonce + type: Invalid nonce + msg: Invalid API nonce + severity: E + errorClass: API \ No newline at end of file diff --git a/otc/examples/responses/errors/invalidApiSignature.yaml b/otc/examples/responses/errors/invalidApiSignature.yaml new file mode 100644 index 0000000..e61ca01 --- /dev/null +++ b/otc/examples/responses/errors/invalidApiSignature.yaml @@ -0,0 +1,7 @@ +value: + errors: + - field: Kraken-Api-Sign + type: Invalid signature + msg: Invalid API signature + severity: E + errorClass: API diff --git a/otc/openapi_v3.yaml b/otc/openapi_v3.yaml new file mode 100644 index 0000000..9d7726e --- /dev/null +++ b/otc/openapi_v3.yaml @@ -0,0 +1,247 @@ +--- +openapi: 3.0.0 + +servers: + - url: https://api.kraken.com/0 + description: Production Server + +info: + title: REST API + version: 1.1.0 + description: "" + +paths: + /private/CreateOtcQuoteRequest: + post: + summary: Create OTC Quote + description: | + Creates a new OTC request for quote. + + **API Key Permissions Required:** `Orders and trades - Create & modify orders` + tags: + - Quotes + operationId: createOtcQuoteRequest + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/otc/create-otc-quote-request.yaml" + + responses: + "200": + description: Create OTC quote result. + content: + application/json: + schema: + $ref: "./schemas/responses/otc/create-otc-quote-request.yaml" + '500': + $ref: './partials/responses/500.yaml' + + /private/UpdateOtcQuote: + post: + summary: Update OTC Quote + description: | + Accepts or rejects an OTC quote. + + **API Key Permissions Required:** `Orders and trades - Create & modify orders` + tags: + - Quotes + operationId: updateOtcQuote + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/otc/update-otc-quote.yaml" + + responses: + "200": + description: Update OTC quote result. + content: + application/json: + schema: + $ref: "./schemas/responses/otc/update-otc-quote.yaml" + '500': + $ref: './partials/responses/500.yaml' + + /private/GetOtcPairs: + post: + summary: Get OTC Pairs + description: | + Retrieves the list of OTC trading pairs. + + **API Key Permissions Required:** `Funds permissions - Query` and `Funds permissions - Deposit` + tags: + - Quotes + operationId: getOtcPairs + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/otc/get-otc-pairs.yaml" + + responses: + "200": + description: Available OTC pairs. + content: + application/json: + schema: + $ref: "./schemas/responses/otc/get-otc-pairs.yaml" + '500': + $ref: './partials/responses/500.yaml' + + /private/GetOtcActiveQuotes: + post: + summary: Get OTC Active Quotes + description: | + Retrieves a list of active OTC quotes. + + **API Key Permissions Required:** `Orders and trades - Query open orders & trades` + tags: + - Quotes + operationId: getOtcActiveQuotes + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/otc/get-otc-active-quotes.yaml" + + responses: + "200": + description: Active quotes retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/otc/get-otc-active-quotes.yaml" + '500': + $ref: './partials/responses/500.yaml' + + /private/GetOtcHistoricalQuotes: + post: + summary: Get OTC Historical Quotes + description: | + Retrieves OTC quotes history. + + **API Key Permissions Required:** `Orders and trades - Query open orders & trades` + tags: + - Quotes + operationId: getOtcHistoricalQuotes + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/otc/get-otc-historical-quotes.yaml" + + responses: + "200": + description: Historical quotes retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/otc/get-otc-historical-quotes.yaml" + '500': + $ref: './partials/responses/500.yaml' + + /private/GetOtcExposures: + post: + summary: Get OTC Exposures + description: | + Retrieves the max and used OTC exposures. + + **API Key Permissions Required:** `Orders and trades - Query open orders & trades` + tags: + - Quotes + operationId: getOtcExposures + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/otc/get-otc-exposures.yaml" + + responses: + "200": + description: OTC Exposures retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/otc/get-otc-exposures.yaml" + '500': + $ref: './partials/responses/500.yaml' + + /private/CheckOtcClient: + post: + summary: Check OTC Eligibility + description: | + Retrieves the client permissions for the OTC Portal. + + **API Key Permissions Required:** `Funds permissions - Query` and `Funds permissions - Deposit` + tags: + - Quotes + operationId: checkOtcClient + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/otc/check-otc-client.yaml" + + responses: + "200": + description: OTC client check result. + content: + application/json: + schema: + $ref: "./schemas/responses/otc/check-otc-client.yaml" + '500': + $ref: './partials/responses/500.yaml' + + +components: + securitySchemes: + API-Key: + type: apiKey + description: The "API-Key" header should contain your API key. + name: API-Key + in: header + + API-Sign: + type: apiKey + description: Authenticated requests should be signed with the "API-Sign" header, using a signature generated with your private key, nonce, encoded payload, and URI path. + name: API-Sign + in: header + schemas: + KWebErrors: + type: array + items: + description: General API error. + type: object + properties: + severity: + description: API error severity. + type: string + enum: + - E + - W + errorClass: + type: string + type: + type: string + errorMessage: + nullable: true + type: string + required: + - errorClass + - severity + - type + +tags: + - name: Quotes + +security: + - API-Key: [] + API-Sign: [] diff --git a/otc/partials/properties/nonce.yaml b/otc/partials/properties/nonce.yaml new file mode 100644 index 0000000..0739ba5 --- /dev/null +++ b/otc/partials/properties/nonce.yaml @@ -0,0 +1,3 @@ +description: "Nonce used in construction of `API-Sign` header" +type: integer +format: int64 \ No newline at end of file diff --git a/otc/partials/responses/200.yaml b/otc/partials/responses/200.yaml new file mode 100644 index 0000000..35c58c7 --- /dev/null +++ b/otc/partials/responses/200.yaml @@ -0,0 +1,8 @@ +description: Success response +content: + application/json: + schema: + $ref: '../../schemas/responses/200.yaml' + example: + result: true + errors: [] diff --git a/otc/partials/responses/401.yaml b/otc/partials/responses/401.yaml new file mode 100644 index 0000000..95ce091 --- /dev/null +++ b/otc/partials/responses/401.yaml @@ -0,0 +1,12 @@ +description: Authorization information is missing or invalid +content: + application/json: + schema: + $ref: '../../schemas/responses/401.yaml' + examples: + Invalid API Key: + $ref: '../../examples/responses/errors/invalidApiKey.yaml' + Invalid API Signature: + $ref: '../../examples/responses/errors/invalidApiSignature.yaml' + Invalid API Nonce: + $ref: '../../examples/responses/errors/invalidApiNonce.yaml' diff --git a/otc/partials/responses/500.yaml b/otc/partials/responses/500.yaml new file mode 100644 index 0000000..628bdc1 --- /dev/null +++ b/otc/partials/responses/500.yaml @@ -0,0 +1,7 @@ +description: Internal Error +content: + application/json: + schema: + $ref: '../../schemas/responses/500.yaml' + example: + $ref: '../../examples/responses/errors/internalError.yaml' \ No newline at end of file diff --git a/otc/schemas/objects/errors/error.yaml b/otc/schemas/objects/errors/error.yaml new file mode 100644 index 0000000..57992cc --- /dev/null +++ b/otc/schemas/objects/errors/error.yaml @@ -0,0 +1,19 @@ +type: array +items: + # title: Error + description: Kraken API error + type: string + example: "EGeneral:Invalid arguments" + # properties: + # value: + # type: object + # field: + # type: string + # type: + # type: string + # msg: + # type: string + # severity: + # type: string + # errorClass: + # type: string \ No newline at end of file diff --git a/otc/schemas/objects/errors/validation.yaml b/otc/schemas/objects/errors/validation.yaml new file mode 100644 index 0000000..e53a2a3 --- /dev/null +++ b/otc/schemas/objects/errors/validation.yaml @@ -0,0 +1,10 @@ +title: Field Validation Error +description: Field validation error +type: object +properties: + field: + description: The field name + type: string + error: + description: Error message + type: string \ No newline at end of file diff --git a/otc/schemas/objects/otc/active-quote.yaml b/otc/schemas/objects/otc/active-quote.yaml new file mode 100644 index 0000000..79fbecb --- /dev/null +++ b/otc/schemas/objects/otc/active-quote.yaml @@ -0,0 +1,25 @@ +type: object +description: An active OTC quote. + +properties: + $ref: '../../objects/otc/quote-props.yaml' + expires: + description: Expiration time of the quote. + type: object + properties: + time: + description: Unix timestamp in milliseconds. + type: integer + format: int64 + example: 1715155200000 + required: + - time +required: + - quote_id + - base + - quote + - type + - amount + - settlement + - expires +additionalProperties: false diff --git a/otc/schemas/objects/otc/decimals.yaml b/otc/schemas/objects/otc/decimals.yaml new file mode 100644 index 0000000..dffef9f --- /dev/null +++ b/otc/schemas/objects/otc/decimals.yaml @@ -0,0 +1,4 @@ +type: number +description: Unsigned byte (u8) +minimum: 0 +maximum: 255 diff --git a/otc/schemas/objects/otc/historical-quote.yaml b/otc/schemas/objects/otc/historical-quote.yaml new file mode 100644 index 0000000..be12ff7 --- /dev/null +++ b/otc/schemas/objects/otc/historical-quote.yaml @@ -0,0 +1,59 @@ +type: object +description: A historical OTC quote. + +properties: + $ref: '../../objects/otc/quote-props.yaml' + trade_id: + type: + - string + - null + description: The Trade ID of the quote. Only present once the associated trade has been booked for an accepted quote + example: "TR123ABS" + status: + type: + - string + - null + description: The status of the quote + enum: + - Modified + - Deleted + example: null + acceptance: + description: Acceptance + type: object + properties: + status: + type: string + description: The acceptance status of the quote. + enum: + - accepted + - rejected + - expired + example: accepted + time: + description: Unix timestamp in milliseconds. + type: integer + format: int64 + example: 1736257135382 + required: + - status + - time + settlement_status: + type: string + description: The settlement status of the quote. + enum: + - settled + - unsettled + example: settled +required: + - quote_id + - base + - quote + - type + - amount + - price + - total + - acceptance + - settlement + - settlement_status +additionalProperties: false diff --git a/otc/schemas/objects/otc/quote-props.yaml b/otc/schemas/objects/otc/quote-props.yaml new file mode 100644 index 0000000..93a20a1 --- /dev/null +++ b/otc/schemas/objects/otc/quote-props.yaml @@ -0,0 +1,42 @@ +quote_id: + description: The id of the quote. + type: string + example: "00001c47-8f59-4099-b6f8-b637437ef1ab" +client_order_id: + description: The client order ID when quote was requested by an external partner client. + type: + - string + - null + example: "7264675290025181184" +base: + description: Base (amount) asset of the pair. + type: string + example: "BTC" +quote: + description: Quote asset of the pair. + type: string + example: "USD" +type: + description: Buy or sell. + type: string + enum: + - buy + - sell +price: + description: The unit price. + type: string + example: "100000.25" +amount: + description: Quantity of the base asset. + type: string + example: "2.5" +total: + description: Quantity of the quote asset. + type: string + example: "250000.625" +settlement: + description: If the settlement is automated or flexible. Only automated is currently supported through the API. + type: string + enum: + - automated + - flexible \ No newline at end of file diff --git a/otc/schemas/requests/otc/check-otc-client.yaml b/otc/schemas/requests/otc/check-otc-client.yaml new file mode 100644 index 0000000..e3421bd --- /dev/null +++ b/otc/schemas/requests/otc/check-otc-client.yaml @@ -0,0 +1,14 @@ +# Schema for checking OTC client status +# This endpoint is used to verify the status and eligibility of an OTC client +title: Check OTC Client Request Body +description: | + This schema represents the request body for checking an OTC client's status. + No request body is required as the client information is typically passed through + authentication headers. +type: object +properties: + nonce: + $ref: "../../../partials/properties/nonce.yaml" +additionalProperties: false +required: + - nonce \ No newline at end of file diff --git a/otc/schemas/requests/otc/create-otc-quote-request.yaml b/otc/schemas/requests/otc/create-otc-quote-request.yaml new file mode 100644 index 0000000..d1cdb01 --- /dev/null +++ b/otc/schemas/requests/otc/create-otc-quote-request.yaml @@ -0,0 +1,38 @@ +title: Create OTC Quote Request Body +description: "Request to create a new OTC quote. You must specify either the amount of base asset you want to trade or the total amount of quote asset you want to spend/receive, but not both." +type: object +properties: + nonce: + $ref: "../../../partials/properties/nonce.yaml" + base: + type: string + description: The asset you want to buy or sell (e.g., BTC, ETH). + example: "BTC" + quote: + type: string + description: The asset used to price the base asset (e.g., USD, USDT). + example: "USD" + amount: + type: string + description: The quantity of base asset you want to trade. Cannot be used together with the total field. + example: "2.5" + total: + type: string + description: The total amount of quote asset you want to spend (for buy orders) or receive (for sell orders). Cannot be used together with the amount field. + example: "200000.5" + type: + type: string + description: The direction of the trade. Use 'buy' to purchase the base asset with the quote asset, or 'sell' to sell the base asset for the quote asset. + enum: + - buy + - sell + # #note Only auto settlements is currently supported in the EAPI. + # flexible_settlement: + # type: bool + # description: Specifies if this quote will use flexible or automated settlement. +additionalProperties: false +required: + - nonce + - base + - quote + - type diff --git a/otc/schemas/requests/otc/get-otc-active-quotes.yaml b/otc/schemas/requests/otc/get-otc-active-quotes.yaml new file mode 100644 index 0000000..63d5342 --- /dev/null +++ b/otc/schemas/requests/otc/get-otc-active-quotes.yaml @@ -0,0 +1,18 @@ +# Not used, we don't expose the vault id. +title: Get OTC Active Quotes Request Body +description: | + Request body for retrieving active OTC quotes. This endpoint allows filtering of active quotes + based on specific criteria. All parameters are optional and can be used to refine the search results. +type: object +properties: + nonce: + $ref: "../../../partials/properties/nonce.yaml" + vault_id: + type: string + description: | + The unique identifier of the vault associated with the OTC trade. This parameter is specifically used + for custody OTC trades to filter quotes related to a particular vault. + example: "456TR123" +additionalProperties: false +required: + - nonce \ No newline at end of file diff --git a/otc/schemas/requests/otc/get-otc-exposures.yaml b/otc/schemas/requests/otc/get-otc-exposures.yaml new file mode 100644 index 0000000..1f90522 --- /dev/null +++ b/otc/schemas/requests/otc/get-otc-exposures.yaml @@ -0,0 +1,10 @@ +# No request body required for getOtcExposures. +title: Get OTC Exposures Request Body +description: Request schema for retrieving OTC exposures data. This endpoint does not require any request body parameters. +type: object +properties: + nonce: + $ref: "../../../partials/properties/nonce.yaml" +additionalProperties: false +required: + - nonce \ No newline at end of file diff --git a/otc/schemas/requests/otc/get-otc-historical-quotes.yaml b/otc/schemas/requests/otc/get-otc-historical-quotes.yaml new file mode 100644 index 0000000..0c58d96 --- /dev/null +++ b/otc/schemas/requests/otc/get-otc-historical-quotes.yaml @@ -0,0 +1,11 @@ +# Schema for Get OTC Historical Quotes request +# This endpoint does not require any request body parameters +title: Get OTC Historical Quotes Request Body +description: Request body schema for retrieving historical quotes for OTC instruments. This endpoint does not require any request body parameters. +type: object +properties: + nonce: + $ref: "../../../partials/properties/nonce.yaml" +additionalProperties: false +required: + - nonce \ No newline at end of file diff --git a/otc/schemas/requests/otc/get-otc-pairs.yaml b/otc/schemas/requests/otc/get-otc-pairs.yaml new file mode 100644 index 0000000..bdb57bc --- /dev/null +++ b/otc/schemas/requests/otc/get-otc-pairs.yaml @@ -0,0 +1,9 @@ +# No request body required for getOtcPairs. +title: Get OTC Pairs Request Body +type: object +properties: + nonce: + $ref: "../../../partials/properties/nonce.yaml" +additionalProperties: false +required: + - nonce diff --git a/otc/schemas/requests/otc/update-otc-quote.yaml b/otc/schemas/requests/otc/update-otc-quote.yaml new file mode 100644 index 0000000..e8eac94 --- /dev/null +++ b/otc/schemas/requests/otc/update-otc-quote.yaml @@ -0,0 +1,23 @@ +title: Update OTC Quote Request Body +description: Request body for updating the status of an existing OTC quote. +type: object +properties: + nonce: + $ref: "../../../partials/properties/nonce.yaml" + quote_id: + type: string + description: The unique identifier of the quote to update. + example: "00001c47-8f59-4099-b6f8-b637437ef1ab" + format: uuid + status: + type: string + description: The status of the quote, accepted or rejected. + enum: + - accepted + - rejected + example: "accepted" +additionalProperties: false +required: + - nonce + - quote_id + - status diff --git a/otc/schemas/responses/200.yaml b/otc/schemas/responses/200.yaml new file mode 100644 index 0000000..cee1cc4 --- /dev/null +++ b/otc/schemas/responses/200.yaml @@ -0,0 +1,9 @@ +description: Success response +type: object +properties: + result: + type: boolean + example: true + error: + $ref: '../objects/errors/error.yaml' + \ No newline at end of file diff --git a/otc/schemas/responses/400.yaml b/otc/schemas/responses/400.yaml new file mode 100644 index 0000000..e660c6b --- /dev/null +++ b/otc/schemas/responses/400.yaml @@ -0,0 +1,10 @@ +title: 400 Bad Request +description: Validation Failed response +type: object +properties: + results: + type: object + errors: + type: array + items: + $ref: '../objects/errors/validation.yaml' \ No newline at end of file diff --git a/otc/schemas/responses/401.yaml b/otc/schemas/responses/401.yaml new file mode 100644 index 0000000..e08cd17 --- /dev/null +++ b/otc/schemas/responses/401.yaml @@ -0,0 +1,8 @@ +title: 401 Unauthorized +description: Unauthorized response +type: object +properties: + errors: + type: array + items: + $ref: '../objects/errors/error.yaml' \ No newline at end of file diff --git a/otc/schemas/responses/404.yaml b/otc/schemas/responses/404.yaml new file mode 100644 index 0000000..2966b6e --- /dev/null +++ b/otc/schemas/responses/404.yaml @@ -0,0 +1,8 @@ +title: 404 Not Found +description: Not found +type: object +properties: + errors: + type: array + items: + $ref: '../objects/errors/error.yaml' \ No newline at end of file diff --git a/otc/schemas/responses/500.yaml b/otc/schemas/responses/500.yaml new file mode 100644 index 0000000..499ef3b --- /dev/null +++ b/otc/schemas/responses/500.yaml @@ -0,0 +1,6 @@ +title: 500 Internal Server Error +description: Internal error response +type: object +properties: + error: + $ref: '../objects/errors/error.yaml' \ No newline at end of file diff --git a/otc/schemas/responses/otc/check-otc-client.yaml b/otc/schemas/responses/otc/check-otc-client.yaml new file mode 100644 index 0000000..5d11ef1 --- /dev/null +++ b/otc/schemas/responses/otc/check-otc-client.yaml @@ -0,0 +1,21 @@ +# $schema: "http://json-schema.org/draft-07/schema#" +type: object +description: Response schema for checking OTC client permissions +properties: + result: + type: object + description: Contains the successful response data + properties: + permissions: + type: array + items: + type: string + description: OTC permissions assigned to the client. + required: + - permissions + additionalProperties: false + error: + $ref: '../../../schemas/objects/errors/error.yaml' +required: + - error +additionalProperties: false diff --git a/otc/schemas/responses/otc/create-otc-quote-request.yaml b/otc/schemas/responses/otc/create-otc-quote-request.yaml new file mode 100644 index 0000000..cc59c2d --- /dev/null +++ b/otc/schemas/responses/otc/create-otc-quote-request.yaml @@ -0,0 +1,27 @@ +title: createOtcQuoteRequest +description: Response schema for creating an OTC quote request. +type: object +properties: + result: + type: object + title: OTC Request for Quote + properties: + quote: + type: object + description: Quote created + $ref: '../../objects/otc/quote-props.yaml' + required: + - base + - quote + - type + - amount + - settlement + additionalProperties: false + required: + - quote + additionalProperties: false + error: + $ref: '../../../schemas/objects/errors/error.yaml' +required: + - error +additionalProperties: false diff --git a/otc/schemas/responses/otc/get-otc-active-quotes.yaml b/otc/schemas/responses/otc/get-otc-active-quotes.yaml new file mode 100644 index 0000000..65193b3 --- /dev/null +++ b/otc/schemas/responses/otc/get-otc-active-quotes.yaml @@ -0,0 +1,13 @@ +description: "Response schema for retrieving active OTC quotes." +type: "object" +properties: + result: + title: "Active quotes" + type: "array" + items: + $ref: '../../../schemas/objects/otc/active-quote.yaml' + error: + $ref: '../../../schemas/objects/errors/error.yaml' +required: + - error +additionalProperties: false diff --git a/otc/schemas/responses/otc/get-otc-exposures.yaml b/otc/schemas/responses/otc/get-otc-exposures.yaml new file mode 100644 index 0000000..bd463da --- /dev/null +++ b/otc/schemas/responses/otc/get-otc-exposures.yaml @@ -0,0 +1,34 @@ +title: getOtcExposures +description: Response schema for retrieving OTC exposure limits and usage information for a client. +type: object +properties: + result: + type: object + properties: + max_otc: + type: string + description: Max OTC exposure assigned to the client. + example: "1500000" + max_rfq: + type: string + description: Max RFQ exposure assigned to the client. + example: "1500000" + used_otc: + type: string + description: Used OTC Exposure (chat + RFQ). + example: "100000" + used_rfq: + type: string + description: Used RFQ exposure (RFQ only). + example: "50000" + required: + - max_otc + - max_rfq + - used_otc + - used_rfq + additionalProperties: false + error: + $ref: '../../../schemas/objects/errors/error.yaml' +required: + - error +additionalProperties: false diff --git a/otc/schemas/responses/otc/get-otc-historical-quotes.yaml b/otc/schemas/responses/otc/get-otc-historical-quotes.yaml new file mode 100644 index 0000000..9004c5b --- /dev/null +++ b/otc/schemas/responses/otc/get-otc-historical-quotes.yaml @@ -0,0 +1,13 @@ +description: Response schema for retrieving historical OTC quotes. +type: object +properties: + result: + title: "Historical quotes" + type: array + items: + $ref: '../../../schemas/objects/otc/historical-quote.yaml' + error: + $ref: '../../../schemas/objects/errors/error.yaml' +required: + - error +additionalProperties: false \ No newline at end of file diff --git a/otc/schemas/responses/otc/get-otc-pairs.yaml b/otc/schemas/responses/otc/get-otc-pairs.yaml new file mode 100644 index 0000000..503df43 --- /dev/null +++ b/otc/schemas/responses/otc/get-otc-pairs.yaml @@ -0,0 +1,69 @@ +description: Response containing available OTC spot trading pairs and their specifications including decimal precision, size limits, and notional value constraints. +type: object +properties: + result: + type: object + properties: + spot_pairs: + type: array + title: OTC Spot pairs + items: + type: object + properties: + base: + type: string + description: Base asset for the pair. + example: "BTC" + quote: + type: string + description: Quote asset for the pair. + example: "USD" + pair_name: + type: string + description: Pair name. + example: "BTCUSD" + pair_decimals: + $ref: '../../objects/otc/decimals.yaml' + description: Decimal precision for this pair. + example: "8" + lot_decimals: + $ref: '../../objects/otc/decimals.yaml' + description: Decimal precision for the quantity that can be requested for this pair. + example: "8" + cost_decimals: + $ref: '../../objects/otc/decimals.yaml' + description: Decimal precision for costs related to this pair. + example: "8" + max_base_amount: + type: string + description: Max size in base asset that a quote can be requested for this pair. + example: "100000" + max_notional: + type: string + description: Max notional amount that a quote can be requested for this pair. + example: "1000000" + min_base_amount: + type: string + description: Min size in base asset that a quote can be requested for this pair. + example: "0.1" + min_notional: + type: string + description: Min notional amount that a quote can be requested for this pair. + example: "100" + required: + - base + - quote + - pair_name + - pair_decimals + - lot_decimals + - cost_decimals + - max_base_amount + required: + - spot_pairs + additionalProperties: false + error: + $ref: '../../../schemas/objects/errors/error.yaml' +required: + - result + - error +additionalProperties: false diff --git a/otc/schemas/responses/otc/update-otc-quote.yaml b/otc/schemas/responses/otc/update-otc-quote.yaml new file mode 100644 index 0000000..c445a15 --- /dev/null +++ b/otc/schemas/responses/otc/update-otc-quote.yaml @@ -0,0 +1,16 @@ +title: Update OTC Quote Request Body +description: Response schema for updating an OTC quote. Contains either a successful result with the quote ID or an error object. +type: object +properties: + result: + type: object + properties: + quote_id: + type: string + description: The id of the updated quote. + example: "00001c47-8f59-4099-b6f8-b637437ef1ab" + error: + $ref: '../../../schemas/objects/errors/error.yaml' +required: + - error +additionalProperties: false diff --git a/pay/openapi_v3.yaml b/pay/openapi_v3.yaml new file mode 100644 index 0000000..0b23ce9 --- /dev/null +++ b/pay/openapi_v3.yaml @@ -0,0 +1,224 @@ +--- +openapi: 3.0.0 + +servers: + - url: https://api.kraken.com/0 + description: Production Server + +info: + title: REST API + version: 1.1.0 + description: "" + +paths: + # Request + /private/Pay/request/create: + post: + tags: + - Request + summary: Create a payment request + description: | + Create a payment request + + **API Key Permissions Required:** `Funds permissions - Deposit` + operationId: createPayRequest + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/request/createPayRequest.yaml" + responses: + "200": + content: + application/json: + schema: + $ref: "./schemas/responses/request/createPayRequest.yaml" + + /private/Pay/request/cancel: + post: + tags: + - Request + summary: Cancel a payment request + description: | + Cancel a payment request + + **API Key Permissions Required:** `Funds permissions - Query` + operationId: cancelPayRequest + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/request/cancelPayRequest.yaml" + responses: + "200": + content: + application/json: + schema: + $ref: "./schemas/responses/request/cancelPayRequest.yaml" + + # Transfer + /private/Pay/transfer/create: + post: + tags: + - Transfer + summary: Create a pay transfer + description: | + This method is asynchronous, your callback will be sent the `external_id` and the `status` when it reaches a final state. + + **API Key Permissions Required:** `Funds permissions - Query` and `Funds permissions - Withdraw` + operationId: createPayTransfer + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/transfer/createPayTransfer.yaml" + responses: + "200": + content: + application/json: + schema: + $ref: "./schemas/responses/transfer/createPayTransfer.yaml" + + /private/Pay/transfer/cancel: + post: + tags: + - Transfer + - Paylink + summary: Cancel a pay transfer or an unclaimed paylink + description: | + Cancel a pay transfer or an **unclaimed** paylink + + **API Key Permissions Required:** `Funds permissions - Query` + operationId: cancelPayTransfer + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/transfer/cancelPayTransfer.yaml" + responses: + "200": + content: + application/json: + schema: + $ref: "./schemas/responses/transfer/cancelPayTransfer.yaml" + + # Paylink + /private/Pay/paylink/create: + post: + tags: + - Paylink + summary: Create a paylink code + description: | + This method is asynchronous, it will not return the generated code. After calling, the `external_id` must then be used to query the code using `getPaylinkCode`. + + **API Key Permissions Required:** `Funds permissions - Query` and `Funds permissions - Withdraw` + operationId: createPaylinkCode + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/paylink/createPaylinkCode.yaml" + responses: + "200": + content: + application/json: + schema: + $ref: "./schemas/responses/paylink/createPaylinkCode.yaml" + + /private/Pay/paylink/get: + post: + tags: + - Paylink + summary: Get the generated paylink code + description: | + If the code has not been generated yet, this method will return an error indicating this. + + **API Key Permissions Required:** `Funds permissions - Query` + operationId: getPaylinkCode + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/paylink/getPaylinkCode.yaml" + responses: + "200": + content: + application/json: + schema: + $ref: "./schemas/responses/paylink/getPaylinkCode.yaml" + + /private/Pay/paylink/config: + post: + tags: + - Paylink + summary: Get paylink configuration + description: | + Get paylink configuration + + **API Key Permissions Required:** `Funds permissions - Query` + operationId: getPaylinkConfig + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/paylink/getPaylinkConfig.yaml" + responses: + "200": + content: + application/json: + schema: + $ref: "./schemas/responses/paylink/getPaylinkConfig.yaml" + +components: + securitySchemes: + API-Key: + type: apiKey + description: The "API-Key" header should contain your API key. + name: API-Key + in: header + + API-Sign: + type: apiKey + description: Authenticated requests should be signed with the "API-Sign" header, using a signature generated with your private key, nonce, encoded payload, and URI path. + name: API-Sign + in: header + schemas: + KWebErrors: + type: array + items: + description: General API error. + type: object + properties: + severity: + description: API error severity. + type: string + enum: + - E + - W + errorClass: + type: string + type: + type: string + errorMessage: + nullable: true + type: string + required: + - errorClass + - severity + - type + +tags: + - name: Request + - name: Transfer + - name: Paylink + +security: + - API-Key: [] + API-Sign: [] diff --git a/pay/partials/properties/external_id.yaml b/pay/partials/properties/external_id.yaml new file mode 100644 index 0000000..1acde0b --- /dev/null +++ b/pay/partials/properties/external_id.yaml @@ -0,0 +1,3 @@ +external_id: + description: "Your (the API user's) unique id to globally identify transfers and requests.\n\nWe will accept anything from 1-16 bytes, the format is base64 without padding ( )\n\nThis is the id you will use to identify all transfers and requests in the API and also in the callback we send you.\n\nYou MUST make sure this is commited in your database before calling our API, that way if you don't get a response, you can make the same call again and we'll fail with an error saying your id is already used. (this is the only way to prevent double requests or sends)\n\nWe *highly* recommend you generate and send a UUID here, but if instead you have a database auto-increment id that is 64 bits, just send that, perhaps pre-pended by an application id or something. The format is completely up to you but keep in mind it must be forever unique across all your transfers and requests." + type: string diff --git a/pay/schemas/requests/paylink/createPaylinkCode.yaml b/pay/schemas/requests/paylink/createPaylinkCode.yaml new file mode 100644 index 0000000..804f276 --- /dev/null +++ b/pay/schemas/requests/paylink/createPaylinkCode.yaml @@ -0,0 +1,25 @@ +required: + - nonce + - amount + - asset + - external_id +type: object +properties: + nonce: + description: "Nonce used in construction of `API-Sign` header" + type: string + amount: + description: "The amount to be transferred, denominated in `asset`." + oneOf: + - type: string + - type: integer + - type: number + asset: + description: "The name of the asset to be transferred. It is assumed that this is always a \"currency\" asset." + type: string + # external_id + $ref: "../../../partials/properties/external_id.yaml" + note: + description: An optional note which will be viewable by both the sender and recipient. + nullable: true + type: string diff --git a/pay/schemas/requests/paylink/getPaylinkCode.yaml b/pay/schemas/requests/paylink/getPaylinkCode.yaml new file mode 100644 index 0000000..b081b7e --- /dev/null +++ b/pay/schemas/requests/paylink/getPaylinkCode.yaml @@ -0,0 +1,10 @@ +type: object +required: + - nonce + - external_id +properties: + nonce: + description: "Nonce used in construction of `API-Sign` header" + type: string + # external_id + $ref: "../../../partials/properties/external_id.yaml" diff --git a/pay/schemas/requests/paylink/getPaylinkConfig.yaml b/pay/schemas/requests/paylink/getPaylinkConfig.yaml new file mode 100644 index 0000000..e1cb532 --- /dev/null +++ b/pay/schemas/requests/paylink/getPaylinkConfig.yaml @@ -0,0 +1,7 @@ +type: object +required: + - nonce +properties: + nonce: + description: "Nonce used in construction of `API-Sign` header" + type: string diff --git a/pay/schemas/requests/request/cancelPayRequest.yaml b/pay/schemas/requests/request/cancelPayRequest.yaml new file mode 100644 index 0000000..b081b7e --- /dev/null +++ b/pay/schemas/requests/request/cancelPayRequest.yaml @@ -0,0 +1,10 @@ +type: object +required: + - nonce + - external_id +properties: + nonce: + description: "Nonce used in construction of `API-Sign` header" + type: string + # external_id + $ref: "../../../partials/properties/external_id.yaml" diff --git a/pay/schemas/requests/request/createPayRequest.yaml b/pay/schemas/requests/request/createPayRequest.yaml new file mode 100644 index 0000000..074985f --- /dev/null +++ b/pay/schemas/requests/request/createPayRequest.yaml @@ -0,0 +1,35 @@ +type: object +required: + - nonce + - amount + - asset + - external_id +properties: + nonce: + description: "Nonce used in construction of `API-Sign` header" + type: string + amount: + description: "The amount to be transferred, denominated in `asset`." + oneOf: + - type: string + - type: integer + - type: number + asset: + description: "The name of the asset to be transferred. It is assumed that this is always a \"currency\" asset." + type: string + expire_after_seconds: + description: "Optionally expire the request after this many seconds, if not supplied the default is 90 days" + format: uint32 + minimum: 0 + nullable: true + type: integer + # external_id + $ref: "../../../partials/properties/external_id.yaml" + from: + description: The kraktag to request the transfer from. If not supplied the response will contain a link to the pay request. + nullable: true + type: string + note: + description: An optional note which will be viewable by both the sender and recipient. + nullable: true + type: string diff --git a/pay/schemas/requests/transfer/cancelPayTransfer.yaml b/pay/schemas/requests/transfer/cancelPayTransfer.yaml new file mode 100644 index 0000000..57d3bd4 --- /dev/null +++ b/pay/schemas/requests/transfer/cancelPayTransfer.yaml @@ -0,0 +1,10 @@ +type: object +required: + - nonce + - external_id +properties: + nonce: + description: "Nonce used in construction of `API-Sign` header" + type: string + # external_id: + $ref: "../../../partials/properties/external_id.yaml" diff --git a/pay/schemas/requests/transfer/createPayTransfer.yaml b/pay/schemas/requests/transfer/createPayTransfer.yaml new file mode 100644 index 0000000..bef5c0d --- /dev/null +++ b/pay/schemas/requests/transfer/createPayTransfer.yaml @@ -0,0 +1,29 @@ +type: object +required: + - nonce + - amount + - asset + - external_id + - to +properties: + nonce: + description: "Nonce used in construction of `API-Sign` header" + type: string + amount: + description: "The amount to be transferred, denominated in `asset`." + oneOf: + - type: string + - type: integer + - type: number + asset: + description: "The name of the asset to be transferred. It is assumed that this is always a \"currency\" asset." + type: string + # external_id: + $ref: "../../../partials/properties/external_id.yaml" + note: + description: An optional note which will be viewable by both the sender and recipient. + nullable: true + type: string + to: + description: The kraktag to send the transfer to + type: string diff --git a/pay/schemas/responses/paylink/createPaylinkCode.yaml b/pay/schemas/responses/paylink/createPaylinkCode.yaml new file mode 100644 index 0000000..1b27210 --- /dev/null +++ b/pay/schemas/responses/paylink/createPaylinkCode.yaml @@ -0,0 +1,30 @@ +type: object +required: + - error +properties: + error: + items: + description: General API error. + properties: + errorClass: + type: string + errorMessage: + nullable: true + type: string + severity: + description: API error severity. + enum: + - E + - W + type: string + type: + type: string + required: + - errorClass + - severity + - type + type: object + type: array + result: + nullable: true + type: object diff --git a/pay/schemas/responses/paylink/getPaylinkCode.yaml b/pay/schemas/responses/paylink/getPaylinkCode.yaml new file mode 100644 index 0000000..94a0156 --- /dev/null +++ b/pay/schemas/responses/paylink/getPaylinkCode.yaml @@ -0,0 +1,37 @@ +type: object +required: + - error +properties: + error: + items: + description: General API error. + properties: + errorClass: + type: string + errorMessage: + nullable: true + type: string + severity: + description: API error severity. + enum: + - E + - W + type: string + type: + type: string + required: + - errorClass + - severity + - type + type: object + type: array + result: + description: Contains the information about the pending payment that can be shown to the sender. + nullable: true + properties: + claim_link: + description: "The claim link, used to verify and claim the transfer." + type: string + required: + - claim_link + type: object diff --git a/pay/schemas/responses/paylink/getPaylinkConfig.yaml b/pay/schemas/responses/paylink/getPaylinkConfig.yaml new file mode 100644 index 0000000..35712c4 --- /dev/null +++ b/pay/schemas/responses/paylink/getPaylinkConfig.yaml @@ -0,0 +1,38 @@ +type: object +required: + - error +properties: + error: + items: + description: General API error. + properties: + errorClass: + type: string + errorMessage: + nullable: true + type: string + severity: + description: API error severity. + enum: + - E + - W + type: string + type: + type: string + required: + - errorClass + - severity + - type + type: object + type: array + result: + nullable: true + properties: + expire_time: + description: Paylink expiration time (in seconds) + format: uint64 + minimum: 0 + type: integer + required: + - expire_time + type: object diff --git a/pay/schemas/responses/request/cancelPayRequest.yaml b/pay/schemas/responses/request/cancelPayRequest.yaml new file mode 100644 index 0000000..1b27210 --- /dev/null +++ b/pay/schemas/responses/request/cancelPayRequest.yaml @@ -0,0 +1,30 @@ +type: object +required: + - error +properties: + error: + items: + description: General API error. + properties: + errorClass: + type: string + errorMessage: + nullable: true + type: string + severity: + description: API error severity. + enum: + - E + - W + type: string + type: + type: string + required: + - errorClass + - severity + - type + type: object + type: array + result: + nullable: true + type: object diff --git a/pay/schemas/responses/request/createPayRequest.yaml b/pay/schemas/responses/request/createPayRequest.yaml new file mode 100644 index 0000000..bc3eee4 --- /dev/null +++ b/pay/schemas/responses/request/createPayRequest.yaml @@ -0,0 +1,35 @@ +type: object +required: + - error +properties: + error: + items: + description: General API error. + properties: + errorClass: + type: string + errorMessage: + nullable: true + type: string + severity: + description: API error severity. + enum: + - E + - W + type: string + type: + type: string + required: + - errorClass + - severity + - type + type: object + type: array + result: + nullable: true + properties: + view_link: + description: "The view link, to be shared to the paying user outside of Kraken as part of a request paylink.\n\nOnly included if the request is not targeted to a specific user. If it is targeted, the request is sent to them directly, so there is no need for a view link." + nullable: true + type: string + type: object diff --git a/pay/schemas/responses/transfer/cancelPayTransfer.yaml b/pay/schemas/responses/transfer/cancelPayTransfer.yaml new file mode 100644 index 0000000..1b27210 --- /dev/null +++ b/pay/schemas/responses/transfer/cancelPayTransfer.yaml @@ -0,0 +1,30 @@ +type: object +required: + - error +properties: + error: + items: + description: General API error. + properties: + errorClass: + type: string + errorMessage: + nullable: true + type: string + severity: + description: API error severity. + enum: + - E + - W + type: string + type: + type: string + required: + - errorClass + - severity + - type + type: object + type: array + result: + nullable: true + type: object diff --git a/pay/schemas/responses/transfer/createPayTransfer.yaml b/pay/schemas/responses/transfer/createPayTransfer.yaml new file mode 100644 index 0000000..1b27210 --- /dev/null +++ b/pay/schemas/responses/transfer/createPayTransfer.yaml @@ -0,0 +1,30 @@ +type: object +required: + - error +properties: + error: + items: + description: General API error. + properties: + errorClass: + type: string + errorMessage: + nullable: true + type: string + severity: + description: API error severity. + enum: + - E + - W + type: string + type: + type: string + required: + - errorClass + - severity + - type + type: object + type: array + result: + nullable: true + type: object diff --git a/spot-rest/examples/requests/funding/deposits/addresses.yaml b/spot-rest/examples/requests/funding/deposits/addresses.yaml new file mode 100644 index 0000000..e6cbfd2 --- /dev/null +++ b/spot-rest/examples/requests/funding/deposits/addresses.yaml @@ -0,0 +1,50 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/DepositAddresses" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" \ + --data-urlencode "asset=XBT" \ + --data-urlencode "method=Bitcoin" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/DepositAddresses', { + "nonce": str(int(1000*time.time())), + "asset": "XBT", + "method": "Bitcoin", + "new": True + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('DepositAddresses', [ +# 'asset' => 'XBT', +# 'method' => 'Bitcoin' +# ]); diff --git a/spot-rest/examples/requests/funding/deposits/methods.yaml b/spot-rest/examples/requests/funding/deposits/methods.yaml new file mode 100644 index 0000000..6d398f2 --- /dev/null +++ b/spot-rest/examples/requests/funding/deposits/methods.yaml @@ -0,0 +1,46 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/DepositMethods" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" \ + --data-urlencode "asset=XBT" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/DepositMethods', { + "nonce": str(int(1000*time.time())), + "asset": "XBT" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('DepositMethods', [ +# 'asset' => 'XBT' +# ]); diff --git a/spot-rest/examples/requests/funding/deposits/recent.yaml b/spot-rest/examples/requests/funding/deposits/recent.yaml new file mode 100644 index 0000000..904a987 --- /dev/null +++ b/spot-rest/examples/requests/funding/deposits/recent.yaml @@ -0,0 +1,47 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/DepositStatus" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" \ + --data-urlencode "asset=XBT" \ + --data-urlencode "method=Bitcoin" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/DepositStatus', { + "nonce": str(int(1000*time.time())) + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('DepositStatus', [ +# 'asset' => 'XBT', +# 'method' => 'Bitcoin' +# ]); diff --git a/spot-rest/examples/requests/funding/withdrawals/addresses.yaml b/spot-rest/examples/requests/funding/withdrawals/addresses.yaml new file mode 100644 index 0000000..96e67b8 --- /dev/null +++ b/spot-rest/examples/requests/funding/withdrawals/addresses.yaml @@ -0,0 +1,35 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/WithdrawAddresses" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" \ + --data-urlencode "asset=XBT" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/WithdrawAddresses', { + "nonce": str(int(1000*time.time())), + "asset": "XBT" + }, api_key, api_sec) + + print(resp.json()) diff --git a/spot-rest/examples/requests/funding/withdrawals/info.yaml b/spot-rest/examples/requests/funding/withdrawals/info.yaml new file mode 100644 index 0000000..0126143 --- /dev/null +++ b/spot-rest/examples/requests/funding/withdrawals/info.yaml @@ -0,0 +1,40 @@ +# - lang: cURL + # source: | + # curl -X "POST" "https://api.kraken.com/0/private/WithdrawInfo" \ + # -H 'API-Key: ' \ + # -H 'API-Sign: ' \ + # -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + # --data-urlencode "nonce=" \ + # --data-urlencode "asset=XBT" \ + # --data-urlencode "method=Bitcoin" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/WithdrawInfo', { + "nonce": str(int(1000*time.time())), + "asset": "XBT", + "key": "btc_testnet_with1", + "amount": 0.725 + }, api_key, api_sec) + + print(resp.json()) + # '500': + # $ref: './partials/responses/500.yaml' \ No newline at end of file diff --git a/spot-rest/examples/requests/funding/withdrawals/methods.yaml b/spot-rest/examples/requests/funding/withdrawals/methods.yaml new file mode 100644 index 0000000..cf04614 --- /dev/null +++ b/spot-rest/examples/requests/funding/withdrawals/methods.yaml @@ -0,0 +1,35 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/WithdrawMethods" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" \ + --data-urlencode "asset=XBT" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/WithdrawMethods', { + "nonce": str(int(1000*time.time())), + "asset": "XBT" + }, api_key, api_sec) + + print(resp.json()) diff --git a/spot-rest/examples/requests/funding/withdrawals/recent.yaml b/spot-rest/examples/requests/funding/withdrawals/recent.yaml new file mode 100644 index 0000000..1b895bc --- /dev/null +++ b/spot-rest/examples/requests/funding/withdrawals/recent.yaml @@ -0,0 +1,35 @@ +# - lang: cURL + # source: | + # curl -X "POST" "https://api.kraken.com/0/private/DepositStatus" \ + # -H 'API-Key: ' \ + # -H 'API-Sign: ' \ + # -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + # --data-urlencode "nonce=" \ + # --data-urlencode "asset=XBT" \ + # --data-urlencode "method=Bitcoin" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/WithdrawStatus', { + "nonce": str(int(1000*time.time())) + }, api_key, api_sec) + + print(resp.json()) diff --git a/spot-rest/examples/requests/funding/withdrawals/withdraw.yaml b/spot-rest/examples/requests/funding/withdrawals/withdraw.yaml new file mode 100644 index 0000000..58d48ce --- /dev/null +++ b/spot-rest/examples/requests/funding/withdrawals/withdraw.yaml @@ -0,0 +1,39 @@ +# - lang: cURL + # source: | + # curl -X "POST" "https://api.kraken.com/0/private/DepositStatus" \ + # -H 'API-Key: ' \ + # -H 'API-Sign: ' \ + # -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + # --data-urlencode "nonce=" \ + # --data-urlencode "asset=XBT" \ + # --data-urlencode "method=Bitcoin" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/Withdraw', { + "nonce": str(int(1000*time.time())), + "asset": "XBT", + "key": "btc_testnet_with1", + "address": "bc1kar0ssrr7xf3vy5l6d3lydnwkre5og2zz3f5ldq", + "amount": 0.725 + }, api_key, api_sec) + + print(resp.json()) \ No newline at end of file diff --git a/spot-rest/examples/requests/public/assets/info.yaml b/spot-rest/examples/requests/public/assets/info.yaml new file mode 100644 index 0000000..9db16ae --- /dev/null +++ b/spot-rest/examples/requests/public/assets/info.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/Assets" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Assets') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Assets', ['aclass' => 'currency']); \ No newline at end of file diff --git a/spot-rest/examples/requests/public/assets/pairs.yaml b/spot-rest/examples/requests/public/assets/pairs.yaml new file mode 100644 index 0000000..525ebaf --- /dev/null +++ b/spot-rest/examples/requests/public/assets/pairs.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/AssetPairs?pair=XXBTZUSD,XETHXXBT" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/AssetPairs?pair=XXBTZUSD,XETHXXBT') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('AssetPairs', ['pair' => 'XXBTCZUSD,XETHXXBT']); \ No newline at end of file diff --git a/spot-rest/examples/requests/public/depth.yaml b/spot-rest/examples/requests/public/depth.yaml new file mode 100644 index 0000000..3ed293d --- /dev/null +++ b/spot-rest/examples/requests/public/depth.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/Depth?pair=XBTUSD" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Depth?pair=XBTUSD') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Depth', ['pair' => 'XBTUSD']); \ No newline at end of file diff --git a/spot-rest/examples/requests/public/ohlc.yaml b/spot-rest/examples/requests/public/ohlc.yaml new file mode 100644 index 0000000..301714a --- /dev/null +++ b/spot-rest/examples/requests/public/ohlc.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/OHLC?pair=XBTUSD" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/OHLC?pair=XBTUSD') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('OHLC', ['pair' => 'XBTUSD']); \ No newline at end of file diff --git a/spot-rest/examples/requests/public/spread.yaml b/spot-rest/examples/requests/public/spread.yaml new file mode 100644 index 0000000..454f877 --- /dev/null +++ b/spot-rest/examples/requests/public/spread.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/Spread?pair=XBTUSD" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Spread?pair=XBTUSD') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Spread', ['pair' => 'XBTUSD']); \ No newline at end of file diff --git a/spot-rest/examples/requests/public/ticker.yaml b/spot-rest/examples/requests/public/ticker.yaml new file mode 100644 index 0000000..1b65786 --- /dev/null +++ b/spot-rest/examples/requests/public/ticker.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/Ticker?pair=XBTUSD" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Ticker?pair=XBTUSD') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Ticker', ['pair' => 'XBTUSD']); \ No newline at end of file diff --git a/spot-rest/examples/requests/public/time.yaml b/spot-rest/examples/requests/public/time.yaml new file mode 100644 index 0000000..8bb1a99 --- /dev/null +++ b/spot-rest/examples/requests/public/time.yaml @@ -0,0 +1,22 @@ +- lang: Shell + label: cURL + source: curl "https://api.kraken.com/0/public/Time" +# - lang: ignoreme +# source: blahba +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Time') + + print(resp.json()) + +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Time'); \ No newline at end of file diff --git a/spot-rest/examples/requests/public/trades.yaml b/spot-rest/examples/requests/public/trades.yaml new file mode 100644 index 0000000..cff5c5e --- /dev/null +++ b/spot-rest/examples/requests/public/trades.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/Trades?pair=XBTUSD" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Trades?pair=XBTUSD') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Trades', ['pair' => 'XBTUSD']); \ No newline at end of file diff --git a/spot-rest/examples/requests/trading/orders/add.yaml b/spot-rest/examples/requests/trading/orders/add.yaml new file mode 100644 index 0000000..658ed0b --- /dev/null +++ b/spot-rest/examples/requests/trading/orders/add.yaml @@ -0,0 +1,9 @@ +- default: + { + "nonce": 123456789018, + "ordertype": "limit", + "type": "buy", + "volume": 1.25, + "pair": "XBTUSD", + "price": 27500 + } \ No newline at end of file diff --git a/spot-rest/examples/requests/trading/orders/add_example.yaml b/spot-rest/examples/requests/trading/orders/add_example.yaml new file mode 100644 index 0000000..09c2e2d --- /dev/null +++ b/spot-rest/examples/requests/trading/orders/add_example.yaml @@ -0,0 +1,7 @@ +nonce: 163245617 +ordertype: "limit" +type: "buy" +volume: "1.25" +pair: "XBTUSD" +price: "27500" +cl_ord_id: "6d1b345e-2821-40e2-ad83-4ecb18a06876" diff --git a/spot-rest/examples/requests/trading/orders/batchadd.yaml b/spot-rest/examples/requests/trading/orders/batchadd.yaml new file mode 100644 index 0000000..588b500 --- /dev/null +++ b/spot-rest/examples/requests/trading/orders/batchadd.yaml @@ -0,0 +1,130 @@ +- lang: cURL + source: | + // Send buy and sell BTC/USD + + + curl -X "POST" "https://api.kraken.com/0/private/AddOrderBatch" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/json' \ + { + "deadline": "2022-05-24T14:15:22Z", + "nonce": "", + "orders": [ + { + "close": {"ordertype": "stop-loss-limit", + "price": "37000", + "price2": "36000"}, + "ordertype": "limit", + "price": "40000", + "price2": "string", + "timeinforce": "GTC", + "type": "buy", + "userref": "345", + "volume": "1.2" + }, + { + "ordertype": "limit", + "price": "42000", + "starttm": "string", + "timeinforce": "GTC", + "type": "sell", + "userref": "123", + "volume": "1.2" + } + ], + + "pair": "BTC/USD", + "validate": "false" + } +- lang: Python + source: | + import time + import os + import requests + import json + import urllib.parse + import hashlib + import hmac + import base64 + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, json=data) + return req + + def get_kraken_signature(urlpath, data, secret): + postdata = json.dumps(data) + encoded = (str(data['nonce']) + postdata).encode() + message = urlpath.encode() + hashlib.sha256(encoded).digest() + mac = hmac.new(base64.b64decode(secret), message, hashlib.sha512) + sigdigest = base64.b64encode(mac.digest()) + return sigdigest.decode() + + # Construct the request and print the result + resp = kraken_request('/0/private/AddOrderBatch', { + "orders": [ + { + "close": {"ordertype": "stop-loss-limit", + "price": "37000", + "price2": "36000"}, + "ordertype": "limit", + "price": "40000", + "price2": "string", + "timeinforce": "GTC", + "type": "buy", + "userref": "123", + "volume": "1.2" + }, + { + "ordertype": "limit", + "price": "42000", + "starttm": "string", + "timeinforce": "GTC", + "type": "sell", + "userref": "345", + "volume": "1.2" + } + ], + "deadline": "2022-05-24T14:15:22Z", + "nonce": "", + "pair": "BTC/USD", + "validate": "false" + } + , api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# // buy 2.12345678 XBTUSD @ limit $101.9901 +# // with 2:1 leverage, with a follow up stop loss, +# // take profit sell order: stop at -5% loss, +# // take profit at +$10 price increase (signed stop/loss prices determined automatically using # notation): + +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('AddOrder', [ +# 'pair' => 'XXBTZUSD', +# 'type' => 'buy', +# 'ordertype' => 'limit', +# 'price' => '101.9901', +# 'volume' => '2.12345678', +# 'leverage' => '2:1', +# 'close' => [ +# 'ordertype' => 'stop-loss-profit', +# 'price' => '#5%', // stop loss price (relative percentage delta) +# 'price2' => '#10' // take profit price (relative delta) +# ] +# ]); diff --git a/spot-rest/examples/requests/trading/orders/batchcancel.yaml b/spot-rest/examples/requests/trading/orders/batchcancel.yaml new file mode 100644 index 0000000..4631073 --- /dev/null +++ b/spot-rest/examples/requests/trading/orders/batchcancel.yaml @@ -0,0 +1,52 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/CancelOrderBatch" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/json' \ + { + "nonce": "string", + "orders": ["OG5V2Y-RYKVL-DT3V3B","OP5V2Y-RYKVL-ET3V3B"], + } + + + +- lang: Python + source: | + import time + import os + import requests + import json + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=json.dumps(data)) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/CancelOrderBatch', { + "nonce": str(int(1000*time.time())), + "orders": ["OG5V2Y-RYKVL-DT3V3B","OP5V2Y-RYKVL-ET3V3B"] + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('CancelOrder', [ +# 'txid' => 'OYVGEW-VYV5B-UUEXSK' +# ]); diff --git a/spot-rest/examples/requests/trading/orders/cancel.yaml b/spot-rest/examples/requests/trading/orders/cancel.yaml new file mode 100644 index 0000000..25b5dcb --- /dev/null +++ b/spot-rest/examples/requests/trading/orders/cancel.yaml @@ -0,0 +1,46 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/CancelOrder" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" + --data-urlencode "txid=OYVGEW-VYV5B-UUEXSK" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/CancelOrder', { + "nonce": str(int(1000*time.time())), + "txid": "OG5V2Y-RYKVL-DT3V3B" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('CancelOrder', [ +# 'txid' => 'OYVGEW-VYV5B-UUEXSK' +# ]); diff --git a/spot-rest/examples/requests/trading/orders/edit.yaml b/spot-rest/examples/requests/trading/orders/edit.yaml new file mode 100644 index 0000000..5c4d1a8 --- /dev/null +++ b/spot-rest/examples/requests/trading/orders/edit.yaml @@ -0,0 +1,70 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/EditOrder" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" + --data-urlencode "pair=XXBTZUSD" \ + --data-urlencode "txid=OHYO67-6LP66-HMQ437" \ + --data-urlencode "ordertype=limit" \ + --data-urlencode "price=45000.1" \ + --data-urlencode "price2=46000.1" \ + --data-urlencode "volume=2.1234" \ +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/EditOrder', { + "nonce": str(int(1000*time.time())), + "txid": "OHYO67-6LP66-HMQ437", + "volume": 1.25, + "pair": "XBTUSD", + "price": 27500, + "price2": 26500 + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# // buy 2.12345678 XBTUSD @ limit $101.9901 +# // with 2:1 leverage, with a follow up stop loss, +# // take profit sell order: stop at -5% loss, +# // take profit at +$10 price increase (signed stop/loss prices determined automatically using # notation): + +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('EditOrder', [ +# 'pair' => 'XXBTZUSD', +# 'type' => 'buy', +# 'ordertype' => 'limit', +# 'price' => '101.9901', +# 'volume' => '2.12345678', +# 'leverage' => '2:1', +# 'close' => [ +# 'ordertype' => 'stop-loss-profit', +# 'price' => '#5%', // stop loss price (relative percentage delta) +# 'price2' => '#10' // take profit price (relative delta) +# ] +# ]); diff --git a/spot-rest/examples/requests/user/account/balance.yaml b/spot-rest/examples/requests/user/account/balance.yaml new file mode 100644 index 0000000..c366dfc --- /dev/null +++ b/spot-rest/examples/requests/user/account/balance.yaml @@ -0,0 +1,42 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/Balance" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/Balance', { + "nonce": str(int(1000*time.time())) + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('Balance'); diff --git a/spot-rest/examples/requests/user/account/balanceex.yaml b/spot-rest/examples/requests/user/account/balanceex.yaml new file mode 100644 index 0000000..9d86f27 --- /dev/null +++ b/spot-rest/examples/requests/user/account/balanceex.yaml @@ -0,0 +1,42 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/BalanceEx" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/BalanceEx', { + "nonce": str(int(1000*time.time())) + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('Balance'); diff --git a/spot-rest/examples/requests/user/ledgers/info.yaml b/spot-rest/examples/requests/user/ledgers/info.yaml new file mode 100644 index 0000000..10d65c8 --- /dev/null +++ b/spot-rest/examples/requests/user/ledgers/info.yaml @@ -0,0 +1,44 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/Ledgers" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/Ledgers', { + "nonce": str(int(1000*time.time())), + "asset": "GBP", + "start": 1610124514 + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('Ledgers'); diff --git a/spot-rest/examples/requests/user/ledgers/query.yaml b/spot-rest/examples/requests/user/ledgers/query.yaml new file mode 100644 index 0000000..aa43ae5 --- /dev/null +++ b/spot-rest/examples/requests/user/ledgers/query.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/QueryLedgers" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&id=LGBRJU-SQZ4L-5HLS3C,L3S26P-BHIOV-TTWYYI" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/QueryLedgers', { + "nonce": str(int(1000*time.time())), + "id": "L4UESK-KG3EQ-UFO4T5" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('QueryLedgers', ['id' => 'LGBRJU-SQZ4L-5HLS3C,L3S26P-BHIOV-TTWYYI']); diff --git a/spot-rest/examples/requests/user/orders/closed.yaml b/spot-rest/examples/requests/user/orders/closed.yaml new file mode 100644 index 0000000..cd9e459 --- /dev/null +++ b/spot-rest/examples/requests/user/orders/closed.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/ClosedOrders" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&trades=true" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/ClosedOrders', { + "nonce": str(int(1000*time.time())), + "userref": 36493663 + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('ClosedOrders', ['trades' => true]); \ No newline at end of file diff --git a/spot-rest/examples/requests/user/orders/open.yaml b/spot-rest/examples/requests/user/orders/open.yaml new file mode 100644 index 0000000..b581643 --- /dev/null +++ b/spot-rest/examples/requests/user/orders/open.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/OpenOrders" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&trades=true" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/OpenOrders', { + "nonce": str(int(1000*time.time())), + "trades": True + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('OpenOrders', ['trades' => true]); \ No newline at end of file diff --git a/spot-rest/examples/requests/user/orders/query.yaml b/spot-rest/examples/requests/user/orders/query.yaml new file mode 100644 index 0000000..daf3f06 --- /dev/null +++ b/spot-rest/examples/requests/user/orders/query.yaml @@ -0,0 +1,44 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/QueryOrders" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&trades=true" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/QueryOrders', { + "nonce": str(int(1000*time.time())), + "txid": "OBCMZD-JIEE7-77TH3F,OMMDB2-FSB6Z-7W3HPO", + "trades": True + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('QueryOrders', ['trades' => true]); diff --git a/spot-rest/examples/requests/user/trades/balance.yaml b/spot-rest/examples/requests/user/trades/balance.yaml new file mode 100644 index 0000000..43d47a5 --- /dev/null +++ b/spot-rest/examples/requests/user/trades/balance.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/TradeBalance" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&asset=ZUSD" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/TradeBalance', { + "nonce": str(int(1000*time.time())), + "asset": "USD" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('TradeBalance', ['asset' => "ZUSD"]); \ No newline at end of file diff --git a/spot-rest/examples/requests/user/trades/history.yaml b/spot-rest/examples/requests/user/trades/history.yaml new file mode 100644 index 0000000..d9ff0fb --- /dev/null +++ b/spot-rest/examples/requests/user/trades/history.yaml @@ -0,0 +1,42 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/TradesHistory" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&trades=true" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/TradesHistory', { + "nonce": str(int(1000*time.time())) + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('TradesHistory', ['trades' => true]); diff --git a/spot-rest/examples/requests/user/trades/query.yaml b/spot-rest/examples/requests/user/trades/query.yaml new file mode 100644 index 0000000..b6f59cb --- /dev/null +++ b/spot-rest/examples/requests/user/trades/query.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/QueryTrades" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&txid=TRWCIF-3MJWU-5DYJG5,TNGJFU-5CD67-ZV3AEO" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/QueryTrades', { + "nonce": str(int(1000*time.time())), + "txid": "THVRQM-33VKH-UCI7BS,TTEUX3-HDAAA-RC2RUO" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('QueryTrades', ['txid' => 'TRWCIF-3MJWU-5DYJG5,TNGJFU-5CD67-ZV3AEO']); diff --git a/spot-rest/examples/requests/user/trades/volume.yaml b/spot-rest/examples/requests/user/trades/volume.yaml new file mode 100644 index 0000000..e094f2c --- /dev/null +++ b/spot-rest/examples/requests/user/trades/volume.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/TradeVolume" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&pair=XETCXETH" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/TradeVolume', { + "nonce": str(int(1000*time.time())), + "pair": "XBTUSD" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('TradeVolume', ['pair' => 'XETCXETH']); diff --git a/spot-rest/examples/responses/errors/internalError.yaml b/spot-rest/examples/responses/errors/internalError.yaml new file mode 100644 index 0000000..1e896d9 --- /dev/null +++ b/spot-rest/examples/responses/errors/internalError.yaml @@ -0,0 +1,7 @@ +errors: +- field: null + value: null + type: Internal Error + msg: Internal error + severity: E + errorClass: General \ No newline at end of file diff --git a/spot-rest/examples/responses/errors/invalidApiKey.yaml b/spot-rest/examples/responses/errors/invalidApiKey.yaml new file mode 100644 index 0000000..4c07ac5 --- /dev/null +++ b/spot-rest/examples/responses/errors/invalidApiKey.yaml @@ -0,0 +1,7 @@ +value: + errors: + - field: Kraken-Api-Key + type: Invalid key + msg: Invalid API key + severity: E + errorClass: API \ No newline at end of file diff --git a/spot-rest/examples/responses/errors/invalidApiNonce.yaml b/spot-rest/examples/responses/errors/invalidApiNonce.yaml new file mode 100644 index 0000000..1635ef3 --- /dev/null +++ b/spot-rest/examples/responses/errors/invalidApiNonce.yaml @@ -0,0 +1,7 @@ +value: + errors: + - field: Kraken-Nonce + type: Invalid nonce + msg: Invalid API nonce + severity: E + errorClass: API \ No newline at end of file diff --git a/spot-rest/examples/responses/errors/invalidApiSignature.yaml b/spot-rest/examples/responses/errors/invalidApiSignature.yaml new file mode 100644 index 0000000..e61ca01 --- /dev/null +++ b/spot-rest/examples/responses/errors/invalidApiSignature.yaml @@ -0,0 +1,7 @@ +value: + errors: + - field: Kraken-Api-Sign + type: Invalid signature + msg: Invalid API signature + severity: E + errorClass: API diff --git a/spot-rest/examples/responses/funding/deposits/addresses.yaml b/spot-rest/examples/responses/funding/deposits/addresses.yaml new file mode 100644 index 0000000..6b07bb4 --- /dev/null +++ b/spot-rest/examples/responses/funding/deposits/addresses.yaml @@ -0,0 +1,17 @@ +error: [] +result: + - address: 2N9fRkx5JTWXWHmXzZtvhQsufvoYRMq9ExV + expiretm: '0' + new: true + - address: 2NCpXUCEYr8ur9WXM1tAjZSem2w3aQeTcAo + expiretm: '0' + new: true + - address: 2Myd4eaAW96ojk38A2uDK4FbioCayvkEgVq + expiretm: '0' + - address: rLHzPsX3oXdzU2qP17kHCH2G4csZv1rAJh + expiretm: '0' + new: true + tag: '1361101127' + - address: krakenkraken + expiretm: '0' + memo: '4150096490' diff --git a/spot-rest/examples/responses/funding/deposits/methods.yaml b/spot-rest/examples/responses/funding/deposits/methods.yaml new file mode 100644 index 0000000..a344486 --- /dev/null +++ b/spot-rest/examples/responses/funding/deposits/methods.yaml @@ -0,0 +1,11 @@ +error: [] +result: + - method: Bitcoin + limit: false + fee: '0.0000000000' + gen-address: true + minimum: '0.00010000' + - method: Bitcoin Lightning + limit: false + fee: '0.00000000' + minimum: '0.00010000' \ No newline at end of file diff --git a/spot-rest/examples/responses/funding/deposits/recent.yaml b/spot-rest/examples/responses/funding/deposits/recent.yaml new file mode 100644 index 0000000..d7217de --- /dev/null +++ b/spot-rest/examples/responses/funding/deposits/recent.yaml @@ -0,0 +1,24 @@ +error: [] +result: + - method: Bitcoin + aclass: currency + asset: XXBT + refid: FTQcuak-V6Za8qrWnhzTx67yYHz8Tg + txid: 6544b41b607d8b2512baf801755a3a87b6890eacdb451be8a94059fb11f0a8d9 + info: 2Myd4eaAW96ojk38A2uDK4FbioCayvkEgVq + amount: '0.78125000' + fee: '0.0000000000' + time: 1688992722 + status: Success + status-prop: return + - method: Ether (Hex) + aclass: currency + asset: XETH + refid: FTQcuak-V6Za8qrPnhsTx47yYLz8Tg + txid: '0x339c505eba389bf2c6bebb982cc30c6d82d0bd6a37521fa292890b6b180affc0' + info: '0xca210f4121dc891c9154026c3ae3d1832a005048' + amount: '0.1383862742' + time: 1688992722 + status: Settled + status-prop: onhold + originators: ['0x70b6343b104785574db2c1474b3acb3937ab5de7346a5b857a78ee26954e0e2d', '0x5b32f6f792904a446226b17f607850d0f2f7533cdc35845bfe432b5b99f55b66'] diff --git a/spot-rest/examples/responses/public/assets/info.yaml b/spot-rest/examples/responses/public/assets/info.yaml new file mode 100644 index 0000000..b4945c8 --- /dev/null +++ b/spot-rest/examples/responses/public/assets/info.yaml @@ -0,0 +1,163 @@ +error: [] +result: + ADA: + aclass: currency + altname: ADA + decimals: 8 + display_decimals: 6 + collateral_value: 0.9 + status: "enabled" + BCH: + aclass: currency + altname: BCH + decimals: 10 + display_decimals: 5 + status: "enabled" + DASH: + aclass: currency + altname: DASH + decimals: 10 + display_decimals: 5 + status: "enabled" + EOS: + aclass: currency + altname: EOS + decimals: 10 + display_decimals: 5 + status: "enabled" + GNO: + aclass: currency + altname: GNO + decimals: 10 + display_decimals: 5 + status: "enabled" + KFEE: + aclass: currency + altname: FEE + decimals: 2 + display_decimals: 2 + status: "enabled" + QTUM: + aclass: currency + altname: QTUM + decimals: 10 + display_decimals: 6 + status: "enabled" + USDT: + aclass: currency + altname: USDT + decimals: 8 + display_decimals: 4 + collateral_value: 0.9 + status: "enabled" + XETC: + aclass: currency + altname: ETC + decimals: 10 + display_decimals: 5 + status: "enabled" + XETH: + aclass: currency + altname: ETH + decimals: 10 + display_decimals: 5 + collateral_value: 1 + status: "enabled" + XLTC: + aclass: currency + altname: LTC + decimals: 10 + display_decimals: 5 + collateral_value: 0.7 + status: "enabled" + XMLN: + aclass: currency + altname: MLN + decimals: 10 + display_decimals: 5 + status: "enabled" + XREP: + aclass: currency + altname: REP + decimals: 10 + display_decimals: 5 + status: "enabled" + XTZ: + aclass: currency + altname: XTZ + decimals: 8 + display_decimals: 5 + collateral_value: 0.5 + status: "enabled" + XXBT: + aclass: currency + altname: XBT + decimals: 10 + display_decimals: 5 + collateral_value: 1 + status: "enabled" + XXDG: + aclass: currency + altname: XDG + decimals: 8 + display_decimals: 2 + status: "enabled" + XXLM: + aclass: currency + altname: XLM + decimals: 8 + display_decimals: 5 + status: "enabled" + XXMR: + aclass: currency + altname: XMR + decimals: 10 + display_decimals: 5 + status: "enabled" + XXRP: + aclass: currency + altname: XRP + decimals: 8 + display_decimals: 5 + status: "enabled" + XZEC: + aclass: currency + altname: ZEC + decimals: 10 + display_decimals: 5 + status: "enabled" + ZCAD: + aclass: currency + altname: CAD + decimals: 4 + display_decimals: 2 + collateral_value: 1 + status: "enabled" + ZEUR: + aclass: currency + altname: EUR + decimals: 4 + display_decimals: 2 + collateral_value: 1 + status: "enabled" + ZGBP: + aclass: currency + altname: GBP + decimals: 4 + display_decimals: 2 + collateral_value: 1 + status: "enabled" + ZJPY: + aclass: currency + altname: JPY + decimals: 2 + display_decimals: 0 + collateral_value: 1 + status: "enabled" + ZUSD: + aclass: currency + altname: USD + decimals: 4 + display_decimals: 2 + collateral_value: 1 + status: "enabled" diff --git a/spot-rest/examples/responses/public/assets/pairs.yaml b/spot-rest/examples/responses/public/assets/pairs.yaml new file mode 100644 index 0000000..7f84857 --- /dev/null +++ b/spot-rest/examples/responses/public/assets/pairs.yaml @@ -0,0 +1,140 @@ +error: [] +result: + XETHXXBT: + altname: ETHXBT + wsname: ETH/XBT + aclass_base: currency + base: XETH + aclass_quote: currency + quote: XXBT + lot: unit + cost_decimals: 6 + pair_decimals: 5 + lot_decimals: 8 + lot_multiplier: 1 + leverage_buy: + - 2 + - 3 + - 4 + - 5 + leverage_sell: + - 2 + - 3 + - 4 + - 5 + fees: + - - 0 + - 0.26 + - - 50000 + - 0.24 + - - 100000 + - 0.22 + - - 250000 + - 0.2 + - - 500000 + - 0.18 + - - 1000000 + - 0.16 + - - 2500000 + - 0.14 + - - 5000000 + - 0.12 + - - 10000000 + - 0.1 + fees_maker: + - - 0 + - 0.16 + - - 50000 + - 0.14 + - - 100000 + - 0.12 + - - 250000 + - 0.1 + - - 500000 + - 0.08 + - - 1000000 + - 0.06 + - - 2500000 + - 0.04 + - - 5000000 + - 0.02 + - - 10000000 + - 0 + fee_volume_currency: ZUSD + margin_call: 80 + margin_stop: 40 + ordermin: '0.01' + costmin: '0.00002' + tick_size: '0.00001' + status: 'online' + long_position_limit: 1100 + short_position_limit: 400 + XXBTZUSD: + altname: XBTUSD + wsname: XBT/USD + aclass_base: currency + base: XXBT + aclass_quote: currency + quote: ZUSD + lot: unit + cost_decimals: 5 + pair_decimals: 1 + lot_decimals: 8 + lot_multiplier: 1 + leverage_buy: + - 2 + - 3 + - 4 + - 5 + leverage_sell: + - 2 + - 3 + - 4 + - 5 + fees: + - - 0 + - 0.26 + - - 50000 + - 0.24 + - - 100000 + - 0.22 + - - 250000 + - 0.2 + - - 500000 + - 0.18 + - - 1000000 + - 0.16 + - - 2500000 + - 0.14 + - - 5000000 + - 0.12 + - - 10000000 + - 0.1 + fees_maker: + - - 0 + - 0.16 + - - 50000 + - 0.14 + - - 100000 + - 0.12 + - - 250000 + - 0.1 + - - 500000 + - 0.08 + - - 1000000 + - 0.06 + - - 2500000 + - 0.04 + - - 5000000 + - 0.02 + - - 10000000 + - 0 + fee_volume_currency: ZUSD + margin_call: 80 + margin_stop: 40 + ordermin: '0.0001' + costmin: '0.5' + tick_size: '0.1' + status: 'online' + long_position_limit: 250 + short_position_limit: 200 diff --git a/spot-rest/examples/responses/public/depth.yaml b/spot-rest/examples/responses/public/depth.yaml new file mode 100644 index 0000000..e6e3192 --- /dev/null +++ b/spot-rest/examples/responses/public/depth.yaml @@ -0,0 +1,17 @@ +error: [] +result: + XXBTZUSD: + asks: + - - '3539.90000' + - '0.801' + - 1548119951 + - - '3540.20000' + - '1.000' + - 1548119873 + bids: + - - '3538.90000' + - '0.754' + - 1548119886 + - - '3538.70000' + - '0.798' + - 1548119924 \ No newline at end of file diff --git a/spot-rest/examples/responses/public/ohlc.yaml b/spot-rest/examples/responses/public/ohlc.yaml new file mode 100644 index 0000000..8860fff --- /dev/null +++ b/spot-rest/examples/responses/public/ohlc.yaml @@ -0,0 +1,20 @@ +error: [] +result: + XXBTZUSD: + - - 1548115200 + - '3533.4' + - '3543.7' + - '3530.7' + - '3539.4' + - '3539.8' + - '83.09287787' + - 232 + - - 1548115200 + - '3533.4' + - '3543.7' + - '3530.7' + - '3539.4' + - '3539.8' + - '83.09287787' + - 232 + last: 1548111600 \ No newline at end of file diff --git a/spot-rest/examples/responses/public/spread.yaml b/spot-rest/examples/responses/public/spread.yaml new file mode 100644 index 0000000..83e0abd --- /dev/null +++ b/spot-rest/examples/responses/public/spread.yaml @@ -0,0 +1,14 @@ +error: [] +result: + XXBTZUSD: + - - 1548120550 + - '3538.70000' + - '3541.50000' + - - 1548120551 + - '3538.80000' + - '3541.50000' + - - 1548120554 + - '3538.80000' + - '3541.40000' + + last: 1548122302 \ No newline at end of file diff --git a/spot-rest/examples/responses/public/ticker.yaml b/spot-rest/examples/responses/public/ticker.yaml new file mode 100644 index 0000000..3c1d121 --- /dev/null +++ b/spot-rest/examples/responses/public/ticker.yaml @@ -0,0 +1,30 @@ +error: [] +result: + XXBTZUSD: + a: + - '3537.50000' + - '1' + - '1.000' + b: + - '3537.40000' + - '16' + - '16.000' + c: + - '3537.50000' + - '0.25000000' + v: + - '2945.40515179' + - '4009.69918350' + p: + - '3537.46886' + - '3535.79747' + t: + - 5773 + - 6815 + l: + - '3504.20000' + - '3504.20000' + h: + - '3565.00000' + - '3565.00000' + o: '3530.60000' \ No newline at end of file diff --git a/spot-rest/examples/responses/public/time.yaml b/spot-rest/examples/responses/public/time.yaml new file mode 100644 index 0000000..4954454 --- /dev/null +++ b/spot-rest/examples/responses/public/time.yaml @@ -0,0 +1,4 @@ +error: [] +result: + unixtime: 1546998654 + rfc1123: Wed, 9 Jan 19 01:50:54 +0000 \ No newline at end of file diff --git a/spot-rest/examples/responses/public/trades.yaml b/spot-rest/examples/responses/public/trades.yaml new file mode 100644 index 0000000..67e52fa --- /dev/null +++ b/spot-rest/examples/responses/public/trades.yaml @@ -0,0 +1,16 @@ +error: [] +result: + XXBTZUSD: + - - '3535.50000' + - '0.00300000' + - 1548111751.5556 + - b + - m + - '' + - - '3535.40000' + - '0.09670735' + - 1548111757.2558 + - b + - m + - '' + last: '1548121745957099006' diff --git a/spot-rest/examples/responses/trading/orders/add.yaml b/spot-rest/examples/responses/trading/orders/add.yaml new file mode 100644 index 0000000..2dbc8bb --- /dev/null +++ b/spot-rest/examples/responses/trading/orders/add.yaml @@ -0,0 +1 @@ +{"error":[],"result":{"descr":{"order":"buy 2.12340000 XBTUSD @ limit 25000.1 with 2:1 leverage","close":"close position @ stop loss 22000.0 -> limit 21000.0"},"txid":["OUF4EM-FRGI2-MQMWZD"]}} \ No newline at end of file diff --git a/spot-rest/examples/responses/trading/orders/batchadd.yaml b/spot-rest/examples/responses/trading/orders/batchadd.yaml new file mode 100644 index 0000000..c8f67ef --- /dev/null +++ b/spot-rest/examples/responses/trading/orders/batchadd.yaml @@ -0,0 +1 @@ +{'error': [], 'result': {'orders': [{'txid': 'O5OR23-ADFAD-Y2G61C', 'descr': {'order': 'buy 0.80300000 XBTUSD @ limit 28300.0'},"close":"close position @ stop loss 27000.0 -> limit 26000.0"}, {'txid': '9K6KFS-5H3PL-XBRC7A', 'descr': {'order': 'sell 0.10500000 XBTUSD @ limit 36000.0'}}]}} \ No newline at end of file diff --git a/spot-rest/examples/responses/trading/orders/batchcancel.yaml b/spot-rest/examples/responses/trading/orders/batchcancel.yaml new file mode 100644 index 0000000..92a837e --- /dev/null +++ b/spot-rest/examples/responses/trading/orders/batchcancel.yaml @@ -0,0 +1,3 @@ +error: [] +result: + count: 2 \ No newline at end of file diff --git a/spot-rest/examples/responses/trading/orders/cancel.yaml b/spot-rest/examples/responses/trading/orders/cancel.yaml new file mode 100644 index 0000000..d7ce42e --- /dev/null +++ b/spot-rest/examples/responses/trading/orders/cancel.yaml @@ -0,0 +1,3 @@ +error: [] +result: + count: 1 \ No newline at end of file diff --git a/spot-rest/examples/responses/trading/orders/edit.yaml b/spot-rest/examples/responses/trading/orders/edit.yaml new file mode 100644 index 0000000..bc3d49c --- /dev/null +++ b/spot-rest/examples/responses/trading/orders/edit.yaml @@ -0,0 +1 @@ +{"error":[],"result":{"status":"ok","txid":"OFVXHJ-KPQ3B-VS7ELA","originaltxid":"OHYO67-6LP66-HMQ437","volume":"0.00030000","price":"19500.0","price2":"32500.0","orders_cancelled":1,"descr":{"order":"buy 0.00030000 XXBTZGBP @ limit 19500.0"}}} \ No newline at end of file diff --git a/spot-rest/examples/responses/user/account/balance.yaml b/spot-rest/examples/responses/user/account/balance.yaml new file mode 100644 index 0000000..cae4493 --- /dev/null +++ b/spot-rest/examples/responses/user/account/balance.yaml @@ -0,0 +1,10 @@ +error: [] +result: + ZUSD: '2970172.7962' + ZEUR: '102559.9012' + ZCAD: '32300.0000' + KFEE: '0.00' + XXBT: '3.2223768244' + XXRP: '0.00000000' + XETH: '995.0000000000' + XDAO: '100000.0000000000' \ No newline at end of file diff --git a/spot-rest/examples/responses/user/ledgers/info.yaml b/spot-rest/examples/responses/user/ledgers/info.yaml new file mode 100644 index 0000000..542f105 --- /dev/null +++ b/spot-rest/examples/responses/user/ledgers/info.yaml @@ -0,0 +1,40 @@ +error: [] +result: + ledger: + LGBRJU-SQZ4L-5HLS3C: + refid: QGBCOYA-UNP53O-F2JDNS + time: 1546992921.8426 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '5.4687500000' + L3S26P-BHIOV-TTWYYI: + refid: QGBQAL5-3F4WQ6-DZQT7G + time: 1546992921.8172 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '4.6875000000' + LT2T4M-YDT75-42KGMU: + refid: QGBHWA7-5XFEDC-RIBTM3 + time: 1546992921.777 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '3.9062500000' + LILCPJ-DKJ53-CZIG5E: + refid: QGB5XCB-NS67CW-D34ZKM + time: 1546992921.753 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '3.1250000000' +count: 4 \ No newline at end of file diff --git a/spot-rest/examples/responses/user/ledgers/query.yaml b/spot-rest/examples/responses/user/ledgers/query.yaml new file mode 100644 index 0000000..058af57 --- /dev/null +++ b/spot-rest/examples/responses/user/ledgers/query.yaml @@ -0,0 +1,20 @@ +error: [] +result: + LGBRJU-SQZ4L-5HLS3C: + refid: QGBCOYA-UNP53O-F2JDNS + time: 1546992921.8426 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '5.4687500000' + L3S26P-BHIOV-TTWYYI: + refid: QGBQAL5-3F4WQ6-DZQT7G + time: 1546992921.8172 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '4.6875000000' \ No newline at end of file diff --git a/spot-rest/examples/responses/user/orders/closed.yaml b/spot-rest/examples/responses/user/orders/closed.yaml new file mode 100644 index 0000000..259a0c5 --- /dev/null +++ b/spot-rest/examples/responses/user/orders/closed.yaml @@ -0,0 +1,85 @@ +error: [] +result: + closed: + OT5JQ3-MNZQI-GDXY7O: + refid: + userref: 1000 + status: canceled + reason: User requested + opentm: 1550101012.7873 + closetm: 1550101338.364 + starttm: 0 + expiretm: 0 + descr: + pair: DASHUSD + type: buy + ordertype: limit + price: '1.000' + price2: '0' + leverage: none + order: buy 10.00000000 DASHUSD @ limit 1.000 + close: '' + vol: '10.00000000' + vol_exec: '0.00000000' + cost: '0.000000' + fee: '0.000000' + price: '0.000000' + stopprice: '0.000000' + limitprice: '0.000000' + misc: '' + oflags: fciq + OQB6D2-O5QMF-QBBAWZ: + refid: + userref: 3000 + status: canceled + reason: User requested + opentm: 1550101013.9522 + closetm: 1550101338.0032 + starttm: 0 + expiretm: 0 + descr: + pair: XBTEUR + type: buy + ordertype: limit + price: '1.0' + price2: '0' + leverage: none + order: buy 10.00000000 XBTEUR @ limit 1.0 + close: '' + vol: '10.00000000' + vol_exec: '0.00000000' + cost: '0.00000' + fee: '0.00000' + price: '0.00000' + stopprice: '0.00000' + limitprice: '0.00000' + misc: '' + oflags: fciq + OFESQG-RLWJQ-ZV5AME: + refid: + userref: 2000 + status: canceled + reason: User requested + opentm: 1550101013.2046 + closetm: 1550101337.6203 + starttm: 0 + expiretm: 0 + descr: + pair: XBTUSD + type: buy + ordertype: limit + price: '1.0' + price2: '0' + leverage: none + order: buy 10.00000000 XBTUSD @ limit 1.0 + close: '' + vol: '10.00000000' + vol_exec: '0.00000000' + cost: '0.00000' + fee: '0.00000' + price: '0.00000' + stopprice: '0.00000' + limitprice: '0.00000' + misc: '' + oflags: fciq + count: 3 \ No newline at end of file diff --git a/spot-rest/examples/responses/user/orders/open.yaml b/spot-rest/examples/responses/user/orders/open.yaml new file mode 100644 index 0000000..9adfeda --- /dev/null +++ b/spot-rest/examples/responses/user/orders/open.yaml @@ -0,0 +1,19 @@ +error: [] +result: + open: + O7ICPO-F4CLJ-MVBLHC: + refid: '' + userref: '' + status: open + opentm: 1373750306.9819 + starttm: 0 + expiretm: 0 + descr: + order: sell 3.00000000 XBTUSD @ limit 500.00000 + vol: "3.00000000" + vol_exec: "0.00000000" + cost: "0.00000" + fee: "0.00000" + price: "0.00000" + misc: '' + oflags: '' \ No newline at end of file diff --git a/spot-rest/examples/responses/user/orders/query.yaml b/spot-rest/examples/responses/user/orders/query.yaml new file mode 100644 index 0000000..810bfa8 --- /dev/null +++ b/spot-rest/examples/responses/user/orders/query.yaml @@ -0,0 +1,54 @@ +error: [] +result: + ODNLO4-QYFSV-33BKJA: + refid: + userref: 123456 + status: open + opentm: 1550102482.1954 + starttm: 0 + expiretm: 0 + descr: + pair: XMRUSD + type: buy + ordertype: limit + price: '1.00' + price2: '0' + leverage: none + order: buy 10.00000000 XMRUSD @ limit 1.00 + close: '' + vol: '10.00000000' + vol_exec: '0.00000000' + cost: '0.00000000' + fee: '0.00000000' + price: '0.00000000' + stopprice: '0.00000000' + limitprice: '0.00000000' + misc: '' + oflags: fciq + OQB6D2-O5QMF-QBBAWZ: + refid: + userref: 3000 + status: canceled + reason: User requested + opentm: 1550101013.9522 + closetm: 1550101338.0032 + starttm: 0 + expiretm: 0 + descr: + pair: XBTEUR + type: buy + ordertype: limit + price: '1.0' + price2: '0' + leverage: none + order: buy 10.00000000 XBTEUR @ limit 1.0 + close: '' + vol: '10.00000000' + vol_exec: '0.00000000' + cost: '0.00000' + fee: '0.00000' + price: '0.00000' + stopprice: '0.00000' + limitprice: '0.00000' + misc: '' + oflags: fciq \ No newline at end of file diff --git a/spot-rest/examples/responses/user/trades/balance.yaml b/spot-rest/examples/responses/user/trades/balance.yaml new file mode 100644 index 0000000..af93eaf --- /dev/null +++ b/spot-rest/examples/responses/user/trades/balance.yaml @@ -0,0 +1,10 @@ +error: [] +result: + eb: '3224744.0162' + tb: '3224744.0162' + m: '0.0000' + n: '0.0000' + c: '0.0000' + v: '0.0000' + e: '3224744.0162' + mf: '3224744.0162' \ No newline at end of file diff --git a/spot-rest/examples/responses/user/trades/history.yaml b/spot-rest/examples/responses/user/trades/history.yaml new file mode 100644 index 0000000..18de426 --- /dev/null +++ b/spot-rest/examples/responses/user/trades/history.yaml @@ -0,0 +1,52 @@ +error: [] +result: + trades: + TBGB6I-IMYKU-WWA2SK: + ordertxid: OJTVFU-UWBXK-7AC6ML + postxid: TKH1SE-X7IF5-CKI7JT + pair: XXBTZUSD + time: 1428084298.0986 + type: sell + ordertype: limit + price: '9.25000' + cost: '0.92500' + fee: '0.00296' + vol: '0.10000000' + margin: '0.61667' + leverage: '0' + misc: '' + trade_id: 2560488 + posstatus: closed + cprice: '9.2' + ccost: '0.9' + cfee: '0' + cvol: '0.10000000' + cmargin: '0.9' + net: "-0.0070" + trades: + - TSOROF-PFCET-MPJ7ZY + TNJAD2-A56J2-34HIEZ: + ordertxid: OJTVFU-UWBXK-7AC6ML + postxid: TLS1SE-X8IF4-DKI7GT + pair: XXBTZUSD + time: 1428084246.804 + type: sell + ordertype: limit + price: '9.25000' + cost: '0.92500' + fee: '0.00296' + vol: '0.10000000' + margin: '0.61667' + leverage: '0' + misc: '' + trade_id: 2260198 + posstatus: closed + cprice: '9.2' + ccost: '0.9' + cfee: '0' + cvol: '0.10000000' + cmargin: '0.9' + net: "-0.0070" + trades: + - TNGJFU-5CD67-ZV3AEO + count: 2 \ No newline at end of file diff --git a/spot-rest/examples/responses/user/trades/query.yaml b/spot-rest/examples/responses/user/trades/query.yaml new file mode 100644 index 0000000..8f22bff --- /dev/null +++ b/spot-rest/examples/responses/user/trades/query.yaml @@ -0,0 +1,28 @@ +error: [] +result: + TNGJFU-5CD67-ZV3AEO: + ordertxid: O5T7NQ-DH2NO-XCSJ3O + postxid: TNJAD2-A56J2-34HIEZ + pair: XXBTZUSD + time: 1428084298.0983 + type: buy + ordertype: market + price: '9.25000' + cost: '0.92500' + fee: '0.00412' + vol: '0.10000000' + margin: '0.92500' + misc: closing + TRWCIF-3MJWU-5DYJG5: + ordertxid: OGUSJ2-JCTEN-ZDLPWE + postxid: T445PG-PCO2Q-PZTQSG + pair: XXBTZUSD + time: 1428082705.9649 + type: buy + ordertype: limit + price: '9.25000' + cost: '0.92500' + fee: '0.00412' + vol: '0.10000000' + margin: '0.92500' + misc: closing \ No newline at end of file diff --git a/spot-rest/examples/responses/user/trades/volume.yaml b/spot-rest/examples/responses/user/trades/volume.yaml new file mode 100644 index 0000000..a30a86c --- /dev/null +++ b/spot-rest/examples/responses/user/trades/volume.yaml @@ -0,0 +1,20 @@ +error: [] +result: + currency: ZUSD + volume: '3015012348193.4134' + fees: + XETCXETH: + fee: '0.1000' + minfee: '0.1000' + maxfee: '0.2600' + nextfee: + nextvolume: + tiervolume: '10000000.0000' + fees_maker: + XETCXETH: + fee: '0.0000' + minfee: '0.0000' + maxfee: '0.1600' + nextfee: + nextvolume: + tiervolume: '10000000.0000' diff --git a/spot-rest/openapi_v3.yaml b/spot-rest/openapi_v3.yaml new file mode 100644 index 0000000..1f9c7d9 --- /dev/null +++ b/spot-rest/openapi_v3.yaml @@ -0,0 +1,3675 @@ +--- +openapi: 3.0.0 + +servers: + - url: https://api.kraken.com/0 + description: Production Server + +info: + title: REST API + version: 1.1.0 + description: "" + +paths: + /public/Time: + get: + tags: + - Market Data + summary: Get Server Time + description: | + Get the server's time. + + operationId: getServerTime + security: [] + responses: + "200": + description: Success response + content: + application/json: + schema: + $ref: "./schemas/responses/public/time.yaml" + example: + { + "error": [], + "result": + { + "unixtime": 1688669448, + "rfc1123": "Thu, 06 Jul 23 18:50:48 +0000", + }, + } + #$ref: './examples/responses/public/time.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /public/SystemStatus: + get: + tags: + - Market Data + summary: Get System Status + description: | + Get the current system status or trading mode. + + operationId: getSystemStatus + security: [] + # requestBody: + # description: blah + # content: + responses: + "200": + description: Success response + content: + application/json: + schema: + type: object + properties: + result: + properties: + status: + type: string + enum: [online, maintenance, cancel_only, post_only] + description: | + Current system status: + * `online` Kraken is operating normally. All order types may be submitted and trades can occur. + * `maintenance` The exchange is offline. No new orders or cancellations may be submitted. + * `cancel_only` Resting (open) orders can be cancelled but no new orders may be submitted. No trades will occur. + * `post_only` Only post-only limit orders can be submitted. Existing orders may still be cancelled. No trades will occur. + timestamp: + type: string + description: Current timestamp (RFC3339) + error: + $ref: "./schemas/objects/errors/error.yaml" + example: + { + "error": [], + "result": + { "status": "online", "timestamp": "2023-07-06T18:52:00Z" }, + } + + + /public/Assets: + get: + tags: + - Market Data + summary: Get Asset Info + description: | + Get information about the assets that are available for deposit, withdrawal, trading and earn. + + operationId: getAssetInfo + security: [] + parameters: + - $ref: "./partials/parameters/query/asset.yaml" + - $ref: "./partials/parameters/query/aclass.yaml" + responses: + "200": + description: Asset info retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/public/assets/info.yaml" + example: + { + "error": [], + "result": + { + "XXBT": + { + "aclass": "currency", + "altname": "XBT", + "decimals": 10, + "display_decimals": 5, + "collateral_value": 1, + "status": "enabled", + }, + "ZEUR": + { + "aclass": "currency", + "altname": "EUR", + "decimals": 4, + "display_decimals": 2, + "collateral_value": 1, + "status": "enabled", + }, + "ZUSD": + { + "aclass": "currency", + "altname": "USD", + "decimals": 4, + "display_decimals": 2, + "collateral_value": 1, + "status": "enabled", + }, + }, + } + # '500': + # $ref: './partials/responses/500.yaml' + + + /public/AssetPairs: + get: + tags: + - Market Data + summary: Get Tradable Asset Pairs + description: | + Get tradable asset pairs + + operationId: getTradableAssetPairs + security: [] + parameters: + - in: query + name: pair + description: Asset pairs to get data for + schema: + type: string + example: BTC/USD,ETH/BTC + - in: query + name: aclass_base + schema: + type: string + enum: + - currency + - tokenized_asset + default: currency + description: | + Filters the asset class to retrieve (optional) + + * `currency` = spot currency pairs. + * `tokenized_asset` = tokenized asset pairs, i.e. xstocks. + - in: query + name: info + schema: + type: string + enum: + - info + - leverage + - fees + - margin + default: info + description: | + Info to retrieve (optional) + + * `info` = all info + * `leverage` = leverage info + * `fees` = fees schedule + * `margin` = margin info + - in: query + name: country_code + description: Filter for response to only include pairs available in the provided country/region. + schema: + type: ISO 3166-1 alpha-2 + example: GB + responses: + "200": + description: Tradable asset pairs retrieved. + content: + application/json: + schema: + type: object + properties: + result: + description: Pair names and their info + type: object + additionalProperties: + $ref: "./schemas/objects/public/assets/pairs.yaml" + error: + $ref: "./schemas/objects/errors/error.yaml" + example: + $ref: "./examples/responses/public/assets/pairs.yaml" + # '500': + # $ref: './partials/responses/500.yaml' + + + /public/Ticker: + get: + summary: Get Ticker Information + description: | + Get ticker information for all or requested markets. To clarify usage, note that + * Today's prices start at midnight UTC + * Leaving the pair parameter blank will return tickers for all tradeable assets on Kraken + + tags: + - Market Data + operationId: getTickerInformation + security: [] + parameters: + - $ref: "./partials/parameters/query/wildcard_pair.yaml" + # - name: asset_class + # in: query + # description: The asset_class is required on requests for tokenized assets, i.e. xstocks. + # required: false + # schema: + # type: string + # enum: + # - tokenized_asset + responses: + "200": + description: Ticker info retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/public/ticker.yaml" + + # '500': + # $ref: './partials/responses/500.yaml' + + + /public/OHLC: + get: + summary: Get OHLC Data + description: | + Retrieve OHLC market data. + The last entry in the OHLC array is for the current, not-yet-committed timeframe, and will always be present, regardless of the value of `since`. + Returns up to 720 of the most recent entries (older data cannot be retrieved, regardless of the value of `since`). + + tags: + - Market Data + operationId: getOHLCData + security: [] + parameters: + - $ref: "./partials/parameters/query/pair.yaml" + - name: interval + description: Time frame interval in minutes + in: query + schema: + type: integer + default: 1 + enum: [1, 5, 15, 30, 60, 240, 1440, 10080, 21600] + example: 60 + - name: since + in: query + description: Return OHLC entries since the given timestamp (intended for incremental updates) + schema: + type: integer + example: 1688671200 + - $ref: "./partials/parameters/query/asset_class.yaml" + responses: + "200": + description: OHLC data retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/public/ohlc.yaml" + example: + { + "error": [], + "result": + { + "XXBTZUSD": + [ + [ + 1688671200, + "30306.1", + "30306.2", + "30305.7", + "30305.7", + "30306.1", + "3.39243896", + 23, + ], + [ + 1688671260, + "30304.5", + "30304.5", + "30300.0", + "30300.0", + "30300.0", + "4.42996871", + 18, + ], + [ + 1688671320, + "30300.3", + "30300.4", + "30291.4", + "30291.4", + "30294.7", + "2.13024789", + 25, + ], + [ + 1688671380, + "30291.8", + "30295.1", + "30291.8", + "30295.0", + "30293.8", + "1.01836275", + 9, + ], + ], + "last": 1688672160, + }, + } + # $ref: './examples/responses/public/ohlc.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /public/Depth: + get: + summary: Get Order Book + description: | + Returns level 2 (L2) order book, which describes the individual price levels in the book with aggregated order quantities at each level. + + tags: + - Market Data + operationId: getOrderBook + security: [] + parameters: + - $ref: "./partials/parameters/query/pair.yaml" + - name: count + description: Maximum number of asks/bids + in: query + schema: + type: integer + minimum: 1 + maximum: 500 + default: 100 + example: 2 + - $ref: "./partials/parameters/query/asset_class.yaml" + responses: + "200": + description: Order book entries retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/public/depth.yaml" + example: + { + "error": [], + "result": + { + "XXBTZUSD": + { + "asks": + [ + ["30384.10000", "2.059", 1688671659], + ["30387.90000", "1.500", 1688671380], + ["30393.70000", "9.871", 1688671261], + ], + "bids": + [ + ["30297.00000", "1.115", 1688671636], + ["30296.70000", "2.002", 1688671674], + ["30289.80000", "5.001", 1688671673], + ], + }, + }, + } + # $ref: './examples/responses/public/depth.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /public/Trades: + get: + summary: Get Recent Trades + description: | + Returns the last 1000 trades by default + + tags: + - Market Data + operationId: getRecentTrades + security: [] + parameters: + - $ref: "./partials/parameters/query/pair.yaml" + - name: since + in: query + description: Return trade data since given timestamp + schema: + type: string + example: "1616663618" + - name: count + in: query + description: Return specific number of trades, up to 1000 + schema: + type: integer + minimum: 1 + maximum: 1000 + default: 1000 + example: 2 + - $ref: "./partials/parameters/query/asset_class.yaml" + responses: + "200": + description: Trade data retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/public/trades.yaml" + example: + { + "error": [], + "result": + { + "XXBTZUSD": + [ + [ + "30243.40000", + "0.34507674", + 1688669597.8277369, + "b", + "m", + "", + 61044952, + ], + [ + "30243.30000", + "0.00376960", + 1688669598.2804112, + "s", + "l", + "", + 61044953, + ], + [ + "30243.30000", + "0.01235716", + 1688669602.698379, + "s", + "m", + "", + 61044956, + ], + ], + "last": "1688671969993150842", + }, + } + # $ref: './examples/responses/public/trades.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /public/Spread: + get: + summary: Get Recent Spreads + description: | + Returns the last ~200 top-of-book spreads for a given pair + + tags: + - Market Data + operationId: getRecentSpreads + security: [] + parameters: + - $ref: "./partials/parameters/query/pair.yaml" + - name: since + in: query + description: Returns spread data since given timestamp. Optional, intended for incremental updates within available dataset (does not contain all historical spreads). + schema: + type: integer + example: 1678219570 + - $ref: "./partials/parameters/query/asset_class.yaml" + responses: + "200": + description: Spread data retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/public/spread.yaml" + example: + { + "error": [], + "result": + { + "XXBTZUSD": + [ + [1688671834, "30292.10000", "30297.50000"], + [1688671834, "30292.10000", "30296.70000"], + [1688671834, "30292.70000", "30296.70000"], + ], + "last": 1688672106, + }, + } + #$ref: './examples/responses/public/spread.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/Balance: + post: + summary: Get Account Balance + description: | + Retrieve all cash balances, net of pending withdrawals. + + **Note on Staking/Earn assets:** We have begun to migrate assets from our legacy Staking system over to a new Earn system. As such, the following assets may appear in your balances and ledger. Please see our [Support article](https://support.kraken.com/hc/en-us/articles/360039879471-What-is-Asset-S-and-Asset-M-) for more details. Note that these assets are "read-only", to interact with your balances in them please use the base asset (e.g. `USDT` to transact with your `USDT` and `USDT.F` balances). + + **Symbol Extensions**: + * `.B`: balances in new yield-bearing products, similar to `.S` (staked) and `.M` (opt-in rewards) balances + * `.F`: balances earning automatically in Kraken Rewards + * `.T`: tokenized assets. + + **API Key Permissions Required:** `Funds permissions - Query` + tags: + - Account Data + operationId: getAccountBalance + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + rebase_multiplier: + $ref: "./partials/properties/rebase_multiplier.yaml" + required: + - nonce + + responses: + "200": + description: Account balances retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/account/balance.yaml" + example: + { + "error": [], + "result": + { + "ZUSD": "171288.6158", + "ZEUR": "504861.8946", + "XXBT": "1011.1908877900", + "XETH": "818.5500000000", + "USDT": "500000.00000000", + "DAI": "9999.9999999999", + "DOT": "2.5000000000", + "ETH2.S": "198.3970800000", + "ETH2": "2.5885574330", + "USD.M": "1213029.2780", + }, + } + # $ref: './examples/responses/user/account/balance.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/BalanceEx: + post: + summary: Get Extended Balance + description: | + Retrieve all extended account balances, including credits and held amounts. Balance available for trading is calculated as: `available balance = balance + credit - credit_used - hold_trade` + + **Note on Staking/Earn assets:** We have begun to migrate assets from our legacy Staking system over to a new Earn system. As such, the following assets may appear in your balances and ledger. Please see our [Support article](https://support.kraken.com/hc/en-us/articles/360039879471-What-is-Asset-S-and-Asset-M-) for more details. Note that these assets are "read-only", to interact with your balances in them please use the base asset (e.g. `USDT` to transact with your `USDT` and `USDT.F` balances). + + **Symbol Extensions**: + * `.B`: balances in new yield-bearing products, similar to `.S` (staked) and `.M` (opt-in rewards) balances + * `.F`: balances earning automatically in Kraken Rewards + * `.T`: tokenized assets. + + **API Key Permissions Required:** `Funds permissions - Query` + tags: + - Account Data + operationId: getExtendedBalance + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + rebase_multiplier: + $ref: "./partials/properties/rebase_multiplier.yaml" + required: + - nonce + + responses: + "200": + description: Extended account balances retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/account/balanceex.yaml" + example: + { + "error": [], + "result": + { + "ZUSD": { "balance": 25435.21, "hold_trade": 8249.76 }, + "XXBT": + { "balance": 1.24350000, "hold_trade": 0.84230000 }, + }, + } + # $ref: './examples/responses/user/account/balance.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/CreditLines: + post: + summary: Get Credit Lines + description: | + Retrieve all credit line details for VIPs with this functionality. + + **API Key Permissions Required:** `Funds permissions - Query` + tags: + - Account Data + operationId: getCreditLines + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + rebase_multiplier: + $ref: "./partials/properties/rebase_multiplier.yaml" + required: + - nonce + + responses: + "200": + description: Credit line details retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/account/creditlines.yaml" + example: + { + "error": [], + "result": { + "asset_details": { + "USD": { + "balance": "1000.5000", + "credit_limit": "50000.0000", + "credit_used": "12500.0000", + "available_credit": "37500.0000" + }, + "EUR": { + "balance": "500.2500", + "credit_limit": "25000.0000", + "credit_used": "5000.0000", + "available_credit": "20000.0000" + } + }, + "limits_monitor": { + "total_credit_usd": "100000.0000", + "total_credit_used_usd": "25000.0000", + "total_collateral_value_usd": "150000.0000", + "equity_usd": "125000.0000", + "ongoing_balance": "1.5000", + "debt_to_equity": "0.2000" + } + } + } + + + /private/TradeBalance: + post: + summary: Get Trade Balance + description: | + Retrieve a summary of collateral balances, margin position valuations, equity and margin level. + + **API Key Permissions Required:** `Orders and trades - Query open orders & trades` + tags: + - Account Data + operationId: getTradeBalance + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + $ref: "./schemas/requests/user/trades/balance.yaml" + + responses: + "200": + description: Trade balances retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/trades/balance.yaml" + example: + { + "error": [], + "result": + { + "eb": "1101.3425", + "tb": "392.2264", + "m": "7.0354", + "n": "-10.0232", + "c": "21.1063", + "v": "31.1297", + "e": "382.2032", + "mf": "375.1678", + "ml": "5432.57", + }, + } + # $ref: './examples/responses/user/trades/balance.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/OpenOrders: + post: + summary: Get Open Orders + description: | + Retrieve information about currently open orders. + + **API Key Permissions Required:** `Orders and trades - Query open orders & trades` + tags: + - Account Data + operationId: getOpenOrders + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + $ref: "./schemas/requests/user/openOrders.yaml" + + responses: + "200": + description: Open orders info retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/orders/open.yaml" + example: + { + "error": [], + "result": + { + "open": + { + "OQCLML-BW3P3-BUCMWZ": + { + "refid": None, + "userref": 0, + "status": "open", + "opentm": 1688666559.8974, + "starttm": 0, + "expiretm": 0, + "descr": + { + "pair": "XBTUSD", + "type": "buy", + "ordertype": "limit", + "price": "30010.0", + "price2": "0", + "leverage": "none", + "order": "buy 1.25000000 XBTUSD @ limit 30010.0", + "close": "", + }, + "vol": "1.25000000", + "vol_exec": "0.37500000", + "cost": "11253.7", + "fee": "0.00000", + "price": "30010.0", + "stopprice": "0.00000", + "limitprice": "0.00000", + "misc": "", + "oflags": "fciq", + "trades": ["TCCCTY-WE2O6-P3NB37"], + }, + "OB5VMB-B4U2U-DK2WRW": + { + "refid": None, + "userref": 45326, + "status": "open", + "opentm": 1688665899.5699, + "starttm": 0, + "expiretm": 0, + "descr": + { + "pair": "XBTUSD", + "type": "buy", + "ordertype": "limit", + "price": "14500.0", + "price2": "0", + "leverage": "5:1", + "order": "buy 0.27500000 XBTUSD @ limit 14500.0 with 5:1 leverage", + "close": "", + }, + "vol": "0.27500000", + "vol_exec": "0.00000000", + "cost": "0.00000", + "fee": "0.00000", + "price": "0.00000", + "stopprice": "0.00000", + "limitprice": "0.00000", + "misc": "", + "oflags": "fciq", + }, + }, + }, + } + # $ref: './examples/responses/user/orders/open.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/ClosedOrders: + post: + summary: Get Closed Orders + description: | + Retrieve information about orders that have been closed (filled or cancelled). 50 results are returned at a time, the most recent by default. + + **Note:** If an order's tx ID is given for `start` or `end` time, the order's opening time (`opentm`) is used + + **API Key Permissions Required:** `Orders and trades - Query closed orders & trades` + tags: + - Account Data + operationId: getClosedOrders + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + $ref: "./schemas/requests/user/closedOrders.yaml" + + responses: + "200": + description: Closed orders info retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/orders/closed.yaml" + example: + { + "error": [], + "result": + { + "closed": + { + "O37652-RJWRT-IMO74O": + { + "refid": None, + "userref": 1, + "status": "canceled", + "reason": "User requested", + "opentm": 1688148493.7708, + "closetm": 1688148610.0482, + "starttm": 0, + "expiretm": 0, + "descr": + { + "pair": "XBTGBP", + "type": "buy", + "ordertype": "stop-loss-limit", + "price": "23667.0", + "price2": "0", + "leverage": "none", + "order": "buy 0.00100000 XBTGBP @ limit 23667.0", + "close": "", + }, + "vol": "0.00100000", + "vol_exec": "0.00000000", + "cost": "0.00000", + "fee": "0.00000", + "price": "0.00000", + "stopprice": "0.00000", + "limitprice": "0.00000", + "misc": "", + "oflags": "fciq", + "trigger": "index", + }, + "O6YDQ5-LOMWU-37YKEE": + { + "refid": None, + "userref": 36493663, + "status": "canceled", + "reason": "User requested", + "opentm": 1688148493.7708, + "closetm": 1688148610.0477, + "starttm": 0, + "expiretm": 0, + "descr": + { + "pair": "XBTEUR", + "type": "buy", + "ordertype": "take-profit-limit", + "price": "27743.0", + "price2": "0", + "leverage": "none", + "order": "buy 0.00100000 XBTEUR @ limit 27743.0", + "close": "", + }, + "vol": "0.00100000", + "vol_exec": "0.00000000", + "cost": "0.00000", + "fee": "0.00000", + "price": "0.00000", + "stopprice": "0.00000", + "limitprice": "0.00000", + "misc": "", + "oflags": "fciq", + "trigger": "index", + }, + }, + "count": 2, + }, + } + # $ref: './examples/responses/user/orders/closed.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/QueryOrders: + post: + summary: Query Orders Info + description: | + Retrieve information about specific orders. + + **API Key Permissions Required:** `Orders and trades - Query open orders & trades` or `Orders and trades - Query closed orders & trades`, depending on status of order + tags: + - Account Data + operationId: getOrdersInfo + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/user/orders/query.yaml" + examples: + Example Query 2 orders: + value: + nonce: 1695828490 + trades: false + userref: 1693455284 + txid: "STMH53C-C54CG-4SO42I, ST4USDQ-ZQBMB-FGET2G" + responses: + "200": + description: Orders info retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/orders/query.yaml" + example: + { + "error": [], + "result": + { + "OBCMZD-JIEE7-77TH3F": + { + "refid": None, + "userref": 0, + "status": "closed", + "reason": null, + "opentm": 1688665496.7808, + "closetm": 1688665499.1922, + "starttm": 0, + "expiretm": 0, + "descr": + { + "pair": "XBTUSD", + "type": "buy", + "ordertype": "stop-loss-limit", + "price": "27500.0", + "price2": "0", + "leverage": "none", + "order": "buy 1.25000000 XBTUSD @ limit 27500.0", + "close": "", + }, + "vol": "1.25000000", + "vol_exec": "1.25000000", + "cost": "27526.2", + "fee": "26.2", + "price": "27500.0", + "stopprice": "0.00000", + "limitprice": "0.00000", + "misc": "", + "oflags": "fciq", + "trigger": "index", + "trades": ["TZX2WP-XSEOP-FP7WYR"], + }, + "OMMDB2-FSB6Z-7W3HPO": + { + "refid": None, + "userref": 0, + "status": "closed", + "reason": null, + "opentm": 1688592012.2317, + "closetm": 1688592012.2335, + "starttm": 0, + "expiretm": 0, + "descr": + { + "pair": "XBTUSD", + "type": "sell", + "ordertype": "market", + "price": "0", + "price2": "0", + "leverage": "none", + "order": "sell 0.25000000 XBTUSD @ market", + "close": "", + }, + "vol": "0.25000000", + "vol_exec": "0.25000000", + "cost": "7500.0", + "fee": "7.5", + "price": "30000.0", + "stopprice": "0.00000", + "limitprice": "0.00000", + "misc": "", + "oflags": "fcib", + "trades": ["TJUW2K-FLX2N-AR2FLU"], + }, + }, + } + # $ref: './examples/responses/user/orders/query.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/OrderAmends: + post: + summary: Get Order Amends + description: | + Retrieves an audit trail of amend transactions on the specified order. The list is ordered by ascending amend timestamp. + + **API Key Permissions Required:** `Orders and trades - Query open orders & trades` or `Orders and trades - Query closed orders & trades`, depending on status of order. + tags: + - Account Data + operationId: getOrderAmends + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/user/orders/amends.yaml" + responses: + "200": + description: The first entry contains the original order parameters and has amend_type of `original`. + content: + application/json: + schema: + $ref: "./schemas/responses/user/orders/amends.yaml" + example: + { + "response": { + "error": [], + "result": { + "amends": [ + { + "amend_id": "TSUN4B-EX2XN-WQ6GKG", + "amend_type": "original", + "order_qty": "0.01000000", + "remaining_qty": "0.01000000", + "limit_price": "61032.8", + "timestamp": 1724158070287557853 + }, + { + "amend_id": "TF6VAW-VUWMX-6SXTCH", + "amend_type": "user", + "order_qty": "0.01000000", + "remaining_qty": "0.01000000", + "limit_price": "61032.7", + "timestamp": 1724158076936755587 + }, + { + "amend_id": "TUMY4K-E4MPE-CSL2N3", + "amend_type": "user", + "order_qty": "0.01000000", + "remaining_qty": "0.01000000", + "limit_price": "61032.6", + "timestamp": 1724158214879659945 + } + ], + "count": 3 + } + } + } + + + /private/TradesHistory: + post: + summary: Get Trades History + description: | + Retrieve information about trades/fills. 50 results are returned at a time, the most recent by default. + * Unless otherwise stated, costs, fees, prices, and volumes are specified with the precision for the asset pair (`pair_decimals` and `lot_decimals`), not the individual assets' precision (`decimals`). + + **API Key Permissions Required:** `Orders and trades - Query closed orders & trades` + tags: + - Account Data + operationId: getTradeHistory + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + $ref: "./schemas/requests/user/trades/history.yaml" + responses: + "200": + description: Trade history retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/trades/history.yaml" + example: + {"error":[],"result":{"trades":{"THVRQM-33VKH-UCI7BS":{"ordertxid":"OQCLML-BW3P3-BUCMWZ","postxid":"TKH2SE-M7IF5-CFI7LT","pair":"XXBTZUSD","time":1688667796.8802,"type":"buy","ordertype":"limit","price":"30010.00000","cost":"600.20000","fee":"0.00000","vol":"0.02000000","margin":"0.00000","misc":"","trade_id":40274859,"maker":True},"TCWJEG-FL4SZ-3FKGH6":{"ordertxid":"OQCLML-BW3P3-BUCMWZ","postxid":"TKH2SE-M7IF5-CFI7LT","pair":"XXBTZUSD","time":1688667769.6396,"type":"buy","ordertype":"limit","price":"30010.00000","cost":"300.10000","fee":"0.00000","vol":"0.01000000","margin":"0.00000","misc":"","trade_id":39482674,"maker":True}}}} + # $ref: './examples/responses/user/trades/history.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/QueryTrades: + post: + summary: Query Trades Info + description: | + Retrieve information about specific trades/fills. + + **API Key Permissions Required:** `Orders and trades - Query closed orders & trades` + tags: + - Account Data + operationId: getTradesInfo + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + $ref: "./schemas/requests/user/trades/query.yaml" + responses: + "200": + description: Trades info retrieved. + content: + application/json: + schema: + type: object + properties: + result: + description: Trade info + type: object + additionalProperties: + $ref: "./schemas/objects/user/trades/trade.yaml" + error: + type: array + items: + $ref: "./schemas/objects/errors/error.yaml" + example: + {"error":[],"result":{"THVRQM-33VKH-UCI7BS":{"ordertxid":"OQCLML-BW3P3-BUCMWZ","postxid":"TKH2SE-M7IF5-CFI7LT","pair":"XXBTZUSD","time":1688667796.8802,"type":"buy","ordertype":"limit","price":"30010.00000","cost":"600.20000","fee":"0.00000","vol":"0.02000000","margin":"0.00000","misc":"","trade_id":93748276,"maker":True},"TTEUX3-HDAAA-RC2RUO":{"ordertxid":"OH76VO-UKWAD-PSBDX6","postxid":"TKH2SE-M7IF5-CFI7LT","pair":"XXBTZEUR","time":1688082549.3138,"type":"buy","ordertype":"limit","price":"27732.00000","cost":"0.20020","fee":"0.00000","vol":"0.00020000","margin":"0.00000","misc":"","trade_id":74625834,"maker":True}}} + # $ref: './examples/responses/user/trades/query.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/OpenPositions: + post: + summary: Get Open Positions + description: | + Get information about open margin positions. + + **API Key Permissions Required:** `Orders and trades - Query open orders & trades` + tags: + - Account Data + operationId: getOpenPositions + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + required: true + content: + application/json: + schema: + required: + - nonce + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + txid: + type: string + description: Comma delimited list of txids to limit output to + docalcs: + type: boolean + description: Whether to include P&L calculations + default: false + consolidation: + type: string + description: Consolidate positions by market/pair + enum: + - market + rebase_multiplier: + $ref: "./partials/properties/rebase_multiplier.yaml" + examples: + get Open Position: + value: + nonce: 1695828490 + docalcs: false + consolidation: "market" + txid: "STMH53C-C54CG-4SO42I, ST4USDQ-ZQBMB-FGET2G" + responses: + "200": + description: Open positions info retrieved. + content: + application/json: + schema: + properties: + result: + type: object + additionalProperties: + x-additionalPropertiesName: txid + title: txid + type: object + properties: + ordertxid: + type: string + description: Order ID responsible for the position + posstatus: + type: string + description: Position status + enum: + - open + pair: + type: string + description: Asset pair + time: + type: number + description: Unix timestamp of trade + type: + type: string + description: Direction (buy/sell) of position + ordertype: + type: string + description: Order type used to open position + cost: + type: string + description: Opening cost of position (in quote currency) + fee: + type: string + description: Opening fee of position (in quote currency) + vol: + type: string + description: Position opening size (in base currency) + vol_closed: + type: string + description: Quantity closed (in base currency) + margin: + type: string + description: Initial margin consumed (in quote currency) + value: + type: string + description: Current value of remaining position (if `docalcs` requested) + net: + type: string + description: Unrealised P&L of remaining position (if `docalcs` requested) + terms: + type: string + description: Funding cost and term of position + rollovertm: + type: string + description: Timestamp of next margin rollover fee + misc: + type: string + description: Comma delimited list of add'l info + oflags: + type: string + description: Comma delimited list of opening order flags + error: + $ref: "./schemas/objects/errors/error.yaml" + # $ref: './schemas/responses/funding/withdrawals/recent.yaml' + example: + { + "error": [], + "result": + { + "TF5GVO-T7ZZ2-6NBKBI": + { + "ordertxid": "OLWNFG-LLH4R-D6SFFP", + "posstatus": "open", + "pair": "XXBTZUSD", + "time": 1605280097.8294, + "type": "buy", + "ordertype": "limit", + "cost": "104610.52842", + "fee": "289.06565", + "vol": "8.82412861", + "vol_closed": "0.20200000", + "margin": "20922.10568", + "value": "258797.5", + "net": "+154186.9728", + "terms": "0.0100% per 4 hours", + "rollovertm": "1616672637", + "misc": "", + "oflags": "", + }, + "T24DOR-TAFLM-ID3NYP": + { + "ordertxid": "OIVYGZ-M5EHU-ZRUQXX", + "posstatus": "open", + "pair": "XXBTZUSD", + "time": 1607943827.3172, + "type": "buy", + "ordertype": "limit", + "cost": "145756.76856", + "fee": "335.24057", + "vol": "8.00000000", + "vol_closed": "0.00000000", + "margin": "29151.35371", + "value": "240124.0", + "net": "+94367.2314", + "terms": "0.0100% per 4 hours", + "rollovertm": "1616672637", + "misc": "", + "oflags": "", + }, + "TYMRFG-URRG5-2ZTQSD": + { + "ordertxid": "OF5WFH-V57DP-QANDAC", + "posstatus": "open", + "pair": "XXBTZUSD", + "time": 1610448039.8374, + "type": "buy", + "ordertype": "limit", + "cost": "0.00240", + "fee": "0.00000", + "vol": "0.00000010", + "vol_closed": "0.00000000", + "margin": "0.00048", + "value": "0", + "net": "+0.0006", + "terms": "0.0100% per 4 hours", + "rollovertm": "1616672637", + "misc": "", + "oflags": "", + }, + "TAFGBN-TZNFC-7CCYIM": + { + "ordertxid": "OF5WFH-V57DP-QANDAC", + "posstatus": "open", + "pair": "XXBTZUSD", + "time": 1610448039.8448, + "type": "buy", + "ordertype": "limit", + "cost": "2.40000", + "fee": "0.00264", + "vol": "0.00010000", + "vol_closed": "0.00000000", + "margin": "0.48000", + "value": "3.0", + "net": "+0.6015", + "terms": "0.0100% per 4 hours", + "rollovertm": "1616672637", + "misc": "", + "oflags": "", + }, + "T4O5L3-4VGS4-IRU2UL": + { + "ordertxid": "OF5WFH-V57DP-QANDAC", + "posstatus": "open", + "pair": "XXBTZUSD", + "time": 1610448040.7722, + "type": "buy", + "ordertype": "limit", + "cost": "21.59760", + "fee": "0.02376", + "vol": "0.00089990", + "vol_closed": "0.00000000", + "margin": "4.31952", + "value": "27.0", + "net": "+5.4133", + "terms": "0.0100% per 4 hours", + "rollovertm": "1616672637", + "misc": "", + "oflags": "", + }, + }, + } + + + /private/Ledgers: + post: + summary: Get Ledgers Info + description: | + Retrieve information about ledger entries. 50 results are returned at a time, the most recent by default. + + > **Note on Staking/Earn assets:** We have begun to migrate assets from our legacy Staking system over to a new Earn system. As such, the following assets may appear in your balances and ledger. Please see our [Support article](https://support.kraken.com/hc/en-us/articles/360039879471-What-is-Asset-S-and-Asset-M-) for more details. Note that these assets are "read-only", to interact with your balances in them please use the base asset (e.g. `USDT` to transact with your `USDT` and `USDT.F` balances). + > * `.B`, which represents balances in new yield-bearing products, similar to `.S` (staked) and `.M` (opt-in rewards) balances + > * `.F`, which represents balances earning automatically in Kraken Rewards + + **API Key Permissions Required:** `Data - Query ledger entries` + tags: + - Account Data + operationId: getLedgers + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + $ref: "./schemas/requests/user/ledgers/info.yaml" + responses: + "200": + description: Ledgers info retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/ledgers/info.yaml" + example: + { + "error": [], + "result": + { + "ledger": + { + "L4UESK-KG3EQ-UFO4T5": + { + "refid": "TJKLXF-PGMUI-4NTLXU", + "time": 1688464484.1787, + "type": "trade", + "subtype": "", + "aclass": "currency", + "asset": "ZGBP", + "amount": "-24.5000", + "fee": "0.0490", + "balance": "459567.9171", + }, + "LMKZCZ-Z3GVL-CXKK4H": + { + "refid": "TBZIP2-F6QOU-TMB6FY", + "time": 1688444262.8888, + "type": "trade", + "subtype": "", + "aclass": "currency", + "asset": "ZUSD", + "amount": "0.9852", + "fee": "0.0010", + "balance": "52732.1132", + }, + }, + "count": 2, + }, + } + # $ref: './examples/responses/user/ledgers/info.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/QueryLedgers: + post: + summary: Query Ledgers + description: | + Retrieve information about specific ledger entries. + + > **Note on Staking/Earn assets:** We have begun to migrate assets from our legacy Staking system over to a new Earn system. As such, the following assets may appear in your balances and ledger. Please see our [Support article](https://support.kraken.com/hc/en-us/articles/360039879471-What-is-Asset-S-and-Asset-M-) for more details. Note that these assets are "read-only", to interact with your balances in them please use the base asset (e.g. `USDT` to transact with your `USDT` and `USDT.F` balances). + > * `.B`, which represents balances in new yield-bearing products, similar to `.S` (staked) and `.M` (opt-in rewards) balances + > * `.F`, which represents balances earning automatically in Kraken Rewards + + **API Key Permissions Required:** `Data - Query ledger entries` + tags: + - Account Data + operationId: getLedgersInfo + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + $ref: "./schemas/requests/user/ledgers/query.yaml" + + responses: + "200": + description: Ledgers info retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/ledgers/query.yaml" + example: + { + "error": [], + "result": + { + "L4UESK-KG3EQ-UFO4T5": + { + "refid": "TJKLXF-PGMUI-4NTLXU", + "time": 1688464484.1787, + "type": "trade", + "subtype": "", + "aclass": "currency", + "asset": "ZGBP", + "amount": "-24.5000", + "fee": "0.0490", + "balance": "459567.9171", + }, + }, + } + # $ref: './examples/responses/user/ledgers/query.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/TradeVolume: + post: + summary: Get Trade Volume + description: | + Returns 30 day USD trading volume and resulting fee schedule for any asset pair(s) provided. Fees will not be included if `pair` is not specified as Kraken fees differ by asset pair. + Note: If an asset pair is on a maker/taker fee schedule, the taker side is given in `fees` and maker side in `fees_maker`. For pairs not on maker/taker, they will only be given in `fees`. + + **API Key Permissions Required:** `Funds permissions - Query` + tags: + - Account Data + operationId: getTradeVolume + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + $ref: "./schemas/requests/user/trades/volume.yaml" + responses: + "200": + description: Trade Volume retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/user/trades/volume.yaml" + example: + { + "error": [], + "result": + { + "currency": "ZUSD", + "volume": "200709587.4223", + "fees": + { + "XXBTZUSD": + { + "fee": "0.1000", + "minfee": "0.1000", + "maxfee": "0.2600", + "nextfee": null, + "nextvolume": null, + "tiervolume": "10000000.0000", + }, + }, + "fees_maker": + { + "XXBTZUSD": + { + "fee": "0.0000", + "minfee": "0.0000", + "maxfee": "0.1600", + "nextfee": null, + "nextvolume": null, + "tiervolume": "10000000.0000", + }, + }, + }, + } + # $ref: './examples/responses/user/trades/volume.yaml' + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/AddExport: + post: + summary: Request Export Report + description: | + Request export of trades or ledgers. + + **API Key Permissions Required:** `Data - Export data` + tags: + - Account Data + operationId: addExport + requestBody: + required: true + content: + application/json: + schema: + required: + - nonce + - report + - description + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + report: + type: string + description: Type of data to export + enum: + - trades + - ledgers + format: + type: string + description: File format to export + enum: + - CSV + - TSV + default: CSV + description: + type: string + description: Description for the export + fields: + type: string + default: all + description: | + Comma-delimited list of fields to include + + * `trades`: `ordertxid`, `time`, `ordertype`, `price`, `cost`, `fee`, `vol`, `margin`, `misc`, `ledgers` + * `ledgers`: `refid`, `time`, `type`, `subtype`, `aclass`, `asset`, `amount`, `fee`, `balance`, `wallet` + # asset: + # type: string + # description: | + # Comma-delimited list of assets to filter data by + # default: all + starttm: + type: integer + description: UNIX timestamp for report start time (default 1st of the current month) + endtm: + type: integer + description: UNIX timestamp for report end time (default now) + + example: + nonce: 1695828490 + report: "trades" + description: "yearly report" + format: "CSV" + starttm: 1695728276 + endtm: 1695828276 + responses: + "200": + description: Export request made + content: + application/json: + schema: + properties: + result: + type: object + properties: + id: + type: string + description: Report ID + error: + $ref: "./schemas/objects/errors/error.yaml" + example: { "error": [], "result": { "id": "TCJA" } } + + + /private/ExportStatus: + post: + summary: Get Export Report Status + description: | + Get status of requested data exports. + + **API Key Permissions Required:** `Data - Export data` + tags: + - Account Data + operationId: exportStatus + requestBody: + required: true + content: + application/json: + schema: + required: + - nonce + - report + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + report: + type: string + description: Type of reports to inquire about + enum: + - trades + - ledgers + example: + nonce: 1695828490 + report: "trades" + responses: + "200": + description: Export status retrieved + content: + application/json: + schema: + properties: + result: + type: array + items: + type: object + properties: + id: + type: string + description: Report ID + descr: + type: string + format: + type: string + report: + type: string + subtype: + type: string + status: + type: string + description: Status of the report + enum: + - Queued + - Processing + - Processed + flags: + type: string + deprecated: true + fields: + type: string + createdtm: + type: string + description: UNIX timestamp of report request + expiretm: + type: string + deprecated: true + starttm: + type: string + description: UNIX timestamp report processing began + completedtm: + type: string + description: UNIX timestamp report processing finished + datastarttm: + type: string + description: UNIX timestamp of the report data start time + dataendtm: + type: string + description: UNIX timestamp of the report data end time + aclass: + type: string + deprecated: true + asset: + type: string + + error: + $ref: "./schemas/objects/errors/error.yaml" + example: + { + "error": [], + "result": + [ + { + "id": "VSKC", + "descr": "my_trades_1", + "format": "CSV", + "report": "trades", + "subtype": "all", + "status": "Processed", + "flags": "0", + "fields": "all", + "createdtm": "1688669085", + "expiretm": "1688878685", + "starttm": "1688669093", + "completedtm": "1688669093", + "datastarttm": "1683556800", + "dataendtm": "1688669085", + "aclass": "forex", + "asset": "all", + }, + { + "id": "TCJA", + "descr": "my_trades_1", + "format": "CSV", + "report": "trades", + "subtype": "all", + "status": "Processed", + "flags": "0", + "fields": "all", + "createdtm": "1688363637", + "expiretm": "1688573237", + "starttm": "1688363664", + "completedtm": "1688363664", + "datastarttm": "1683235200", + "dataendtm": "1688363637", + "aclass": "forex", + "asset": "all", + }, + ], + } + + + /private/RetrieveExport: + post: + summary: Retrieve Data Export + description: | + Retrieve a processed data export + + **API Key Permissions Required:** `Data - Export data` + tags: + - Account Data + operationId: retrieveExport + requestBody: + required: true + content: + application/json: + schema: + required: + - nonce + - id + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + id: + type: string + description: Report ID to retrieve + example: + nonce: 1695828490 + id: "1234556" + responses: + "200": + description: Data export report retrieved + content: + application/octet-stream: + schema: + properties: + report: + type: string + format: binary + description: Binary zip archive containing the report + + # example: {"error":[],"result":[{"id":"VSKC","descr":"my_trades_1","format":"CSV","report":"trades","subtype":"all","status":"Processed","flags":"0","fields":"all","createdtm":"1616669085","expiretm":"1617878685","starttm":"1616669093","completedtm":"1616669093","datastarttm":"1614556800","dataendtm":"1616669085","aclass":"forex","asset":"all"},{"id":"TCJA","descr":"my_trades_1","format":"CSV","report":"trades","subtype":"all","status":"Processed","flags":"0","fields":"all","createdtm":"1617363637","expiretm":"1618573237","starttm":"1617363664","completedtm":"1617363664","datastarttm":"1617235200","dataendtm":"1617363637","aclass":"forex","asset":"all"}]} + + + /private/RemoveExport: + post: + summary: Delete Export Report + description: | + Delete exported trades/ledgers report + + **API Key Permissions Required:** `Data - Export data` + tags: + - Account Data + operationId: removeExport + requestBody: + required: true + content: + application/json: + schema: + required: + - nonce + - id + - type + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + id: + type: string + description: ID of report to delete or cancel + type: + type: string + description: | + `delete` can only be used for reports that have already been processed. Use `cancel` for queued or processing reports. + enum: + - cancel + - delete + example: + nonce: 1695828490 + id: "1234556" + type: "cancel" + responses: + "200": + description: Export report deleted or cancelled + content: + application/json: + schema: + properties: + result: + type: object + properties: + delete: + type: boolean + description: Whether deletion was successful + cancel: + type: boolean + description: Whether cancellation was successful + error: + $ref: "./schemas/objects/errors/error.yaml" + example: { "error": [], "result": { "delete": True } } + + + /private/AddOrder: + post: + summary: Add Order + description: | + Place a new order. + + **Note**: See the [AssetPairs](/docs/rest-api/get-tradable-asset-pairs) endpoint for details on the available trading pairs, their price and quantity precisions, order minimums, available leverage, etc. + + **API Key Permissions Required:** `Orders and trades - Create & modify orders` + tags: + - Trading + operationId: addOrder + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/trading/orders/add.yaml" + + + responses: + "200": + description: Order added. + content: + application/json: + schema: + $ref: "./schemas/responses/trading/orders/add.yaml" + examples: + Limit with conditional stop-loss: + value: + $ref: "./examples/responses/trading/orders/add.yaml" + + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/AmendOrder: + post: + summary: Amend Order + description: | + The amend request enables clients to modify the order parameters in-place without the need to cancel the existing order and create a new one. + + * The order identifiers assigned by Kraken and/or client will stay the same. + * Queue priority in the order book will be maintained where possible. + * If an amend request will reduce the order quantity below the existing filled quantity, the remaining quantity will be cancelled. + + For more detail, see [amend transaction guide](/docs/guides/spot-amends). + + **API Key Permissions Required:** `Orders and trades - Create & modify orders` or `Orders and trades - Cancel & close orders` + tags: + - Trading + operationId: amendOrder + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/trading/orders/amend.yaml" + + responses: + "200": + description: | + A successful amend request will return the unique Kraken amend identifier. + content: + application/json: + schema: + $ref: "./schemas/responses/trading/orders/amend.yaml" + + + /private/CancelOrder: + post: + summary: Cancel Order + description: | + Cancel a particular open order (or set of open orders) by `txid`, `userref` or `cl_ord_id` + + **API Key Permissions Required:** `Orders and trades - Create & modify orders` or `Orders and trades - Cancel & close orders` + tags: + - Trading + operationId: cancelOrder + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/trading/orders/cancel.yaml" + + responses: + "200": + description: Open order cancelled. + content: + application/json: + schema: + $ref: "./schemas/responses/trading/orders/cancel.yaml" + + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/CancelAll: + post: + summary: Cancel All Orders + description: | + Cancel all open orders + + **API Key Permissions Required:** `Orders and trades - Create & modify orders` or `Orders and trades - Cancel & close orders` + tags: + - Trading + operationId: cancelAllOrders + + # parameters: + # - name: user_iiban + # $ref: "./partials/parameters/query/user_iiban.yaml" + + requestBody: + $ref: "./schemas/requests/nonceOnly.yaml" + + responses: + "200": + description: Open orders cancelled. + content: + application/json: + schema: + $ref: "./schemas/responses/trading/orders/cancel.yaml" + + + /private/CancelAllOrdersAfter: + post: + summary: Cancel All Orders After X + tags: + - Trading + operationId: cancelAllOrdersAfter + description: | + CancelAllOrdersAfter provides a "Dead Man's Switch" mechanism to protect the client from network malfunction, extreme latency or unexpected matching engine downtime. The client can send a request with a timeout (in seconds), that will start a countdown timer which will cancel *all* client orders when the timer expires. The client has to keep sending new requests to push back the trigger time, or deactivate the mechanism by specifying a timeout of 0. If the timer expires, all orders are cancelled and then the timer remains disabled until the client provides a new (non-zero) timeout. + + The recommended use is to make a call every 15 to 30 seconds, providing a timeout of 60 seconds. This allows the client to keep the orders in place in case of a brief disconnection or transient delay, while keeping them safe in case of a network breakdown. It is also recommended to disable the timer ahead of regularly scheduled trading engine maintenance (if the timer is enabled, all orders will be cancelled when the trading engine comes back from downtime - planned or otherwise). + + **API Key Permissions Required:** `Orders and trades - Create & modify orders` or `Orders and trades - Cancel & close orders` + requestBody: + required: true + content: + application/json: + schema: + required: + - nonce + - timeout + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + timeout: + type: integer + description: Duration (in seconds) to set/extend the timer, it should be less than 86400 seconds. + + example: + nonce: 1695828490 + timeout: 120 + responses: + "200": + description: Dead man's switch timer reset or disabled. + content: + application/json: + schema: + type: object + properties: + result: + type: object + properties: + currentTime: + description: Timestamp (RFC3339 format) at which the request was received + type: string + triggerTime: + description: Timestamp (RFC3339 format) after which all orders will be cancelled, unless the timer is extended or disabled + type: string + error: + # type: array + # items: + $ref: "schemas/objects/errors/error.yaml" + example: + { + "error": [], + "result": + { + "currentTime": "2023-03-24T17:41:56Z", + "triggerTime": "2023-03-24T17:42:56Z", + }, + } + + + /private/GetWebSocketsToken: + post: + summary: Get Websockets Token + description: | + An authentication token must be requested via this REST API endpoint in order to connect to and authenticate with our [Websockets API](../guides/spot-ws-auth). The token should be used within 15 minutes of creation, but it does not expire once a successful Websockets connection and private subscription has been made and is maintained. + + **API Key Permissions Required:** `WebSocket interface - On` + tags: + - Trading + operationId: getWebsocketsToken + requestBody: + $ref: "./schemas/requests/nonceOnly.yaml" + + responses: + "200": + description: Websockets token retrieved. + content: + application/json: + schema: + type: object + properties: + result: + # title: ServerTime + type: object + properties: + token: + description: Websockets token + type: string + expires: + description: Time (in seconds) after which the token expires + type: integer + error: + # type: array + # items: + $ref: "schemas/objects/errors/error.yaml" + example: + { + "error": [], + "result": + { + "token": "1Dwc4lzSwNWOAwkMdqhssNNFhs1ed606d1WcF3XfEMw", + "expires": 900, + }, + } + + + /private/AddOrderBatch: + post: + summary: Add Order Batch + description: | + Sends a collection of orders (minimum of 2 and maximum 15): + * Validation is performed on the whole batch prior to submission to the engine. If an order fails validation, the whole batch will be rejected. + * On submission to the engine, if an order fails pre-match checks (i.e. funding), then the individual order will be rejected and remainder of the batch will be processed. + * All orders in batch are limited to a single pair. + + **Note**: See the [AssetPairs](/docs/rest-api/get-tradable-asset-pairs) endpoint for details on the available trading pairs, their price and quantity precisions, order minimums, available leverage, etc. + + **API Key Permissions Required:** `Orders and trades - Create & modify orders` and `Orders and trades - Cancel & close orders` + + tags: + - Trading + operationId: addOrderBatch + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/trading/orders/batchadd.yaml" + responses: + "200": + description: The order of returned `orders` in the response array is the same as the order of the order list sent in request. + content: + application/json: + schema: + $ref: "./schemas/responses/trading/orders/batchadd.yaml" + examples: + Limits, one with conditional stop-loss: + value: + $ref: "./examples/responses/trading/orders/batchadd.yaml" + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/CancelOrderBatch: + post: + summary: Cancel Order Batch + description: | + Cancel multiple open orders by `txid`, `userref` or `cl_ord_id`(maximum 50 total unique IDs/references) + + **API Key Permissions Required:** `Orders and trades - Create & modify orders` or `Orders and trades - Cancel & close orders` + tags: + - Trading + operationId: cancelOrderBatch + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/trading/orders/batchcancel.yaml" + + responses: + "200": + description: Open order cancelled. + content: + application/json: + example: + $ref: "./examples/responses/trading/orders/batchcancel.yaml" + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/EditOrder: + post: + summary: Edit Order + description: | + Sends a request to edit the order parameters of a live order. When an order has been successfully modified, the original order will be cancelled and a new order will be + created with the adjusted parameters a new `txid` will be returned in the response. + + :::note + The new [AmendOrder](/docs/rest-api/amend-order) endpoint resolves the caveats listed below and has additional performance gains. + + There are a number of caveats for `EditOrder`: + * triggered stop loss or profit take profit orders are not supported. + * orders with conditional close terms attached are not supported. + * orders where the executed volume is greater than the newly supplied volume will be rejected. + * `cl_ord_id` is not supported. + * existing executions will are associated with the original order and not copied to the amended order. + * queue position will not be maintained. + ::: + + **API Key Permissions Required:** `Orders and trades - Create & modify orders` and `Orders and trades - Cancel & close orders` + tags: + - Trading + operationId: editOrder + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/trading/orders/edit.yaml" + responses: + "200": + description: Order edited. + content: + application/json: + schema: + $ref: "./schemas/responses/trading/orders/edit.yaml" + examples: + Limit with conditional stop-loss: + value: + $ref: "./examples/responses/trading/orders/edit.yaml" + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/DepositMethods: + post: + summary: Get Deposit Methods + description: | + Retrieve methods available for depositing a particular asset. + + **API Key Permissions Required:** `Funds permissions - Query` and `Funds permissions - Deposit` + tags: + - Funding + operationId: getDepositMethods + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/funding/deposits/methods.yaml" + + responses: + "200": + description: Deposit methods retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/funding/deposits/methods.yaml" + + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/DepositAddresses: + post: + summary: Get Deposit Addresses + description: | + Retrieve (or generate a new) deposit addresses for a particular asset and method. + + **API Key Permissions Required:** `Funds permissions - Query` + tags: + - Funding + operationId: getDepositAddresses + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/funding/deposits/addresses.yaml" + + responses: + "200": + description: Deposit addresses retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/funding/deposits/addresses.yaml" + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/DepositStatus: + post: + summary: Get Status of Recent Deposits + description: | + Retrieve information about recent deposits. Results are sorted by recency, use the `cursor` parameter to iterate through list of deposits (page size equal to value of `limit`) from newest to oldest. + **API Key Permissions Required:** `Funds permissions - Query` + tags: + - Funding + operationId: getStatusRecentDeposits + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/funding/deposits/recent.yaml" + + responses: + "200": + description: Recent deposits retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/funding/deposits/recent.yaml" + + # '500': + # $ref: './partials/responses/500.yaml' + + + /private/WithdrawMethods: + post: + summary: Get Withdrawal Methods + description: | + Retrieve a list of withdrawal methods available for the user. + + **API Key Permissions Required:** `Funds permissions - Query` and `Funds permissions - Withdraw` + tags: + - Funding + operationId: getWithdrawalMethods + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/funding/withdrawals/methods.yaml" + responses: + "200": + description: Withdrawal methods retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/funding/withdrawals/methods.yaml" + + + /private/WithdrawAddresses: + post: + summary: Get Withdrawal Addresses + description: | + Retrieve a list of withdrawal addresses available for the user. + + **API Key Permissions Required:** `Funds permissions - Query` and `Funds permissions - Withdraw` + tags: + - Funding + operationId: getWithdrawalAddresses + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/funding/withdrawals/addresses.yaml" + responses: + "200": + description: Withdrawal addresses retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/funding/withdrawals/addresses.yaml" + + + /private/WithdrawInfo: + post: + summary: Get Withdrawal Information + description: | + Retrieve fee information about potential withdrawals for a particular asset, key and amount. + + **API Key Permissions Required:** `Funds permissions - Query` and `Funds permissions - Withdraw` + tags: + - Funding + operationId: getWithdrawalInformation + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/funding/withdrawals/info.yaml" + + responses: + "200": + description: Withdrawal information retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/funding/withdrawals/info.yaml" + + + /private/Withdraw: + post: + summary: Withdraw Funds + description: | + Make a withdrawal request. + + **API Key Permissions Required:** `Funds permissions - Withdraw` + tags: + - Funding + operationId: withdrawFunds + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/funding/withdrawals/withdrawal.yaml" + + responses: + "200": + description: Withdrawal created. + content: + application/json: + schema: + $ref: "./schemas/responses/funding/withdrawals/withdrawal.yaml" + + + /private/WithdrawStatus: + post: + summary: Get Status of Recent Withdrawals + description: | + Retrieve information about recent withdrawals. Results are sorted by recency, use the `cursor` parameter to iterate through list of withdrawals (page size equal to value of `limit`) from newest to oldest. + + **API Key Permissions Required:** `Funds permissions - Withdraw` or `Data - Query ledger entries` + tags: + - Funding + operationId: getStatusRecentWithdrawals + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/funding/withdrawals/recent.yaml" + + responses: + "200": + description: Recent withdrawals retrieved. + content: + application/json: + schema: + $ref: "./schemas/responses/funding/withdrawals/recent.yaml" + + + /private/WithdrawCancel: + post: + summary: Request Withdrawal Cancellation + description: | + Cancel a recently requested withdrawal, if it has not already been successfully processed. + + **API Key Permissions Required:** `Funds permissions - Withdraw`, unless withdrawal is a `WalletTransfer`, then no permissions are required. + tags: + - Funding + operationId: cancelWithdrawal + requestBody: + required: true + content: + application/json: + schema: + $ref: "./schemas/requests/funding/withdrawals/cancel.yaml" + + + responses: + "200": + description: Withdrawal cancellation requested. + content: + application/json: + schema: + properties: + result: + type: boolean + description: Whether cancellation was successful or not. + error: + $ref: "./schemas/objects/errors/error.yaml" + example: { "error": [], "result": true } + + + /private/WalletTransfer: + post: + summary: Request Wallet Transfer + description: | + Transfer from a Kraken spot wallet to a Kraken Futures wallet. Note that a transfer in the other direction must be requested via the Kraken Futures API endpoint for [withdrawals to Spot wallets](../futures-api/trading/withdrawal). + + **API Key Permissions Required:** `Funds permissions - Query` + tags: + - Funding + operationId: walletTransfer + requestBody: + required: true + content: + application/json: + schema: + required: + - nonce + - asset + - from + - to + - amount + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + asset: + type: string + description: Asset to transfer (asset ID or `altname`) + example: XBT + from: + type: string + description: Source wallet + enum: + - Spot Wallet + to: + type: string + description: Destination wallet + enum: + - Futures Wallet + amount: + type: string + description: Amount to transfer + example: + nonce: 1695828271 + asset: "XBT" + from: "Spot Wallet" + to: "Futures Wallet" + amount: "2.54" + + responses: + "200": + description: Transfer created. + content: + application/json: + schema: + properties: + result: + type: object + properties: + refid: + type: string + description: Reference ID + example: FTQcuak-V6Za8qrWnhzTx67yYHz8Tg + error: + $ref: "./schemas/objects/errors/error.yaml" + # $ref: './schemas/responses/funding/withdrawals/recent.yaml' + example: + { + "error": [], + "result": { "refid": "FTQcuak-V6Za8qrWnhzTx67yYHz8Tg" }, + } + + + /private/CreateSubaccount: + post: + summary: Create Subaccount + description: | + Create a trading subaccount. **Note:** `CreateSubaccount` must be called using an API key from the master account. + + **API Key Permissions Required:** `Funds permissions - Withdraw` + tags: + - Subaccounts + operationId: createSubaccount + requestBody: + required: true + content: + application/json: + schema: + required: + - nonce + - email + - username + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + username: + type: string + description: Username for the subaccount + email: + type: string + description: Email address for the subaccount + example: + nonce: 1695828271 + username: "abc123" + email: "abc123@gmail.com" + responses: + "200": + description: Subaccount created. + content: + application/json: + schema: + properties: + result: + type: boolean + description: Whether subaccount creation was successful or not. + error: + $ref: "./schemas/objects/errors/error.yaml" + example: { "error": [], "result": true } + + + /private/AccountTransfer: + post: + summary: Account Transfer + description: | + Transfer funds to and from master and subaccounts. **Note:** `AccountTransfer` must be called using an API key from the master account. + + **API Key Permissions Required:** `Funds permissions - Withdraw` + tags: + - Subaccounts + operationId: accountTransfer + requestBody: + required: true + content: + application/json: + schema: + required: + - nonce + - asset + - amount + - from + - to + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + asset: + type: string + description: Asset being transferred + asset_class: + description: Specify the asset class of the asset being transferred + type: string + enum: + - currency + - tokenized_asset + default: currency + amount: + type: string + description: Amount of asset to transfer + from: + type: string + description: IIBAN of the source account + to: + type: string + description: IIBAN of the destination account + + example: + nonce: 1695828271 + asset: "XBT" + from: "ABCD 1234 EFGH 5678" + to: "IJKL 0987 MNOP 6543" + amount: "2.54" + + responses: + "200": + description: Funds transferred between accounts. + content: + application/json: + schema: + properties: + result: + type: object + properties: + transfer_id: + type: string + description: Transfer ID + status: + type: string + description: Transfer status, either `"pending"` or `"complete"` + error: + $ref: "./schemas/objects/errors/error.yaml" + example: + { + "error": [], + "result": + { + "transfer_id": "TOH3AS2-LPCWR8-JDQGEU", + "status": "complete", + }, + } + + /private/Earn/Allocate: + post: + tags: + - Earn + summary: Allocate Earn Funds + description: |- + Allocate funds to the Strategy. + + Requires the `Earn Funds` API key permission. + The amount must always be defined. + + This method is asynchronous. A couple of preflight checks are + performed synchronously on behalf of the method before it is dispatched + further. The client is required to poll + the result using the `/0/private/Earn/AllocateStatus` endpoint. + + There can be only one (de)allocation request in progress for given user and + strategy at any time. While the operation is in progress: + + 1. `pending` attribute in `/Earn/Allocations` response for the strategy + indicates that funds are being allocated, + 2. `pending` attribute in `/Earn/AllocateStatus` response will be true. + + Following specific errors within `Earnings` class can be returned by this + method: + - Minimum allocation: `EEarnings:Below min:(De)allocation operation amount less than minimum` + - Allocation in progress: `EEarnings:Busy:Another (de)allocation for the same strategy is in progress` + - Service temporarily unavailable: `EEarnings:Busy`. Try again in a few minutes. + - User tier verification: `EEarnings:Permission denied:The user's tier is not high enough` + - Strategy not found: `EGeneral:Invalid arguments:Invalid strategy ID` + operationId: allocateStrategy + requestBody: + content: + application/json: + schema: + description: Allocation amount in asset specified in the strategy + type: object + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + amount: + description: The amount to allocate. + type: string + strategy_id: + description: A unique identifier of the chosen earn strategy, as returned from `/0/private/Earn/Strategies`. + type: string + required: + - amount + - nonce + - strategy_id + example: + amount: "4.3" + nonce: 30295839 + strategy_id: ESRFUO3-Q62XD-WIOIL7 + required: true + responses: + "200": + description: Response + content: + application/json: + schema: + type: object + properties: + error: + $ref: "./schemas/objects/errors/error.yaml" + result: + description: Will return `true` when the operation is successful, null when an error occurred. + nullable: true + type: boolean + example: { "error": [], "result": true } + + /private/Earn/Deallocate: + post: + tags: + - Earn + summary: Deallocate Earn Funds + description: |- + Deallocate funds from a strategy. + + Requires the `Earn Funds` API key permission. + The amount must always be defined. + + This method is asynchronous. A couple of preflight checks are + performed synchronously on behalf of the method before it is dispatched + further. If the method returns HTTP 202 code, the client is required to poll + the result using the `/Earn/DeallocateStatus` endpoint. + + There can be only one (de)allocation request in progress for given user and + strategy. While the operation is in progress: + + 1. `pending` attribute in `Allocations` response for the strategy will hold + the amount that is being deallocated (negative amount) + 2. `pending` attribute in `DeallocateStatus` response will be true. + + Following specific errors within `Earnings` class can be returned by this + method: + - Minimum allocation: `EEarnings:Below min:(De)allocation operation amount less than minimum` + allowed + - Allocation in progress: `EEarnings:Busy:Another (de)allocation for the same strategy is in progress` + - Strategy not found: `EGeneral:Invalid arguments:Invalid strategy ID` + operationId: deallocateStrategy + requestBody: + content: + application/json: + schema: + description: Allocation amount in asset specified in the strategy + type: object + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + amount: + description: The amount to deallocate. This field is required. + type: string + strategy_id: + description: A unique identifier per earn strategy. + type: string + required: + - amount + - nonce + - strategy_id + example: + amount: "4.3" + nonce: 30295839 + strategy_id: ESRFUO3-Q62XD-WIOIL7 + required: true + responses: + "200": + description: Response + content: + application/json: + schema: + type: object + properties: + error: + $ref: "./schemas/objects/errors/error.yaml" + result: + description: Will return `true` when the operation is successful, null when an error occurred. + nullable: true + type: boolean + example: { "error": [], "result": true } + + /private/Earn/AllocateStatus: + post: + tags: + - Earn + summary: Get Allocation Status + description: |- + Get the status of the last allocation request. + + Requires either the `Earn Funds` or `Query Funds` API key permission. + + (De)allocation operations are asynchronous and this endpoint allows client + to retrieve the status of the last dispatched operation. There can be only + one (de)allocation request in progress for given user and strategy. + + The `pending` attribute in the response indicates if the previously + dispatched operation is still in progress (true) or has successfully + completed (false). If the dispatched request failed with an error, then + HTTP error is returned to the client as if it belonged to the original + request. + + Following specific errors within `Earnings` class can be returned by this + method: + - Insufficient funds: `EEarnings:Insufficient funds:Insufficient funds to complete the (de)allocation request` + - User cap exceeded: `EEarnings:Above max:The allocation exceeds user limit for the strategy` + - Total cap exceeded: `EEarnings:Above max:The allocation exceeds the total strategy limit` + - Minimum allocation: `EEarnings:Below min:(De)allocation operation amount less than minimum` + operationId: getAllocateStrategyStatus + requestBody: + content: + application/json: + schema: + type: object + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + strategy_id: + description: ID of the earn strategy, call `Earn/Strategies` to list available strategies + type: string + required: + - nonce + - strategy_id + example: + nonce: 30295839 + strategy_id: ESRFUO3-Q62XD-WIOIL7 + required: true + responses: + "200": + description: Response + content: + application/json: + schema: + type: object + properties: + error: + $ref: "./schemas/objects/errors/error.yaml" + result: + nullable: true + description: Status of async earn operation + type: object + properties: + pending: + description: "`true` if an operation is still in progress on the same strategy." + type: boolean + example: { "error": [], "result": { "pending": false } } + + /private/Earn/DeallocateStatus: + post: + tags: + - Earn + summary: Get Deallocation Status + description: |- + Get the status of the last deallocation request. + + Requires either the `Earn Funds` or `Query Funds` API key permission. + + (De)allocation operations are asynchronous and this endpoint allows client + to retrieve the status of the last dispatched operation. There can be only + one (de)allocation request in progress for given user and strategy. + + The `pending` attribute in the response indicates if the previously + dispatched operation is still in progress (true) or has successfully + completed (false). If the dispatched request failed with an error, then + HTTP error is returned to the client as if it belonged to the original + request. + + Following specific errors within `Earnings` class can be returned by this + method: + - Insufficient funds: `EEarnings:Insufficient funds:Insufficient funds to complete the (de)allocation request` + - Minimum allocation: `EEarnings:Below min:(De)allocation operation amount less than minimum` + operationId: getDeallocateStrategyStatus + requestBody: + content: + application/json: + schema: + type: object + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + strategy_id: + description: ID of the earn strategy, call `Earn/Strategies` to list available strategies + type: string + required: + - nonce + - strategy_id + example: + nonce: 30295839 + strategy_id: ESRFUO3-Q62XD-WIOIL7 + required: true + responses: + "200": + description: Response + content: + application/json: + schema: + type: object + properties: + error: + $ref: "./schemas/objects/errors/error.yaml" + result: + nullable: true + description: Status of async earn operation + type: object + properties: + pending: + description: "`true` if an operation is still in progress on the same strategy." + type: boolean + example: { "error": [], "result": { "pending": false } } + + /private/Earn/Strategies: + post: + tags: + - Earn + summary: List Earn Strategies + description: |- + List earn strategies along with their parameters. + + Requires a valid API key but not specific permission is required. + + Returns only strategies that are available to the user + based on geographic region. + + When the user does not meet the tier restriction, `can_allocate` will be + false and `allocation_restriction_info` indicates `Tier` as the restriction + reason. Earn products generally require Intermediate tier. Get your account verified + to access earn. + + A note about `lock_type`: + - `instant`: can be deallocated without an unbonding period. This is called flexible in the UI. + - `bonded`: has an unbonding period. Deallocation will not happen until this period has passed. + - `flex`: "Kraken rewards". This is earning on your spot balances where eligible. It's turned on account wide + from the UI and you cannot manually allocate to these strategies. + + Paging isn't yet implemented, so the endpoint always returns all + data in the first page. + operationId: listStrategies + requestBody: + content: + application/json: + schema: + description: List strategies parameters + type: object + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + ascending: + nullable: true + description: "`true` to sort ascending, `false` (the default) for descending." + type: boolean + asset: + nullable: true + description: Filter strategies by asset name + type: string + cursor: + nullable: true + description: None to start at beginning/end, otherwise next page ID + type: string + limit: + nullable: true + description: How many items to return per page. Note that the limit may be cap'd to lower value in the application code. + type: integer + format: uint16 + lock_type: + nullable: true + description: Filter strategies by lock type + type: array + items: + description: Type of a strategy + type: string + enum: + - flex + - bonded + - timed + - instant + required: + - nonce + example: + nonce: 30295839 + asset: DOT + required: true + responses: + "200": + description: Response + content: + application/json: + schema: + type: object + properties: + error: + $ref: "./schemas/objects/errors/error.yaml" + result: + nullable: true + type: object + properties: + items: + type: array + items: + description: Parameters for a single strategy + type: object + properties: + allocation_fee: + description: Fee applied when allocating to this strategy + oneOf: + - type: string + title: string + - type: integer + title: integer + - type: number + title: number + allocation_restriction_info: + description: Reason list why user is not eligible for allocating to the strategy + type: array + items: + description: Recoverable strategy restriction reasons, which are no preventing strategy from being returned by [`ListStrategiesResponse`]. + type: string + enum: + - tier + apr_estimate: + nullable: true + description: The estimate is based on previous revenues from the strategy. Optional hint, not always present. + type: object + properties: + high: + description: Maximal yield percentage for one year + type: string + low: + description: Minimal yield percentage for one year + type: string + asset: + description: The asset to invest for this earn strategy + type: string + auto_compound: + description: Auto compound choices for the earn strategy + oneOf: + - description: Auto compound is not possible for any allocation + type: object + properties: + type: + type: string + enum: + - disabled + - description: Auto compound is forced for all allocations + type: object + properties: + type: + type: string + enum: + - enabled + - description: Auto compound depends on user's preference and it comes with default value + type: object + properties: + default: + type: boolean + type: + type: string + enum: + - optional + can_allocate: + description: Is allocation available for this strategy + type: boolean + can_deallocate: + description: Is deallocation available for this strategy + type: boolean + deallocation_fee: + description: Fee applied when deallocating from this strategy + oneOf: + - type: string + - type: integer + - type: number + id: + description: The unique identifier for this strategy + type: string + lock_type: + description: Type of the strategy + oneOf: + - description: Either the whole asset balance or part of it is allocated to earn strategy and users are free to deallocate it anytime and most importantly the deallocation can be implicit (triggered by a trade, withdrawal from exchange, etc.). + type: object + properties: + type: + type: string + enum: + - flex + - description: Explicit allocate and deallocate action by user is required and bonding/unbonding parameters apply. + type: object + properties: + bonding_period: + description: Duration of the bonding period, in seconds + type: integer + bonding_period_variable: + description: Is the bonding period length variable (`true`) or static (`false`) + type: boolean + bonding_rewards: + description: Whether rewards are earned during the bonding period (payouts occur after bonding is complete) + type: boolean + exit_queue_period: + description: |- + In order to remove funds, if this value is greater than 0, funds will first have to enter an exit queue and will have to wait for the exit queue period to end. Once ended, her funds will then follow and respect the `unbonding_period`. + + If the value of the exit queue period is 0, then no waiting will have to occur and the exit queue will be skipped + + Rewards are always paid out for the exit queue + type: integer + payout_frequency: + description: At what intervals are rewards distributed and credited to the user’s ledger, in seconds + type: integer + type: + type: string + enum: + - bonded + unbonding_period: + description: Duration of the unbonding period in seconds. In order to remove funds, you must wait for the unbonding period to pass after requesting removal before funds become available in her spot wallet + type: integer + unbonding_period_variable: + description: Is the unbonding period length variable (`true`) or static (`false`) + type: boolean + unbonding_rewards: + description: Whether rewards are earned and payouts are done during the unbonding period + type: boolean + - description: Instant strategy lock type is a special case of bonded strategy with no bonding/unbonding period. It is equivalent of what used to be called "flex" in legacy staking system (not to be confused with Flex defined above). Explicit allocate/deallocate action is required. + type: object + properties: + payout_frequency: + description: At what intervals are rewards distributed and credited to the user’s ledger, in seconds + type: integer + type: + type: string + enum: + - instant + user_cap: + nullable: true + type: "string" + description: The maximum amount of funds that any given user may allocate to an account. Absence of value means there is no limit. Zero means that all new allocations will return an error (though auto-compound is unaffected). + user_min_allocation: + nullable: true + type: "string" + description: Minimum amount (in USD) for an allocation or deallocation. Absence means no minimum. + yield_source: + description: Yield generation mechanism of this strategy + oneOf: + - description: Funds are staked on-chain, PoS is the source of yield. + type: object + properties: + type: + type: string + enum: + - staking + - description: Funds are put at work in another yield-generation financial mechanism. + type: object + properties: + type: + type: string + enum: + - off_chain + next_cursor: + nullable: true + description: index to send into PageRequest for next page, None means you've reached the end. + type: string + example: + error: [] + result: + next_cursor: "2" + items: + - id: ESRFUO3-Q62XD-WIOIL7 + asset: DOT + lock_type: + type: instant + payout_frequency: 604800 + apr_estimate: + low: "8.0000" + high: "12.0000" + user_min_allocation: "0.01" + allocation_fee: "0.0000" + deallocation_fee: "0.0000" + auto_compound: + type: enabled + yield_source: + type: staking + can_allocate: true + can_deallocate: true + allocation_restriction_info: [] + + /private/Earn/Allocations: + post: + tags: + - Earn + summary: List Earn Allocations + description: |- + List all allocations for the user. + + Requires the `Query Funds` API key permission. + + By default all allocations are returned, even for strategies that have been + used in the past and have zero balance now. That is so that the user can see + how much was earned with given strategy in the past. + `hide_zero_allocations` parameter can be used to remove zero balance entries + from the output. Paging hasn't been implemented for this method as we don't + expect the result for a particular user to be overwhelmingly large. + + All amounts in the output can be denominated in a currency of user's choice + (the `converted_asset` parameter). + + Information about when the next reward will be paid to the client is also + provided in the output. + + Allocated funds can be in up to 4 states: + - bonding + - allocated + - exit_queue (ETH only) + - unbonding + + Any funds in `total` not in `bonding`/`unbonding` are simply allocated and + earning rewards. Depending on the strategy funds in the other 3 states can + also be earning rewards. Consult the output of `/Earn/Strategies` to know + whether `bonding`/`unbonding` earn rewards. `ETH` in `exit_queue` still + earns rewards. + + Note that for `ETH`, when the funds are in the `exit_queue` state, the + `expires` time given is the time when the funds will have finished + unbonding, not when they go from exit queue to unbonding. + + (Un)bonding time estimate can be inaccurate right after having (de)allocated the + funds. Wait 1-2 minutes after (de)allocating to get an accurate result. + operationId: listAllocations + requestBody: + content: + application/json: + schema: + description: Page request + type: object + properties: + nonce: + $ref: "./partials/properties/nonce.yaml" + ascending: + nullable: true + description: "`true` to sort ascending, `false` (the default) for descending." + type: boolean + converted_asset: + nullable: true + description: A secondary currency to express the value of your allocations (the default is USD). + type: string + hide_zero_allocations: + nullable: true + description: Omit entries for strategies that were used in the past but now they don't hold any allocation (the default is `false`) + type: boolean + required: + - nonce + example: + nonce: 30295839 + converted_asset: "EUR" + hide_zero_allocations: true + required: true + responses: + "200": + description: Response + content: + application/json: + schema: + type: object + properties: + error: + $ref: "./schemas/objects/errors/error.yaml" + result: + nullable: true + description: Page response + type: object + properties: + converted_asset: + description: |- + A secondary asset to show the value of allocations. (Eg. you also want to + see the value of your allocations in USD). Choose this in the request + parameters. + type: string + items: + type: array + items: + type: object + properties: + amount_allocated: + description: Amounts allocated to this Earn strategy + type: object + properties: + bonding: + nullable: true + description: Amount allocated in bonding status. Only present when there are bonding allocations. + type: object + properties: + allocation_count: + description: The total number of allocations in this state for this asset + type: integer + format: uint + allocations: + description: Details about when each allocation will expire and move to the next state + type: array + items: + description: Additional information about the allocation describing the amount contained within the allocation and when it will transition to the next state + type: object + properties: + converted: + description: Amount converted into the requested asset + type: string + created_at: + description: |- + The date and time which a request to either allocate was received and + the funds started bonding. + type: string + format: date-time + expires: + description: The date at which the `Bonded` allocation will move to the `Earning` state. + type: string + format: date-time + native: + description: Amount in the native asset + type: string + converted: + description: Amount converted into the requested asset + type: string + native: + description: Amount in the native asset + type: string + exit_queue: + nullable: true + description: Amount allocated in the exit-queue status. Only present when there are exit_queue allocations. + type: object + properties: + allocation_count: + description: The total number of allocations in this state for this asset + type: integer + format: uint + allocations: + description: Details about when each allocation will expire and move to the next state + type: array + items: + description: Additional information about the allocation describing the amount contained within the allocation and when it will transition to the next state + type: object + properties: + converted: + description: Amount converted into the requested asset + type: string + created_at: + description: |- + The date and time which a request to deallocate was received and processed. + For a deallocation request to a strategy with an `exit-queue`, this will be the time the funds joined the exit queue. + type: string + format: date-time + expires: + description: The date/time when the funds will be unbonded. + type: string + format: date-time + native: + description: Amount in the native asset + type: string + converted: + description: Amount converted into the requested asset + type: string + native: + description: Amount in the native asset + type: string + pending: + nullable: true + description: Pending allocation amount - can be negative if the pending operation is deallocation. Only present when there are pending allocations. + type: object + properties: + converted: + description: Amount converted into the requested asset + type: string + native: + description: Amount in the native asset + type: string + total: + description: Total amount allocated to this Earn strategy + type: object + properties: + converted: + description: Amount converted into the requested asset + type: string + native: + description: Amount in the native asset + type: string + unbonding: + nullable: true + description: Amount allocated in unbonding status. Only present when there are unbonding allocations. + type: object + properties: + allocation_count: + description: The total number of allocations in this state for this asset + type: integer + format: uint + allocations: + description: Details about when each allocation will expire and move to the next state + type: array + items: + description: Additional information about the allocation describing the amount contained within the allocation and when it will transition to the next state + type: object + properties: + converted: + description: Amount converted into the requested asset + type: string + created_at: + description: |- + The date and time which a request to either allocate or deallocate was received and processed. + + For a deallocation request to a strategy with an `exit-queue`, this will be the time the funds joined the exit queue. For a deallocation request to a strategy without exit queue, this will be the time the funds started unbonding + type: string + format: date-time + expires: + description: The date/time the funds will be unbonded. + type: string + format: date-time + native: + description: Amount in the native asset + type: string + converted: + description: Amount converted into the requested asset + type: string + native: + description: Amount in the native asset + type: string + native_asset: + description: The asset of the native currency of this allocation + type: string + payout: + nullable: true + description: Information about the current payout period, absent if when there is no current payout period. + type: object + properties: + accumulated_reward: + description: Reward accumulated in the payout period until now + type: object + properties: + converted: + description: Amount converted into the requested asset + type: string + native: + description: Amount in the native asset + type: string + estimated_reward: + description: Estimated reward from now until the payout + type: object + properties: + converted: + description: Amount converted into the requested asset + type: string + native: + description: Amount in the native asset + type: string + period_end: + description: Tentative date of the next reward payout. + type: string + format: date-time + period_start: + description: When the current payout period started. Either the date of the last payout or when it was enabled. + type: string + format: date-time + strategy_id: + description: Unique ID for Earn Strategy + type: string + total_rewarded: + description: Amount earned using the strategy during the whole lifetime of user account + type: object + properties: + converted: + description: Amount converted into the requested asset + type: string + native: + description: Amount in the native asset + type: string + total_allocated: + description: The total amount allocated across all strategies, denominated in the `converted_asset` currency + type: string + total_rewarded: + description: Amount earned across all strategies during the whole lifetime of user account, denominated in `converted_asset` currency + type: string + example: + error: [] + result: + converted_asset: USD + total_allocated: "49.2398" + total_rewarded: "0.0675" + next_cursor: "2" + items: + - strategy_id: ESDQCOL-WTZEU-NU55QF + native_asset: ETH + amount_allocated: + bonding: + native: "0.0210000000" + converted: "39.0645" + allocation_count: 2 + allocations: + - created_at: "2023-07-06T10:52:05Z" + expires: "2023-08-19T02:34:05.807Z" + native: "0.0010000000" + converted: "1.8602" + - created_at: "2023-08-01T11:25:52Z" + expires: "2023-09-06T07:55:52.648Z" + native: "0.0200000000" + converted: "37.2043" + total: + native: "0.0210000000" + converted: "39.0645" + total_rewarded: + native: "0" + converted: "0.0000" + +components: + securitySchemes: + API-Key: + type: apiKey + description: The "API-Key" header should contain your API key. + name: API-Key + in: header + + API-Sign: + type: apiKey + description: Authenticated requests should be signed with the "API-Sign" header, using a signature generated with your private key, nonce, encoded payload, and URI path. + name: API-Sign + in: header + +security: + - API-Key: [] + API-Sign: [] + +tags: + - name: Market Data + - name: Account Data + - name: Trading + - name: Funding + - name: Subaccounts + description: Subaccounts are currently only available to institutional clients. Please contact your Account Manager for more details. + - name: Earn + description: | + The earn API allows interacting with all of Kraken's yield generating products. It replaces the old `/staking` part of the API. + + The different available earn products are represented by earn strategies. This corresponds to the legacy `Staking/Assets`. `Stake`/`Unstake` are replaced by `Allocate`/`Deallocate`. + + ### Overview of the available endpoints under `/Earn`: + + - `Strategies` - list all earn strategies for which you are eligible or have a balance. + - `Allocations` - lists the balance in your earn account for each strategy. Requires the `Query Funds` API key permission. + - `Allocate`/`Deallocate` - allocate/deallocate to an earn strategy through an async operation. Requires the `Earn Funds` API key permission. + - `AllocateStatus`/`DeallocateStatus` - verifies the state of the last allocation/deallocation. Requires the `Earn Funds` or `Query Funds` API key permission. + + ### Example usage: + + ### Determine which funds are earning rewards: + + 1. Call `Strategies` to obtain information about the relevant strategy. The `lock_type` field shows whether bonding/unbonding funds are earning yield. The relevant fields are `bonding_rewards`/`unbonding_rewards`. + 2. Call `Allocations` for the relevant strategy. From the previous step, for strategies where bonding/unbonding does not earn yield, substract these balances from `amount_allocated.total` to determine which balances are currently earning. + + ### Get allocatable balance: + + Call `/0/private/BalanceEx`, subtract `hold_trading` amount. Remaining balance is available for allocation to a strategy. + + ### Geo restrictions: + + Some earn strategies are not available in all geographic regions. `Strategies` will return only strategies available to the caller. + +x-tagGroups: + - name: Public Endpoints + tags: + - Market Data + + - name: Authenticated Endpoints + tags: + - Account Data + - Trading + - Funding + - Subaccounts + - Earn + + diff --git a/spot-rest/partials/parameters/query/aclass.yaml b/spot-rest/partials/parameters/query/aclass.yaml new file mode 100644 index 0000000..1fa0171 --- /dev/null +++ b/spot-rest/partials/parameters/query/aclass.yaml @@ -0,0 +1,12 @@ +in: query +name: aclass +schema: + type: string + enum: + - currency + - tokenized_asset + default: currency +description: | + Filters the asset class to retrieve (optional) + * `currency` = spot currency pairs. + * `tokenized_asset` = xstocks. \ No newline at end of file diff --git a/spot-rest/partials/parameters/query/asset.yaml b/spot-rest/partials/parameters/query/asset.yaml new file mode 100644 index 0000000..1e775a9 --- /dev/null +++ b/spot-rest/partials/parameters/query/asset.yaml @@ -0,0 +1,6 @@ +in: query +name: asset +schema: + type: string +description: Comma delimited list of assets to get info on (optional, default all available assets) +example: XBT,ETH diff --git a/spot-rest/partials/parameters/query/asset_class.yaml b/spot-rest/partials/parameters/query/asset_class.yaml new file mode 100644 index 0000000..7074654 --- /dev/null +++ b/spot-rest/partials/parameters/query/asset_class.yaml @@ -0,0 +1,8 @@ +name: asset_class +in: query +description: This parameter is required on requests for non-crypto pairs, i.e. use `tokenized_asset` for xstocks. +required: false +schema: + type: string + enum: + - tokenized_asset diff --git a/spot-rest/partials/parameters/query/pair.yaml b/spot-rest/partials/parameters/query/pair.yaml new file mode 100644 index 0000000..d390b68 --- /dev/null +++ b/spot-rest/partials/parameters/query/pair.yaml @@ -0,0 +1,7 @@ +in: query +name: pair +description: Asset pair to get data for +required: true +schema: + type: string +example: XBTUSD diff --git a/spot-rest/partials/parameters/query/user_iiban.yaml b/spot-rest/partials/parameters/query/user_iiban.yaml new file mode 100644 index 0000000..22edd98 --- /dev/null +++ b/spot-rest/partials/parameters/query/user_iiban.yaml @@ -0,0 +1,9 @@ +name: user_iiban +description: Applies the request to the specified user / subaccount. Available to master account holders only. +in: query +example: AA96N74GCGEFN8KI +schema: + type: string + format: Kraken user identifier + minLength: 16 + maxLength: 16 \ No newline at end of file diff --git a/spot-rest/partials/parameters/query/wildcard_pair.yaml b/spot-rest/partials/parameters/query/wildcard_pair.yaml new file mode 100644 index 0000000..ca94663 --- /dev/null +++ b/spot-rest/partials/parameters/query/wildcard_pair.yaml @@ -0,0 +1,7 @@ +in: query +name: pair +description: "Asset pair to get data for (optional, default: all tradeable exchange pairs)" +required: false +schema: + type: string +example: XBTUSD diff --git a/spot-rest/partials/properties/nonce.yaml b/spot-rest/partials/properties/nonce.yaml new file mode 100644 index 0000000..1f92c60 --- /dev/null +++ b/spot-rest/partials/properties/nonce.yaml @@ -0,0 +1,3 @@ +description: "Nonce used in construction of `API-Sign` header" +type: integer +format: int64 diff --git a/spot-rest/partials/properties/oflags.yaml b/spot-rest/partials/properties/oflags.yaml new file mode 100644 index 0000000..a2838dd --- /dev/null +++ b/spot-rest/partials/properties/oflags.yaml @@ -0,0 +1,11 @@ +description: | + Comma delimited list of order flags + + * • `post` post-only order (available when ordertype = limit) + * • `fcib` prefer fee in base currency (default if selling) + * • `fciq` prefer fee in quote currency (default if buying, mutually exclusive with `fcib`) + * • `nompp` disable [market price protection](https://support.kraken.com/hc/en-us/articles/201648183-Market-Price-Protection) for market orders + * • `viqc` order volume expressed in quote currency. This option is supported only for buy market orders. Also not available on margin orders. + +type: string +example: "post" diff --git a/spot-rest/partials/properties/ordertype.yaml b/spot-rest/partials/properties/ordertype.yaml new file mode 100644 index 0000000..0b205f2 --- /dev/null +++ b/spot-rest/partials/properties/ordertype.yaml @@ -0,0 +1,15 @@ +description: | + The execution model of the order. +type: string +enum: + - market + - limit + - iceberg + - stop-loss + - take-profit + - stop-loss-limit + - take-profit-limit + - trailing-stop + - trailing-stop-limit + - settle-position +example: "limit" diff --git a/spot-rest/partials/properties/rebase_multiplier.yaml b/spot-rest/partials/properties/rebase_multiplier.yaml new file mode 100644 index 0000000..cf5d4f2 --- /dev/null +++ b/spot-rest/partials/properties/rebase_multiplier.yaml @@ -0,0 +1,10 @@ +type: string +enum: + - rebased + - base +default: rebased +nullable: true +description: | + Optional parameter for viewing xstocks data. + - `rebased`: Display in terms of underlying equity. + - `base`: Display in terms of SPV tokens. diff --git a/spot-rest/partials/responses/200.yaml b/spot-rest/partials/responses/200.yaml new file mode 100644 index 0000000..35c58c7 --- /dev/null +++ b/spot-rest/partials/responses/200.yaml @@ -0,0 +1,8 @@ +description: Success response +content: + application/json: + schema: + $ref: '../../schemas/responses/200.yaml' + example: + result: true + errors: [] diff --git a/spot-rest/partials/responses/401.yaml b/spot-rest/partials/responses/401.yaml new file mode 100644 index 0000000..95ce091 --- /dev/null +++ b/spot-rest/partials/responses/401.yaml @@ -0,0 +1,12 @@ +description: Authorization information is missing or invalid +content: + application/json: + schema: + $ref: '../../schemas/responses/401.yaml' + examples: + Invalid API Key: + $ref: '../../examples/responses/errors/invalidApiKey.yaml' + Invalid API Signature: + $ref: '../../examples/responses/errors/invalidApiSignature.yaml' + Invalid API Nonce: + $ref: '../../examples/responses/errors/invalidApiNonce.yaml' diff --git a/spot-rest/partials/responses/500.yaml b/spot-rest/partials/responses/500.yaml new file mode 100644 index 0000000..628bdc1 --- /dev/null +++ b/spot-rest/partials/responses/500.yaml @@ -0,0 +1,7 @@ +description: Internal Error +content: + application/json: + schema: + $ref: '../../schemas/responses/500.yaml' + example: + $ref: '../../examples/responses/errors/internalError.yaml' \ No newline at end of file diff --git a/spot-rest/requests/funding/deposits/addresses.yaml b/spot-rest/requests/funding/deposits/addresses.yaml new file mode 100644 index 0000000..e6cbfd2 --- /dev/null +++ b/spot-rest/requests/funding/deposits/addresses.yaml @@ -0,0 +1,50 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/DepositAddresses" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" \ + --data-urlencode "asset=XBT" \ + --data-urlencode "method=Bitcoin" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/DepositAddresses', { + "nonce": str(int(1000*time.time())), + "asset": "XBT", + "method": "Bitcoin", + "new": True + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('DepositAddresses', [ +# 'asset' => 'XBT', +# 'method' => 'Bitcoin' +# ]); diff --git a/spot-rest/requests/funding/deposits/methods.yaml b/spot-rest/requests/funding/deposits/methods.yaml new file mode 100644 index 0000000..6d398f2 --- /dev/null +++ b/spot-rest/requests/funding/deposits/methods.yaml @@ -0,0 +1,46 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/DepositMethods" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" \ + --data-urlencode "asset=XBT" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/DepositMethods', { + "nonce": str(int(1000*time.time())), + "asset": "XBT" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('DepositMethods', [ +# 'asset' => 'XBT' +# ]); diff --git a/spot-rest/requests/funding/deposits/recent.yaml b/spot-rest/requests/funding/deposits/recent.yaml new file mode 100644 index 0000000..904a987 --- /dev/null +++ b/spot-rest/requests/funding/deposits/recent.yaml @@ -0,0 +1,47 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/DepositStatus" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" \ + --data-urlencode "asset=XBT" \ + --data-urlencode "method=Bitcoin" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/DepositStatus', { + "nonce": str(int(1000*time.time())) + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('DepositStatus', [ +# 'asset' => 'XBT', +# 'method' => 'Bitcoin' +# ]); diff --git a/spot-rest/requests/funding/withdrawals/addresses.yaml b/spot-rest/requests/funding/withdrawals/addresses.yaml new file mode 100644 index 0000000..96e67b8 --- /dev/null +++ b/spot-rest/requests/funding/withdrawals/addresses.yaml @@ -0,0 +1,35 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/WithdrawAddresses" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" \ + --data-urlencode "asset=XBT" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/WithdrawAddresses', { + "nonce": str(int(1000*time.time())), + "asset": "XBT" + }, api_key, api_sec) + + print(resp.json()) diff --git a/spot-rest/requests/funding/withdrawals/info.yaml b/spot-rest/requests/funding/withdrawals/info.yaml new file mode 100644 index 0000000..0126143 --- /dev/null +++ b/spot-rest/requests/funding/withdrawals/info.yaml @@ -0,0 +1,40 @@ +# - lang: cURL + # source: | + # curl -X "POST" "https://api.kraken.com/0/private/WithdrawInfo" \ + # -H 'API-Key: ' \ + # -H 'API-Sign: ' \ + # -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + # --data-urlencode "nonce=" \ + # --data-urlencode "asset=XBT" \ + # --data-urlencode "method=Bitcoin" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/WithdrawInfo', { + "nonce": str(int(1000*time.time())), + "asset": "XBT", + "key": "btc_testnet_with1", + "amount": 0.725 + }, api_key, api_sec) + + print(resp.json()) + # '500': + # $ref: './partials/responses/500.yaml' \ No newline at end of file diff --git a/spot-rest/requests/funding/withdrawals/methods.yaml b/spot-rest/requests/funding/withdrawals/methods.yaml new file mode 100644 index 0000000..cf04614 --- /dev/null +++ b/spot-rest/requests/funding/withdrawals/methods.yaml @@ -0,0 +1,35 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/WithdrawMethods" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" \ + --data-urlencode "asset=XBT" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/WithdrawMethods', { + "nonce": str(int(1000*time.time())), + "asset": "XBT" + }, api_key, api_sec) + + print(resp.json()) diff --git a/spot-rest/requests/funding/withdrawals/recent.yaml b/spot-rest/requests/funding/withdrawals/recent.yaml new file mode 100644 index 0000000..1b895bc --- /dev/null +++ b/spot-rest/requests/funding/withdrawals/recent.yaml @@ -0,0 +1,35 @@ +# - lang: cURL + # source: | + # curl -X "POST" "https://api.kraken.com/0/private/DepositStatus" \ + # -H 'API-Key: ' \ + # -H 'API-Sign: ' \ + # -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + # --data-urlencode "nonce=" \ + # --data-urlencode "asset=XBT" \ + # --data-urlencode "method=Bitcoin" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/WithdrawStatus', { + "nonce": str(int(1000*time.time())) + }, api_key, api_sec) + + print(resp.json()) diff --git a/spot-rest/requests/funding/withdrawals/withdraw.yaml b/spot-rest/requests/funding/withdrawals/withdraw.yaml new file mode 100644 index 0000000..58d48ce --- /dev/null +++ b/spot-rest/requests/funding/withdrawals/withdraw.yaml @@ -0,0 +1,39 @@ +# - lang: cURL + # source: | + # curl -X "POST" "https://api.kraken.com/0/private/DepositStatus" \ + # -H 'API-Key: ' \ + # -H 'API-Sign: ' \ + # -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + # --data-urlencode "nonce=" \ + # --data-urlencode "asset=XBT" \ + # --data-urlencode "method=Bitcoin" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/Withdraw', { + "nonce": str(int(1000*time.time())), + "asset": "XBT", + "key": "btc_testnet_with1", + "address": "bc1kar0ssrr7xf3vy5l6d3lydnwkre5og2zz3f5ldq", + "amount": 0.725 + }, api_key, api_sec) + + print(resp.json()) \ No newline at end of file diff --git a/spot-rest/requests/public/assets/info.yaml b/spot-rest/requests/public/assets/info.yaml new file mode 100644 index 0000000..9db16ae --- /dev/null +++ b/spot-rest/requests/public/assets/info.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/Assets" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Assets') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Assets', ['aclass' => 'currency']); \ No newline at end of file diff --git a/spot-rest/requests/public/assets/pairs.yaml b/spot-rest/requests/public/assets/pairs.yaml new file mode 100644 index 0000000..525ebaf --- /dev/null +++ b/spot-rest/requests/public/assets/pairs.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/AssetPairs?pair=XXBTZUSD,XETHXXBT" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/AssetPairs?pair=XXBTZUSD,XETHXXBT') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('AssetPairs', ['pair' => 'XXBTCZUSD,XETHXXBT']); \ No newline at end of file diff --git a/spot-rest/requests/public/depth.yaml b/spot-rest/requests/public/depth.yaml new file mode 100644 index 0000000..3ed293d --- /dev/null +++ b/spot-rest/requests/public/depth.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/Depth?pair=XBTUSD" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Depth?pair=XBTUSD') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Depth', ['pair' => 'XBTUSD']); \ No newline at end of file diff --git a/spot-rest/requests/public/ohlc.yaml b/spot-rest/requests/public/ohlc.yaml new file mode 100644 index 0000000..301714a --- /dev/null +++ b/spot-rest/requests/public/ohlc.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/OHLC?pair=XBTUSD" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/OHLC?pair=XBTUSD') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('OHLC', ['pair' => 'XBTUSD']); \ No newline at end of file diff --git a/spot-rest/requests/public/spread.yaml b/spot-rest/requests/public/spread.yaml new file mode 100644 index 0000000..454f877 --- /dev/null +++ b/spot-rest/requests/public/spread.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/Spread?pair=XBTUSD" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Spread?pair=XBTUSD') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Spread', ['pair' => 'XBTUSD']); \ No newline at end of file diff --git a/spot-rest/requests/public/ticker.yaml b/spot-rest/requests/public/ticker.yaml new file mode 100644 index 0000000..1b65786 --- /dev/null +++ b/spot-rest/requests/public/ticker.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/Ticker?pair=XBTUSD" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Ticker?pair=XBTUSD') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Ticker', ['pair' => 'XBTUSD']); \ No newline at end of file diff --git a/spot-rest/requests/public/time.yaml b/spot-rest/requests/public/time.yaml new file mode 100644 index 0000000..8bb1a99 --- /dev/null +++ b/spot-rest/requests/public/time.yaml @@ -0,0 +1,22 @@ +- lang: Shell + label: cURL + source: curl "https://api.kraken.com/0/public/Time" +# - lang: ignoreme +# source: blahba +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Time') + + print(resp.json()) + +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Time'); \ No newline at end of file diff --git a/spot-rest/requests/public/trades.yaml b/spot-rest/requests/public/trades.yaml new file mode 100644 index 0000000..cff5c5e --- /dev/null +++ b/spot-rest/requests/public/trades.yaml @@ -0,0 +1,19 @@ +- lang: cURL + source: | + curl "https://api.kraken.com/0/public/Trades?pair=XBTUSD" +- lang: Python + source: | + import requests + + resp = requests.get('https://api.kraken.com/0/public/Trades?pair=XBTUSD') + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPublic('Trades', ['pair' => 'XBTUSD']); \ No newline at end of file diff --git a/spot-rest/requests/trading/orders/add.yaml b/spot-rest/requests/trading/orders/add.yaml new file mode 100644 index 0000000..658ed0b --- /dev/null +++ b/spot-rest/requests/trading/orders/add.yaml @@ -0,0 +1,9 @@ +- default: + { + "nonce": 123456789018, + "ordertype": "limit", + "type": "buy", + "volume": 1.25, + "pair": "XBTUSD", + "price": 27500 + } \ No newline at end of file diff --git a/spot-rest/requests/trading/orders/add_example.yaml b/spot-rest/requests/trading/orders/add_example.yaml new file mode 100644 index 0000000..09c2e2d --- /dev/null +++ b/spot-rest/requests/trading/orders/add_example.yaml @@ -0,0 +1,7 @@ +nonce: 163245617 +ordertype: "limit" +type: "buy" +volume: "1.25" +pair: "XBTUSD" +price: "27500" +cl_ord_id: "6d1b345e-2821-40e2-ad83-4ecb18a06876" diff --git a/spot-rest/requests/trading/orders/batchadd.yaml b/spot-rest/requests/trading/orders/batchadd.yaml new file mode 100644 index 0000000..588b500 --- /dev/null +++ b/spot-rest/requests/trading/orders/batchadd.yaml @@ -0,0 +1,130 @@ +- lang: cURL + source: | + // Send buy and sell BTC/USD + + + curl -X "POST" "https://api.kraken.com/0/private/AddOrderBatch" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/json' \ + { + "deadline": "2022-05-24T14:15:22Z", + "nonce": "", + "orders": [ + { + "close": {"ordertype": "stop-loss-limit", + "price": "37000", + "price2": "36000"}, + "ordertype": "limit", + "price": "40000", + "price2": "string", + "timeinforce": "GTC", + "type": "buy", + "userref": "345", + "volume": "1.2" + }, + { + "ordertype": "limit", + "price": "42000", + "starttm": "string", + "timeinforce": "GTC", + "type": "sell", + "userref": "123", + "volume": "1.2" + } + ], + + "pair": "BTC/USD", + "validate": "false" + } +- lang: Python + source: | + import time + import os + import requests + import json + import urllib.parse + import hashlib + import hmac + import base64 + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, json=data) + return req + + def get_kraken_signature(urlpath, data, secret): + postdata = json.dumps(data) + encoded = (str(data['nonce']) + postdata).encode() + message = urlpath.encode() + hashlib.sha256(encoded).digest() + mac = hmac.new(base64.b64decode(secret), message, hashlib.sha512) + sigdigest = base64.b64encode(mac.digest()) + return sigdigest.decode() + + # Construct the request and print the result + resp = kraken_request('/0/private/AddOrderBatch', { + "orders": [ + { + "close": {"ordertype": "stop-loss-limit", + "price": "37000", + "price2": "36000"}, + "ordertype": "limit", + "price": "40000", + "price2": "string", + "timeinforce": "GTC", + "type": "buy", + "userref": "123", + "volume": "1.2" + }, + { + "ordertype": "limit", + "price": "42000", + "starttm": "string", + "timeinforce": "GTC", + "type": "sell", + "userref": "345", + "volume": "1.2" + } + ], + "deadline": "2022-05-24T14:15:22Z", + "nonce": "", + "pair": "BTC/USD", + "validate": "false" + } + , api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# // buy 2.12345678 XBTUSD @ limit $101.9901 +# // with 2:1 leverage, with a follow up stop loss, +# // take profit sell order: stop at -5% loss, +# // take profit at +$10 price increase (signed stop/loss prices determined automatically using # notation): + +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('AddOrder', [ +# 'pair' => 'XXBTZUSD', +# 'type' => 'buy', +# 'ordertype' => 'limit', +# 'price' => '101.9901', +# 'volume' => '2.12345678', +# 'leverage' => '2:1', +# 'close' => [ +# 'ordertype' => 'stop-loss-profit', +# 'price' => '#5%', // stop loss price (relative percentage delta) +# 'price2' => '#10' // take profit price (relative delta) +# ] +# ]); diff --git a/spot-rest/requests/trading/orders/batchcancel.yaml b/spot-rest/requests/trading/orders/batchcancel.yaml new file mode 100644 index 0000000..4631073 --- /dev/null +++ b/spot-rest/requests/trading/orders/batchcancel.yaml @@ -0,0 +1,52 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/CancelOrderBatch" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/json' \ + { + "nonce": "string", + "orders": ["OG5V2Y-RYKVL-DT3V3B","OP5V2Y-RYKVL-ET3V3B"], + } + + + +- lang: Python + source: | + import time + import os + import requests + import json + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=json.dumps(data)) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/CancelOrderBatch', { + "nonce": str(int(1000*time.time())), + "orders": ["OG5V2Y-RYKVL-DT3V3B","OP5V2Y-RYKVL-ET3V3B"] + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('CancelOrder', [ +# 'txid' => 'OYVGEW-VYV5B-UUEXSK' +# ]); diff --git a/spot-rest/requests/trading/orders/cancel.yaml b/spot-rest/requests/trading/orders/cancel.yaml new file mode 100644 index 0000000..25b5dcb --- /dev/null +++ b/spot-rest/requests/trading/orders/cancel.yaml @@ -0,0 +1,46 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/CancelOrder" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" + --data-urlencode "txid=OYVGEW-VYV5B-UUEXSK" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/CancelOrder', { + "nonce": str(int(1000*time.time())), + "txid": "OG5V2Y-RYKVL-DT3V3B" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('CancelOrder', [ +# 'txid' => 'OYVGEW-VYV5B-UUEXSK' +# ]); diff --git a/spot-rest/requests/trading/orders/edit.yaml b/spot-rest/requests/trading/orders/edit.yaml new file mode 100644 index 0000000..5c4d1a8 --- /dev/null +++ b/spot-rest/requests/trading/orders/edit.yaml @@ -0,0 +1,70 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/EditOrder" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" + --data-urlencode "pair=XXBTZUSD" \ + --data-urlencode "txid=OHYO67-6LP66-HMQ437" \ + --data-urlencode "ordertype=limit" \ + --data-urlencode "price=45000.1" \ + --data-urlencode "price2=46000.1" \ + --data-urlencode "volume=2.1234" \ +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/EditOrder', { + "nonce": str(int(1000*time.time())), + "txid": "OHYO67-6LP66-HMQ437", + "volume": 1.25, + "pair": "XBTUSD", + "price": 27500, + "price2": 26500 + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# // buy 2.12345678 XBTUSD @ limit $101.9901 +# // with 2:1 leverage, with a follow up stop loss, +# // take profit sell order: stop at -5% loss, +# // take profit at +$10 price increase (signed stop/loss prices determined automatically using # notation): + +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('EditOrder', [ +# 'pair' => 'XXBTZUSD', +# 'type' => 'buy', +# 'ordertype' => 'limit', +# 'price' => '101.9901', +# 'volume' => '2.12345678', +# 'leverage' => '2:1', +# 'close' => [ +# 'ordertype' => 'stop-loss-profit', +# 'price' => '#5%', // stop loss price (relative percentage delta) +# 'price2' => '#10' // take profit price (relative delta) +# ] +# ]); diff --git a/spot-rest/requests/user/account/balance.yaml b/spot-rest/requests/user/account/balance.yaml new file mode 100644 index 0000000..c366dfc --- /dev/null +++ b/spot-rest/requests/user/account/balance.yaml @@ -0,0 +1,42 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/Balance" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/Balance', { + "nonce": str(int(1000*time.time())) + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('Balance'); diff --git a/spot-rest/requests/user/account/balanceex.yaml b/spot-rest/requests/user/account/balanceex.yaml new file mode 100644 index 0000000..9d86f27 --- /dev/null +++ b/spot-rest/requests/user/account/balanceex.yaml @@ -0,0 +1,42 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/BalanceEx" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/BalanceEx', { + "nonce": str(int(1000*time.time())) + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('Balance'); diff --git a/spot-rest/requests/user/ledgers/info.yaml b/spot-rest/requests/user/ledgers/info.yaml new file mode 100644 index 0000000..10d65c8 --- /dev/null +++ b/spot-rest/requests/user/ledgers/info.yaml @@ -0,0 +1,44 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/Ledgers" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/Ledgers', { + "nonce": str(int(1000*time.time())), + "asset": "GBP", + "start": 1610124514 + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('Ledgers'); diff --git a/spot-rest/requests/user/ledgers/query.yaml b/spot-rest/requests/user/ledgers/query.yaml new file mode 100644 index 0000000..aa43ae5 --- /dev/null +++ b/spot-rest/requests/user/ledgers/query.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/QueryLedgers" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&id=LGBRJU-SQZ4L-5HLS3C,L3S26P-BHIOV-TTWYYI" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/QueryLedgers', { + "nonce": str(int(1000*time.time())), + "id": "L4UESK-KG3EQ-UFO4T5" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('QueryLedgers', ['id' => 'LGBRJU-SQZ4L-5HLS3C,L3S26P-BHIOV-TTWYYI']); diff --git a/spot-rest/requests/user/orders/closed.yaml b/spot-rest/requests/user/orders/closed.yaml new file mode 100644 index 0000000..cd9e459 --- /dev/null +++ b/spot-rest/requests/user/orders/closed.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/ClosedOrders" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&trades=true" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/ClosedOrders', { + "nonce": str(int(1000*time.time())), + "userref": 36493663 + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('ClosedOrders', ['trades' => true]); \ No newline at end of file diff --git a/spot-rest/requests/user/orders/open.yaml b/spot-rest/requests/user/orders/open.yaml new file mode 100644 index 0000000..b581643 --- /dev/null +++ b/spot-rest/requests/user/orders/open.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/OpenOrders" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&trades=true" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/OpenOrders', { + "nonce": str(int(1000*time.time())), + "trades": True + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('OpenOrders', ['trades' => true]); \ No newline at end of file diff --git a/spot-rest/requests/user/orders/query.yaml b/spot-rest/requests/user/orders/query.yaml new file mode 100644 index 0000000..daf3f06 --- /dev/null +++ b/spot-rest/requests/user/orders/query.yaml @@ -0,0 +1,44 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/QueryOrders" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&trades=true" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/QueryOrders', { + "nonce": str(int(1000*time.time())), + "txid": "OBCMZD-JIEE7-77TH3F,OMMDB2-FSB6Z-7W3HPO", + "trades": True + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('QueryOrders', ['trades' => true]); diff --git a/spot-rest/requests/user/trades/balance.yaml b/spot-rest/requests/user/trades/balance.yaml new file mode 100644 index 0000000..43d47a5 --- /dev/null +++ b/spot-rest/requests/user/trades/balance.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/TradeBalance" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&asset=ZUSD" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/TradeBalance', { + "nonce": str(int(1000*time.time())), + "asset": "USD" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('TradeBalance', ['asset' => "ZUSD"]); \ No newline at end of file diff --git a/spot-rest/requests/user/trades/history.yaml b/spot-rest/requests/user/trades/history.yaml new file mode 100644 index 0000000..d9ff0fb --- /dev/null +++ b/spot-rest/requests/user/trades/history.yaml @@ -0,0 +1,42 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/TradesHistory" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&trades=true" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/TradesHistory', { + "nonce": str(int(1000*time.time())) + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('TradesHistory', ['trades' => true]); diff --git a/spot-rest/requests/user/trades/query.yaml b/spot-rest/requests/user/trades/query.yaml new file mode 100644 index 0000000..b6f59cb --- /dev/null +++ b/spot-rest/requests/user/trades/query.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/QueryTrades" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&txid=TRWCIF-3MJWU-5DYJG5,TNGJFU-5CD67-ZV3AEO" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/QueryTrades', { + "nonce": str(int(1000*time.time())), + "txid": "THVRQM-33VKH-UCI7BS,TTEUX3-HDAAA-RC2RUO" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('QueryTrades', ['txid' => 'TRWCIF-3MJWU-5DYJG5,TNGJFU-5CD67-ZV3AEO']); diff --git a/spot-rest/requests/user/trades/volume.yaml b/spot-rest/requests/user/trades/volume.yaml new file mode 100644 index 0000000..e094f2c --- /dev/null +++ b/spot-rest/requests/user/trades/volume.yaml @@ -0,0 +1,43 @@ +- lang: cURL + source: | + curl -X "POST" "https://api.kraken.com/0/private/TradeVolume" \ + -H 'API-Key: ' \ + -H 'API-Sign: ' \ + -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ + --data-urlencode "nonce=&pair=XETCXETH" +- lang: Python + source: | + import time + import os + import requests + + # Read Kraken API key and secret stored in environment variables + api_url = "https://api.kraken.com" + api_key = os.environ['API_KEY_KRAKEN'] + api_sec = os.environ['API_SEC_KRAKEN'] + + # Attaches auth headers and returns results of a POST request + def kraken_request(uri_path, data, api_key, api_sec): + headers = {} + headers['API-Key'] = api_key + # get_kraken_signature() as defined in the 'Authentication' section + headers['API-Sign'] = get_kraken_signature(uri_path, data, api_sec) + req = requests.post((api_url + uri_path), headers=headers, data=data) + return req + + # Construct the request and print the result + resp = kraken_request('/0/private/TradeVolume', { + "nonce": str(int(1000*time.time())), + "pair": "XBTUSD" + }, api_key, api_sec) + + print(resp.json()) +# - lang: PHP +# source: | +# require_once('KrakenAPI.php'); + +# const KEY = ''; +# const SECRET = ''; + +# $kraken = new KrakenAPI(KEY, SECRET, 'https://api.kraken.com'); +# $res = $kraken->QueryPrivate('TradeVolume', ['pair' => 'XETCXETH']); diff --git a/spot-rest/responses/errors/internalError.yaml b/spot-rest/responses/errors/internalError.yaml new file mode 100644 index 0000000..1e896d9 --- /dev/null +++ b/spot-rest/responses/errors/internalError.yaml @@ -0,0 +1,7 @@ +errors: +- field: null + value: null + type: Internal Error + msg: Internal error + severity: E + errorClass: General \ No newline at end of file diff --git a/spot-rest/responses/errors/invalidApiKey.yaml b/spot-rest/responses/errors/invalidApiKey.yaml new file mode 100644 index 0000000..4c07ac5 --- /dev/null +++ b/spot-rest/responses/errors/invalidApiKey.yaml @@ -0,0 +1,7 @@ +value: + errors: + - field: Kraken-Api-Key + type: Invalid key + msg: Invalid API key + severity: E + errorClass: API \ No newline at end of file diff --git a/spot-rest/responses/errors/invalidApiNonce.yaml b/spot-rest/responses/errors/invalidApiNonce.yaml new file mode 100644 index 0000000..1635ef3 --- /dev/null +++ b/spot-rest/responses/errors/invalidApiNonce.yaml @@ -0,0 +1,7 @@ +value: + errors: + - field: Kraken-Nonce + type: Invalid nonce + msg: Invalid API nonce + severity: E + errorClass: API \ No newline at end of file diff --git a/spot-rest/responses/errors/invalidApiSignature.yaml b/spot-rest/responses/errors/invalidApiSignature.yaml new file mode 100644 index 0000000..e61ca01 --- /dev/null +++ b/spot-rest/responses/errors/invalidApiSignature.yaml @@ -0,0 +1,7 @@ +value: + errors: + - field: Kraken-Api-Sign + type: Invalid signature + msg: Invalid API signature + severity: E + errorClass: API diff --git a/spot-rest/responses/funding/deposits/addresses.yaml b/spot-rest/responses/funding/deposits/addresses.yaml new file mode 100644 index 0000000..6b07bb4 --- /dev/null +++ b/spot-rest/responses/funding/deposits/addresses.yaml @@ -0,0 +1,17 @@ +error: [] +result: + - address: 2N9fRkx5JTWXWHmXzZtvhQsufvoYRMq9ExV + expiretm: '0' + new: true + - address: 2NCpXUCEYr8ur9WXM1tAjZSem2w3aQeTcAo + expiretm: '0' + new: true + - address: 2Myd4eaAW96ojk38A2uDK4FbioCayvkEgVq + expiretm: '0' + - address: rLHzPsX3oXdzU2qP17kHCH2G4csZv1rAJh + expiretm: '0' + new: true + tag: '1361101127' + - address: krakenkraken + expiretm: '0' + memo: '4150096490' diff --git a/spot-rest/responses/funding/deposits/methods.yaml b/spot-rest/responses/funding/deposits/methods.yaml new file mode 100644 index 0000000..a344486 --- /dev/null +++ b/spot-rest/responses/funding/deposits/methods.yaml @@ -0,0 +1,11 @@ +error: [] +result: + - method: Bitcoin + limit: false + fee: '0.0000000000' + gen-address: true + minimum: '0.00010000' + - method: Bitcoin Lightning + limit: false + fee: '0.00000000' + minimum: '0.00010000' \ No newline at end of file diff --git a/spot-rest/responses/funding/deposits/recent.yaml b/spot-rest/responses/funding/deposits/recent.yaml new file mode 100644 index 0000000..d7217de --- /dev/null +++ b/spot-rest/responses/funding/deposits/recent.yaml @@ -0,0 +1,24 @@ +error: [] +result: + - method: Bitcoin + aclass: currency + asset: XXBT + refid: FTQcuak-V6Za8qrWnhzTx67yYHz8Tg + txid: 6544b41b607d8b2512baf801755a3a87b6890eacdb451be8a94059fb11f0a8d9 + info: 2Myd4eaAW96ojk38A2uDK4FbioCayvkEgVq + amount: '0.78125000' + fee: '0.0000000000' + time: 1688992722 + status: Success + status-prop: return + - method: Ether (Hex) + aclass: currency + asset: XETH + refid: FTQcuak-V6Za8qrPnhsTx47yYLz8Tg + txid: '0x339c505eba389bf2c6bebb982cc30c6d82d0bd6a37521fa292890b6b180affc0' + info: '0xca210f4121dc891c9154026c3ae3d1832a005048' + amount: '0.1383862742' + time: 1688992722 + status: Settled + status-prop: onhold + originators: ['0x70b6343b104785574db2c1474b3acb3937ab5de7346a5b857a78ee26954e0e2d', '0x5b32f6f792904a446226b17f607850d0f2f7533cdc35845bfe432b5b99f55b66'] diff --git a/spot-rest/responses/public/assets/info.yaml b/spot-rest/responses/public/assets/info.yaml new file mode 100644 index 0000000..b4945c8 --- /dev/null +++ b/spot-rest/responses/public/assets/info.yaml @@ -0,0 +1,163 @@ +error: [] +result: + ADA: + aclass: currency + altname: ADA + decimals: 8 + display_decimals: 6 + collateral_value: 0.9 + status: "enabled" + BCH: + aclass: currency + altname: BCH + decimals: 10 + display_decimals: 5 + status: "enabled" + DASH: + aclass: currency + altname: DASH + decimals: 10 + display_decimals: 5 + status: "enabled" + EOS: + aclass: currency + altname: EOS + decimals: 10 + display_decimals: 5 + status: "enabled" + GNO: + aclass: currency + altname: GNO + decimals: 10 + display_decimals: 5 + status: "enabled" + KFEE: + aclass: currency + altname: FEE + decimals: 2 + display_decimals: 2 + status: "enabled" + QTUM: + aclass: currency + altname: QTUM + decimals: 10 + display_decimals: 6 + status: "enabled" + USDT: + aclass: currency + altname: USDT + decimals: 8 + display_decimals: 4 + collateral_value: 0.9 + status: "enabled" + XETC: + aclass: currency + altname: ETC + decimals: 10 + display_decimals: 5 + status: "enabled" + XETH: + aclass: currency + altname: ETH + decimals: 10 + display_decimals: 5 + collateral_value: 1 + status: "enabled" + XLTC: + aclass: currency + altname: LTC + decimals: 10 + display_decimals: 5 + collateral_value: 0.7 + status: "enabled" + XMLN: + aclass: currency + altname: MLN + decimals: 10 + display_decimals: 5 + status: "enabled" + XREP: + aclass: currency + altname: REP + decimals: 10 + display_decimals: 5 + status: "enabled" + XTZ: + aclass: currency + altname: XTZ + decimals: 8 + display_decimals: 5 + collateral_value: 0.5 + status: "enabled" + XXBT: + aclass: currency + altname: XBT + decimals: 10 + display_decimals: 5 + collateral_value: 1 + status: "enabled" + XXDG: + aclass: currency + altname: XDG + decimals: 8 + display_decimals: 2 + status: "enabled" + XXLM: + aclass: currency + altname: XLM + decimals: 8 + display_decimals: 5 + status: "enabled" + XXMR: + aclass: currency + altname: XMR + decimals: 10 + display_decimals: 5 + status: "enabled" + XXRP: + aclass: currency + altname: XRP + decimals: 8 + display_decimals: 5 + status: "enabled" + XZEC: + aclass: currency + altname: ZEC + decimals: 10 + display_decimals: 5 + status: "enabled" + ZCAD: + aclass: currency + altname: CAD + decimals: 4 + display_decimals: 2 + collateral_value: 1 + status: "enabled" + ZEUR: + aclass: currency + altname: EUR + decimals: 4 + display_decimals: 2 + collateral_value: 1 + status: "enabled" + ZGBP: + aclass: currency + altname: GBP + decimals: 4 + display_decimals: 2 + collateral_value: 1 + status: "enabled" + ZJPY: + aclass: currency + altname: JPY + decimals: 2 + display_decimals: 0 + collateral_value: 1 + status: "enabled" + ZUSD: + aclass: currency + altname: USD + decimals: 4 + display_decimals: 2 + collateral_value: 1 + status: "enabled" diff --git a/spot-rest/responses/public/assets/pairs.yaml b/spot-rest/responses/public/assets/pairs.yaml new file mode 100644 index 0000000..7f84857 --- /dev/null +++ b/spot-rest/responses/public/assets/pairs.yaml @@ -0,0 +1,140 @@ +error: [] +result: + XETHXXBT: + altname: ETHXBT + wsname: ETH/XBT + aclass_base: currency + base: XETH + aclass_quote: currency + quote: XXBT + lot: unit + cost_decimals: 6 + pair_decimals: 5 + lot_decimals: 8 + lot_multiplier: 1 + leverage_buy: + - 2 + - 3 + - 4 + - 5 + leverage_sell: + - 2 + - 3 + - 4 + - 5 + fees: + - - 0 + - 0.26 + - - 50000 + - 0.24 + - - 100000 + - 0.22 + - - 250000 + - 0.2 + - - 500000 + - 0.18 + - - 1000000 + - 0.16 + - - 2500000 + - 0.14 + - - 5000000 + - 0.12 + - - 10000000 + - 0.1 + fees_maker: + - - 0 + - 0.16 + - - 50000 + - 0.14 + - - 100000 + - 0.12 + - - 250000 + - 0.1 + - - 500000 + - 0.08 + - - 1000000 + - 0.06 + - - 2500000 + - 0.04 + - - 5000000 + - 0.02 + - - 10000000 + - 0 + fee_volume_currency: ZUSD + margin_call: 80 + margin_stop: 40 + ordermin: '0.01' + costmin: '0.00002' + tick_size: '0.00001' + status: 'online' + long_position_limit: 1100 + short_position_limit: 400 + XXBTZUSD: + altname: XBTUSD + wsname: XBT/USD + aclass_base: currency + base: XXBT + aclass_quote: currency + quote: ZUSD + lot: unit + cost_decimals: 5 + pair_decimals: 1 + lot_decimals: 8 + lot_multiplier: 1 + leverage_buy: + - 2 + - 3 + - 4 + - 5 + leverage_sell: + - 2 + - 3 + - 4 + - 5 + fees: + - - 0 + - 0.26 + - - 50000 + - 0.24 + - - 100000 + - 0.22 + - - 250000 + - 0.2 + - - 500000 + - 0.18 + - - 1000000 + - 0.16 + - - 2500000 + - 0.14 + - - 5000000 + - 0.12 + - - 10000000 + - 0.1 + fees_maker: + - - 0 + - 0.16 + - - 50000 + - 0.14 + - - 100000 + - 0.12 + - - 250000 + - 0.1 + - - 500000 + - 0.08 + - - 1000000 + - 0.06 + - - 2500000 + - 0.04 + - - 5000000 + - 0.02 + - - 10000000 + - 0 + fee_volume_currency: ZUSD + margin_call: 80 + margin_stop: 40 + ordermin: '0.0001' + costmin: '0.5' + tick_size: '0.1' + status: 'online' + long_position_limit: 250 + short_position_limit: 200 diff --git a/spot-rest/responses/public/depth.yaml b/spot-rest/responses/public/depth.yaml new file mode 100644 index 0000000..e6e3192 --- /dev/null +++ b/spot-rest/responses/public/depth.yaml @@ -0,0 +1,17 @@ +error: [] +result: + XXBTZUSD: + asks: + - - '3539.90000' + - '0.801' + - 1548119951 + - - '3540.20000' + - '1.000' + - 1548119873 + bids: + - - '3538.90000' + - '0.754' + - 1548119886 + - - '3538.70000' + - '0.798' + - 1548119924 \ No newline at end of file diff --git a/spot-rest/responses/public/ohlc.yaml b/spot-rest/responses/public/ohlc.yaml new file mode 100644 index 0000000..8860fff --- /dev/null +++ b/spot-rest/responses/public/ohlc.yaml @@ -0,0 +1,20 @@ +error: [] +result: + XXBTZUSD: + - - 1548115200 + - '3533.4' + - '3543.7' + - '3530.7' + - '3539.4' + - '3539.8' + - '83.09287787' + - 232 + - - 1548115200 + - '3533.4' + - '3543.7' + - '3530.7' + - '3539.4' + - '3539.8' + - '83.09287787' + - 232 + last: 1548111600 \ No newline at end of file diff --git a/spot-rest/responses/public/spread.yaml b/spot-rest/responses/public/spread.yaml new file mode 100644 index 0000000..83e0abd --- /dev/null +++ b/spot-rest/responses/public/spread.yaml @@ -0,0 +1,14 @@ +error: [] +result: + XXBTZUSD: + - - 1548120550 + - '3538.70000' + - '3541.50000' + - - 1548120551 + - '3538.80000' + - '3541.50000' + - - 1548120554 + - '3538.80000' + - '3541.40000' + + last: 1548122302 \ No newline at end of file diff --git a/spot-rest/responses/public/ticker.yaml b/spot-rest/responses/public/ticker.yaml new file mode 100644 index 0000000..3c1d121 --- /dev/null +++ b/spot-rest/responses/public/ticker.yaml @@ -0,0 +1,30 @@ +error: [] +result: + XXBTZUSD: + a: + - '3537.50000' + - '1' + - '1.000' + b: + - '3537.40000' + - '16' + - '16.000' + c: + - '3537.50000' + - '0.25000000' + v: + - '2945.40515179' + - '4009.69918350' + p: + - '3537.46886' + - '3535.79747' + t: + - 5773 + - 6815 + l: + - '3504.20000' + - '3504.20000' + h: + - '3565.00000' + - '3565.00000' + o: '3530.60000' \ No newline at end of file diff --git a/spot-rest/responses/public/time.yaml b/spot-rest/responses/public/time.yaml new file mode 100644 index 0000000..4954454 --- /dev/null +++ b/spot-rest/responses/public/time.yaml @@ -0,0 +1,4 @@ +error: [] +result: + unixtime: 1546998654 + rfc1123: Wed, 9 Jan 19 01:50:54 +0000 \ No newline at end of file diff --git a/spot-rest/responses/public/trades.yaml b/spot-rest/responses/public/trades.yaml new file mode 100644 index 0000000..67e52fa --- /dev/null +++ b/spot-rest/responses/public/trades.yaml @@ -0,0 +1,16 @@ +error: [] +result: + XXBTZUSD: + - - '3535.50000' + - '0.00300000' + - 1548111751.5556 + - b + - m + - '' + - - '3535.40000' + - '0.09670735' + - 1548111757.2558 + - b + - m + - '' + last: '1548121745957099006' diff --git a/spot-rest/responses/trading/orders/add.yaml b/spot-rest/responses/trading/orders/add.yaml new file mode 100644 index 0000000..2dbc8bb --- /dev/null +++ b/spot-rest/responses/trading/orders/add.yaml @@ -0,0 +1 @@ +{"error":[],"result":{"descr":{"order":"buy 2.12340000 XBTUSD @ limit 25000.1 with 2:1 leverage","close":"close position @ stop loss 22000.0 -> limit 21000.0"},"txid":["OUF4EM-FRGI2-MQMWZD"]}} \ No newline at end of file diff --git a/spot-rest/responses/trading/orders/batchadd.yaml b/spot-rest/responses/trading/orders/batchadd.yaml new file mode 100644 index 0000000..c8f67ef --- /dev/null +++ b/spot-rest/responses/trading/orders/batchadd.yaml @@ -0,0 +1 @@ +{'error': [], 'result': {'orders': [{'txid': 'O5OR23-ADFAD-Y2G61C', 'descr': {'order': 'buy 0.80300000 XBTUSD @ limit 28300.0'},"close":"close position @ stop loss 27000.0 -> limit 26000.0"}, {'txid': '9K6KFS-5H3PL-XBRC7A', 'descr': {'order': 'sell 0.10500000 XBTUSD @ limit 36000.0'}}]}} \ No newline at end of file diff --git a/spot-rest/responses/trading/orders/batchcancel.yaml b/spot-rest/responses/trading/orders/batchcancel.yaml new file mode 100644 index 0000000..92a837e --- /dev/null +++ b/spot-rest/responses/trading/orders/batchcancel.yaml @@ -0,0 +1,3 @@ +error: [] +result: + count: 2 \ No newline at end of file diff --git a/spot-rest/responses/trading/orders/cancel.yaml b/spot-rest/responses/trading/orders/cancel.yaml new file mode 100644 index 0000000..d7ce42e --- /dev/null +++ b/spot-rest/responses/trading/orders/cancel.yaml @@ -0,0 +1,3 @@ +error: [] +result: + count: 1 \ No newline at end of file diff --git a/spot-rest/responses/trading/orders/edit.yaml b/spot-rest/responses/trading/orders/edit.yaml new file mode 100644 index 0000000..bc3d49c --- /dev/null +++ b/spot-rest/responses/trading/orders/edit.yaml @@ -0,0 +1 @@ +{"error":[],"result":{"status":"ok","txid":"OFVXHJ-KPQ3B-VS7ELA","originaltxid":"OHYO67-6LP66-HMQ437","volume":"0.00030000","price":"19500.0","price2":"32500.0","orders_cancelled":1,"descr":{"order":"buy 0.00030000 XXBTZGBP @ limit 19500.0"}}} \ No newline at end of file diff --git a/spot-rest/responses/user/account/balance.yaml b/spot-rest/responses/user/account/balance.yaml new file mode 100644 index 0000000..cae4493 --- /dev/null +++ b/spot-rest/responses/user/account/balance.yaml @@ -0,0 +1,10 @@ +error: [] +result: + ZUSD: '2970172.7962' + ZEUR: '102559.9012' + ZCAD: '32300.0000' + KFEE: '0.00' + XXBT: '3.2223768244' + XXRP: '0.00000000' + XETH: '995.0000000000' + XDAO: '100000.0000000000' \ No newline at end of file diff --git a/spot-rest/responses/user/ledgers/info.yaml b/spot-rest/responses/user/ledgers/info.yaml new file mode 100644 index 0000000..542f105 --- /dev/null +++ b/spot-rest/responses/user/ledgers/info.yaml @@ -0,0 +1,40 @@ +error: [] +result: + ledger: + LGBRJU-SQZ4L-5HLS3C: + refid: QGBCOYA-UNP53O-F2JDNS + time: 1546992921.8426 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '5.4687500000' + L3S26P-BHIOV-TTWYYI: + refid: QGBQAL5-3F4WQ6-DZQT7G + time: 1546992921.8172 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '4.6875000000' + LT2T4M-YDT75-42KGMU: + refid: QGBHWA7-5XFEDC-RIBTM3 + time: 1546992921.777 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '3.9062500000' + LILCPJ-DKJ53-CZIG5E: + refid: QGB5XCB-NS67CW-D34ZKM + time: 1546992921.753 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '3.1250000000' +count: 4 \ No newline at end of file diff --git a/spot-rest/responses/user/ledgers/query.yaml b/spot-rest/responses/user/ledgers/query.yaml new file mode 100644 index 0000000..058af57 --- /dev/null +++ b/spot-rest/responses/user/ledgers/query.yaml @@ -0,0 +1,20 @@ +error: [] +result: + LGBRJU-SQZ4L-5HLS3C: + refid: QGBCOYA-UNP53O-F2JDNS + time: 1546992921.8426 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '5.4687500000' + L3S26P-BHIOV-TTWYYI: + refid: QGBQAL5-3F4WQ6-DZQT7G + time: 1546992921.8172 + type: deposit + aclass: currency + asset: XXBT + amount: '0.7812500000' + fee: '0.0000000000' + balance: '4.6875000000' \ No newline at end of file diff --git a/spot-rest/responses/user/orders/closed.yaml b/spot-rest/responses/user/orders/closed.yaml new file mode 100644 index 0000000..259a0c5 --- /dev/null +++ b/spot-rest/responses/user/orders/closed.yaml @@ -0,0 +1,85 @@ +error: [] +result: + closed: + OT5JQ3-MNZQI-GDXY7O: + refid: + userref: 1000 + status: canceled + reason: User requested + opentm: 1550101012.7873 + closetm: 1550101338.364 + starttm: 0 + expiretm: 0 + descr: + pair: DASHUSD + type: buy + ordertype: limit + price: '1.000' + price2: '0' + leverage: none + order: buy 10.00000000 DASHUSD @ limit 1.000 + close: '' + vol: '10.00000000' + vol_exec: '0.00000000' + cost: '0.000000' + fee: '0.000000' + price: '0.000000' + stopprice: '0.000000' + limitprice: '0.000000' + misc: '' + oflags: fciq + OQB6D2-O5QMF-QBBAWZ: + refid: + userref: 3000 + status: canceled + reason: User requested + opentm: 1550101013.9522 + closetm: 1550101338.0032 + starttm: 0 + expiretm: 0 + descr: + pair: XBTEUR + type: buy + ordertype: limit + price: '1.0' + price2: '0' + leverage: none + order: buy 10.00000000 XBTEUR @ limit 1.0 + close: '' + vol: '10.00000000' + vol_exec: '0.00000000' + cost: '0.00000' + fee: '0.00000' + price: '0.00000' + stopprice: '0.00000' + limitprice: '0.00000' + misc: '' + oflags: fciq + OFESQG-RLWJQ-ZV5AME: + refid: + userref: 2000 + status: canceled + reason: User requested + opentm: 1550101013.2046 + closetm: 1550101337.6203 + starttm: 0 + expiretm: 0 + descr: + pair: XBTUSD + type: buy + ordertype: limit + price: '1.0' + price2: '0' + leverage: none + order: buy 10.00000000 XBTUSD @ limit 1.0 + close: '' + vol: '10.00000000' + vol_exec: '0.00000000' + cost: '0.00000' + fee: '0.00000' + price: '0.00000' + stopprice: '0.00000' + limitprice: '0.00000' + misc: '' + oflags: fciq + count: 3 \ No newline at end of file diff --git a/spot-rest/responses/user/orders/open.yaml b/spot-rest/responses/user/orders/open.yaml new file mode 100644 index 0000000..9adfeda --- /dev/null +++ b/spot-rest/responses/user/orders/open.yaml @@ -0,0 +1,19 @@ +error: [] +result: + open: + O7ICPO-F4CLJ-MVBLHC: + refid: '' + userref: '' + status: open + opentm: 1373750306.9819 + starttm: 0 + expiretm: 0 + descr: + order: sell 3.00000000 XBTUSD @ limit 500.00000 + vol: "3.00000000" + vol_exec: "0.00000000" + cost: "0.00000" + fee: "0.00000" + price: "0.00000" + misc: '' + oflags: '' \ No newline at end of file diff --git a/spot-rest/responses/user/orders/query.yaml b/spot-rest/responses/user/orders/query.yaml new file mode 100644 index 0000000..810bfa8 --- /dev/null +++ b/spot-rest/responses/user/orders/query.yaml @@ -0,0 +1,54 @@ +error: [] +result: + ODNLO4-QYFSV-33BKJA: + refid: + userref: 123456 + status: open + opentm: 1550102482.1954 + starttm: 0 + expiretm: 0 + descr: + pair: XMRUSD + type: buy + ordertype: limit + price: '1.00' + price2: '0' + leverage: none + order: buy 10.00000000 XMRUSD @ limit 1.00 + close: '' + vol: '10.00000000' + vol_exec: '0.00000000' + cost: '0.00000000' + fee: '0.00000000' + price: '0.00000000' + stopprice: '0.00000000' + limitprice: '0.00000000' + misc: '' + oflags: fciq + OQB6D2-O5QMF-QBBAWZ: + refid: + userref: 3000 + status: canceled + reason: User requested + opentm: 1550101013.9522 + closetm: 1550101338.0032 + starttm: 0 + expiretm: 0 + descr: + pair: XBTEUR + type: buy + ordertype: limit + price: '1.0' + price2: '0' + leverage: none + order: buy 10.00000000 XBTEUR @ limit 1.0 + close: '' + vol: '10.00000000' + vol_exec: '0.00000000' + cost: '0.00000' + fee: '0.00000' + price: '0.00000' + stopprice: '0.00000' + limitprice: '0.00000' + misc: '' + oflags: fciq \ No newline at end of file diff --git a/spot-rest/responses/user/trades/balance.yaml b/spot-rest/responses/user/trades/balance.yaml new file mode 100644 index 0000000..af93eaf --- /dev/null +++ b/spot-rest/responses/user/trades/balance.yaml @@ -0,0 +1,10 @@ +error: [] +result: + eb: '3224744.0162' + tb: '3224744.0162' + m: '0.0000' + n: '0.0000' + c: '0.0000' + v: '0.0000' + e: '3224744.0162' + mf: '3224744.0162' \ No newline at end of file diff --git a/spot-rest/responses/user/trades/history.yaml b/spot-rest/responses/user/trades/history.yaml new file mode 100644 index 0000000..18de426 --- /dev/null +++ b/spot-rest/responses/user/trades/history.yaml @@ -0,0 +1,52 @@ +error: [] +result: + trades: + TBGB6I-IMYKU-WWA2SK: + ordertxid: OJTVFU-UWBXK-7AC6ML + postxid: TKH1SE-X7IF5-CKI7JT + pair: XXBTZUSD + time: 1428084298.0986 + type: sell + ordertype: limit + price: '9.25000' + cost: '0.92500' + fee: '0.00296' + vol: '0.10000000' + margin: '0.61667' + leverage: '0' + misc: '' + trade_id: 2560488 + posstatus: closed + cprice: '9.2' + ccost: '0.9' + cfee: '0' + cvol: '0.10000000' + cmargin: '0.9' + net: "-0.0070" + trades: + - TSOROF-PFCET-MPJ7ZY + TNJAD2-A56J2-34HIEZ: + ordertxid: OJTVFU-UWBXK-7AC6ML + postxid: TLS1SE-X8IF4-DKI7GT + pair: XXBTZUSD + time: 1428084246.804 + type: sell + ordertype: limit + price: '9.25000' + cost: '0.92500' + fee: '0.00296' + vol: '0.10000000' + margin: '0.61667' + leverage: '0' + misc: '' + trade_id: 2260198 + posstatus: closed + cprice: '9.2' + ccost: '0.9' + cfee: '0' + cvol: '0.10000000' + cmargin: '0.9' + net: "-0.0070" + trades: + - TNGJFU-5CD67-ZV3AEO + count: 2 \ No newline at end of file diff --git a/spot-rest/responses/user/trades/query.yaml b/spot-rest/responses/user/trades/query.yaml new file mode 100644 index 0000000..8f22bff --- /dev/null +++ b/spot-rest/responses/user/trades/query.yaml @@ -0,0 +1,28 @@ +error: [] +result: + TNGJFU-5CD67-ZV3AEO: + ordertxid: O5T7NQ-DH2NO-XCSJ3O + postxid: TNJAD2-A56J2-34HIEZ + pair: XXBTZUSD + time: 1428084298.0983 + type: buy + ordertype: market + price: '9.25000' + cost: '0.92500' + fee: '0.00412' + vol: '0.10000000' + margin: '0.92500' + misc: closing + TRWCIF-3MJWU-5DYJG5: + ordertxid: OGUSJ2-JCTEN-ZDLPWE + postxid: T445PG-PCO2Q-PZTQSG + pair: XXBTZUSD + time: 1428082705.9649 + type: buy + ordertype: limit + price: '9.25000' + cost: '0.92500' + fee: '0.00412' + vol: '0.10000000' + margin: '0.92500' + misc: closing \ No newline at end of file diff --git a/spot-rest/responses/user/trades/volume.yaml b/spot-rest/responses/user/trades/volume.yaml new file mode 100644 index 0000000..a30a86c --- /dev/null +++ b/spot-rest/responses/user/trades/volume.yaml @@ -0,0 +1,20 @@ +error: [] +result: + currency: ZUSD + volume: '3015012348193.4134' + fees: + XETCXETH: + fee: '0.1000' + minfee: '0.1000' + maxfee: '0.2600' + nextfee: + nextvolume: + tiervolume: '10000000.0000' + fees_maker: + XETCXETH: + fee: '0.0000' + minfee: '0.0000' + maxfee: '0.1600' + nextfee: + nextvolume: + tiervolume: '10000000.0000' diff --git a/spot-rest/schemas/objects/errors/error.yaml b/spot-rest/schemas/objects/errors/error.yaml new file mode 100644 index 0000000..57992cc --- /dev/null +++ b/spot-rest/schemas/objects/errors/error.yaml @@ -0,0 +1,19 @@ +type: array +items: + # title: Error + description: Kraken API error + type: string + example: "EGeneral:Invalid arguments" + # properties: + # value: + # type: object + # field: + # type: string + # type: + # type: string + # msg: + # type: string + # severity: + # type: string + # errorClass: + # type: string \ No newline at end of file diff --git a/spot-rest/schemas/objects/errors/validation.yaml b/spot-rest/schemas/objects/errors/validation.yaml new file mode 100644 index 0000000..e53a2a3 --- /dev/null +++ b/spot-rest/schemas/objects/errors/validation.yaml @@ -0,0 +1,10 @@ +title: Field Validation Error +description: Field validation error +type: object +properties: + field: + description: The field name + type: string + error: + description: Error message + type: string \ No newline at end of file diff --git a/spot-rest/schemas/objects/funding/deposits/address.yaml b/spot-rest/schemas/objects/funding/deposits/address.yaml new file mode 100644 index 0000000..5c66907 --- /dev/null +++ b/spot-rest/schemas/objects/funding/deposits/address.yaml @@ -0,0 +1,16 @@ +title: depositAddress +description: Deposit Address +type: object +properties: + address: + description: Deposit Address + type: string + expiretm: + description: Expiration time in unix timestamp, or 0 if not expiring + type: string + new: + description: Whether or not address has ever been used + type: boolean + tag: + description: Contains tags for [XRP](https://support.kraken.com/hc/en-us/articles/360000184443-Destination-Tag-for-Ripple-XRP-deposits) deposit addresses and memos for [STX](https://support.kraken.com/hc/en-us/articles/10902306995860-Memo-for-Stacks-STX-deposits), [XLM](https://support.kraken.com/hc/en-us/articles/360000184543-Memo-for-Stellar-Lumens-XLM-deposits), and [EOS](https://support.kraken.com/hc/en-us/articles/360001099203-Memo-for-EOS-deposits) deposit addresses + type: string diff --git a/spot-rest/schemas/objects/funding/deposits/deposit.yaml b/spot-rest/schemas/objects/funding/deposits/deposit.yaml new file mode 100644 index 0000000..83a0fdc --- /dev/null +++ b/spot-rest/schemas/objects/funding/deposits/deposit.yaml @@ -0,0 +1,50 @@ +title: deposit +description: deposit +type: object +properties: + method: + description: Name of deposit method + type: string + aclass: + description: Asset class + type: string + asset: + description: Asset + type: string + refid: + description: Reference ID + type: string + txid: + description: Method transaction ID + type: string + info: + description: Method transaction information + type: string + amount: + description: Amount deposited + type: string + fee: + description: Fees paid + time: + description: Unix timestamp when request was made + type: integer + format: int32 + status: + description: | + Status of deposit
+ For information about the status, please refer to the [IFEX financial transaction states](https://github.com/globalcitizen/ifex-protocol/blob/master/draft-ifex-00.txt#L837). + status-prop: + description: | + Addition status properties (if available)
+ * `return` A return transaction initiated by Kraken + * `onhold` Deposit is on hold pending review + type: string + enum: + - return + - onhold + originators: + description: | + Client sending transaction id(s) for deposits that credit with a sweeping transaction + type: array + items: + type: string diff --git a/spot-rest/schemas/objects/funding/deposits/method.yaml b/spot-rest/schemas/objects/funding/deposits/method.yaml new file mode 100644 index 0000000..83e6fbc --- /dev/null +++ b/spot-rest/schemas/objects/funding/deposits/method.yaml @@ -0,0 +1,21 @@ +title: depositMethod +description: Deposit Method +type: object +properties: + method: + description: Name of deposit method + type: string + limit: + description: Maximum net amount that can be deposited right now, or false if no limit + fee: + description: Amount of fees that will be paid + type: string + address-setup-fee: + description: Whether or not method has an address setup fee + type: string + gen-address: + type: boolean + description: Whether new addresses can be generated for this method. + minimum: + type: string + description: Minimum net amount that can be deposited right now \ No newline at end of file diff --git a/spot-rest/schemas/objects/funding/withdrawals/withdrawal.yaml b/spot-rest/schemas/objects/funding/withdrawals/withdrawal.yaml new file mode 100644 index 0000000..ff4d673 --- /dev/null +++ b/spot-rest/schemas/objects/funding/withdrawals/withdrawal.yaml @@ -0,0 +1,63 @@ +title: Withdrawal +description: Withdrawal +type: object +properties: + method: + description: Name of withdrawal method + type: string + network: + description: Network name based on the funding method used + type: string + aclass: + description: Asset class + type: string + asset: + description: Asset + type: string + refid: + description: Reference ID + type: string + txid: + description: Method transaction ID + type: string + info: + description: Method transaction information + type: string + amount: + description: Amount withdrawn + type: string + fee: + description: Fees paid + time: + description: Unix timestamp when request was made + type: integer + format: int32 + status: + description: | + Status of withdraw
+ For information about the status, please refer to the [IFEX financial transaction states](https://github.com/globalcitizen/ifex-protocol/blob/master/draft-ifex-00.txt#L837). + type: string + enum: + - Initial + - Pending + - Settled + - Success + - Failure + status-prop: + description: | + Addition status properties (if available)
+ * `cancel-pending` cancelation requested + * `canceled` canceled + * `cancel-denied` cancelation requested but was denied + * `return` a return transaction initiated by Kraken; it cannot be canceled + * `onhold` withdrawal is on hold pending review + type: string + enum: + - cancel-pending + - canceled + - cancel-denied + - return + - onhold + key: + description: Withdrawal key name, as set up on your account + type: string \ No newline at end of file diff --git a/spot-rest/schemas/objects/public/assets/info.yaml b/spot-rest/schemas/objects/public/assets/info.yaml new file mode 100644 index 0000000..735d7f3 --- /dev/null +++ b/spot-rest/schemas/objects/public/assets/info.yaml @@ -0,0 +1,24 @@ +title: AssetInfo +description: Asset Info +type: object +# additionalProperties: +# type: object +properties: + aclass: + description: Asset Class + type: string + altname: + description: Alternate name + type: string + decimals: + description: Number of decimal places for record keeping amounts of this asset + type: integer + display_decimals: + description: Number of decimal places shown for display purposes in frontends + type: integer + collateral_value: + description: Valuation as margin collateral (if applicable) + type: number + status: + description: 'Status of asset. Possible values: `enabled`, `deposit_only`, `withdrawal_only`, `funding_temporarily_disabled`.' + type: string diff --git a/spot-rest/schemas/objects/public/assets/pairs.yaml b/spot-rest/schemas/objects/public/assets/pairs.yaml new file mode 100644 index 0000000..35d08ad --- /dev/null +++ b/spot-rest/schemas/objects/public/assets/pairs.yaml @@ -0,0 +1,90 @@ +title: AssetPair +description: Trading Asset Pair +type: object +x-additionalPropertiesName: pair +properties: + altname: + description: Alternate pair name + type: string + wsname: + description: WebSocket pair name (if available) + type: string + aclass_base: + description: Asset class of base component + type: string + base: + description: Asset ID of base component + type: string + aclass_quote: + description: Asset class of quote component + type: string + quote: + description: Asset ID of quote component + type: string + lot: + description: Volume lot size + type: string + deprecated: true + pair_decimals: + description: Number of decimal places for prices in this pair + type: integer + cost_decimals: + description: Number of decimal places for cost of trades in pair (quote asset terms) + type: integer + lot_decimals: + description: Number of decimal places for volume (base asset terms) + type: integer + lot_multiplier: + description: Amount to multiply lot volume by to get currency volume + type: integer + leverage_buy: + description: Array of leverage amounts available when buying + type: array + items: + type: integer + leverage_sell: + description: Array of leverage amounts available when selling + type: array + items: + type: integer + fees: + description: Fee schedule array in `[, ]` tuples + type: array + items: + type: array + items: + type: number + fees_maker: + description: Maker fee schedule array in `[, ]` tuples (if on maker/taker) + type: array + items: + type: array + items: + type: number + fee_volume_currency: + description: Volume discount currency + type: string + margin_call: + description: Margin call level + type: integer + margin_stop: + description: Stop-out/liquidation margin level + type: integer + ordermin: + description: Minimum order size (in terms of base currency) + type: string + costmin: + description: Minimum order cost (in terms of quote currency) + type: string + tick_size: + description: Minimum increment between valid price levels + type: string + status: + description: 'Status of asset. Possible values: `online`, `cancel_only`, `post_only`, `limit_only`, `reduce_only`.' + type: string + long_position_limit: + description: Maximum long margin position size (in terms of base currency) + type: integer + short_position_limit: + description: Maximum short margin position size (in terms of base currency) + type: integer diff --git a/spot-rest/schemas/objects/public/orderBookEntry.yaml b/spot-rest/schemas/objects/public/orderBookEntry.yaml new file mode 100644 index 0000000..b9d6346 --- /dev/null +++ b/spot-rest/schemas/objects/public/orderBookEntry.yaml @@ -0,0 +1,38 @@ +title: OrderBook +description: Asset Pair Order Book Entries +type: object +properties: + asks: + description: Ask side array of entries `[, , ]` + type: array + items: + type: array + items: + minItems: 3 + maxItems: 3 + oneOf: + - type: string + title: string + - type: integer + title: integer + example: + - '3539.90000' + - '0.801' + - 1548119951 + bids: + description: Bid side array of entries `[, , ]` + type: array + items: + type: array + items: + minItems: 3 + maxItems: 3 + oneOf: + - type: string + title: string + - type: integer + title: integer + example: + - '3538.70000' + - '0.798' + - 1548119924 diff --git a/spot-rest/schemas/objects/public/spread.yaml b/spot-rest/schemas/objects/public/spread.yaml new file mode 100644 index 0000000..23715a1 --- /dev/null +++ b/spot-rest/schemas/objects/public/spread.yaml @@ -0,0 +1,17 @@ +title: SpreadData +description: | + Array of spread entries + `[int