Skip to content

Schemas

Response and request models generated from Kraken's OpenAPI specification. All models are attrs classes with to_dict() and from_dict() methods.

Market Data

Classes:

ServerTimeResponse

Success response

Attributes:

  • result (Union[Unset, ServerTime]) –
  • error (Union[Unset, List[str]]) –

Classes:

AssetInfo

Asset Info

Attributes:

  • aclass (Union[Unset, str]) –

    Asset Class

  • altname (Union[Unset, str]) –

    Alternate name

  • decimals (Union[Unset, int]) –

    Scaling decimal places for record keeping

  • display_decimals (Union[Unset, int]) –

    Scaling decimal places for output display

  • collateral_value (Union[Unset, float]) –

    Valuation as margin collateral (if applicable)

  • status (Union[Unset, str]) –

    Status of asset. Possible values: enabled, deposit_only, withdrawal_only, funding_temporarily_disabled.

Classes:

AssetTickerInfo

Asset Ticker Info

Attributes:

  • a (Union[Unset, List[str]]) –

    Ask [<price>, <whole lot volume>, <lot volume>]

  • b (Union[Unset, List[str]]) –

    Bid [<price>, <whole lot volume>, <lot volume>]

  • c (Union[Unset, List[str]]) –

    Last trade closed [<price>, <lot volume>]

  • v (Union[Unset, List[str]]) –

    TradeVolumeResponse [<today>, <last 24 hours>]

  • p (Union[Unset, List[str]]) –

    TradeVolumeResponse weighted average price [<today>, <last 24 hours>]

  • t (Union[Unset, List[int]]) –

    Number of trades [<today>, <last 24 hours>]

  • l (Union[Unset, List[str]]) –

    Low [<today>, <last 24 hours>]

  • h (Union[Unset, List[str]]) –

    High [<today>, <last 24 hours>]

  • o (Union[Unset, str]) –

    Today's opening price

Account Data

Classes:

AccountBalance

Account Balance

Example

{'ZUSD': '2970172.7962'}

Classes:

ExtendedBalance

Extended Balance

Attributes:

  • balance (Union[Unset, str]) –

    Total balance amount for an asset Example: 3.46840030.

  • credit (Union[Unset, str]) –

    Total credit amount (only applicable if account has a credit line) Example: 1.26844502.

  • credit_used (Union[Unset, str]) –

    Used credit amount (only applicable if account has a credit line) Example: 0.10002300.

  • hold_trade (Union[Unset, str]) –

    Total held amount for an asset Example: 2.14560458.

Trading

Classes:

AddOrderRequest

Attributes:

  • nonce (int) –

    Nonce used in construction of API-Sign header. Default ../security.get_nonce

  • ordertype (Ordertype) –

    Order type

  • type (TypeOrder) –

    Order direction (buy/sell)

  • volume (str) –

    Order quantity in terms of the base asset

    Note: TradeVolumeResponse can be specified as 0 for closing margin orders to automatically fill the requisite quantity.

  • pair (str) –

    Asset pair id or altname

  • userref (Union[Unset, int]) –

    User reference id

    userref is an optional user-specified integer id that can be associated with any number of orders. Many clients choose a userref corresponding to a unique integer id generated by their systems (e.g. a timestamp). However, because we don't enforce uniqueness on our side, it can also be used to easily group orders by pair, side, strategy, etc. This allows clients to more readily cancel or query information about orders in a particular group, with fewer API calls by using userref instead of our txid, where supported.

  • displayvol (Union[Unset, str]) –

    Used to create an iceberg order, this is the visible order quantity in terms of the base asset. The rest of the order will be hidden, although the full volume can be filled at any time by any order of that size or larger that matches in the order book. displayvol can only be used with the limit order type, must be greater than 0, and less than volume.

  • price (Union[Unset, str]) –

    Price:

    • Limit price for limit orders
    • Trigger price for stop-loss, stop-loss-limit, take-profit and take-profit-limit orders
  • price2 (Union[Unset, str]) –

    Secondary Price:

    • Limit price for stop-loss-limit and take-profit-limit orders

    Note: Either price or price2 can be preceded by +, -, or # to specify the order price as an offset relative to the last traded price. + adds the amount to, and - subtracts the amount from the last traded price. # will either add or subtract the amount to the last traded price, depending on the direction and order type used. Relative prices can be suffixed with a % to signify the relative amount as a percentage.

  • trigger (Union[Unset, Trigger]) –

    Price signal used to trigger stop-loss, stop- loss-limit, take-profit and take-profit-limit orders

    Note: This trigger type will as well be used for associated conditional close orders. Default: Trigger.LAST.

  • leverage (Union[Unset, str]) –

    Amount of leverage desired (default: none)

  • reduce_only (Union[Unset, bool]) –

    If true, order will only reduce a currently open position, not increase it or open a new position.

  • stptype (Union[Unset, SelfTradePreventionStrategy]) –

    Self trade prevention behavior definition: * cancel-newest - if self trade is triggered, arriving order will be canceled * cancel-oldest - if self trade is triggered, resting order will be canceled * cancel-both - if self trade is triggered, both arriving and resting orders will be canceled Default: SelfTradePreventionStrategy.CANCEL_NEWEST.

  • oflags (Union[Unset, str]) –

    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 for market orders
    • viqc order volume expressed in quote currency. This is supported only for market orders.
  • timeinforce (Union[Unset, TimeInForce]) –

    ServerTimeResponse-in-force of the order to specify how long it should remain in the order book before being cancelled. GTC (Good-'til-cancelled) is default if the parameter is omitted. IOC (immediate-or-cancel) will immediately execute the amount possible and cancel any remaining balance rather than resting in the book. GTD (good-'til-date), if specified, must coincide with a desired expiretm. Default: TimeInForce.GTC.

  • starttm (Union[Unset, str]) –

    Scheduled start time, can be specified as an absolute timestamp or as a number of seconds in the future: * 0 now (default) * <n> = unix timestamp of start time * +<n> = schedule start time <n> seconds from now * Note that URL encoding of the + character changes it to a space, so please use %2b followed by the number of seconds instead of +

  • expiretm (Union[Unset, str]) –

    Expiration time, also can be specified as an absolute timestamp or as a number of seconds in the future: * 0 no expiration (default) * <n> = unix timestamp of expiration time * +<n> = expire <n> seconds from now, minimum 5 seconds * Note that URL encoding of the + character changes it to a space, so please use %2b followed by the number of seconds instead of +

  • closeordertype (Union[Unset, ConditionalCloseOrderType]) –

    Conditional close order type

    Note: Conditional close orders are triggered by execution of the primary order in the same quantity and opposite direction, but once triggered are independent orders that may reduce or increase net position

  • closeprice (Union[Unset, str]) –

    Conditional close order price

  • closeprice2 (Union[Unset, str]) –

    Conditional close order price2

  • deadline (Union[Unset, str]) –

    RFC3339 timestamp (e.g. 2021-04-01T00:18:45Z) after which the matching engine should reject the new order request, in presence of latency or order queueing: min now() + 2 seconds, max now() + 60 seconds.

  • validate (Union[Unset, bool]) –

    Validate inputs only. Do not submit order.

Classes:

CancelOrderRequest

Attributes:

  • nonce (int) –

    Nonce used in construction of API-Sign header. Default get_nonce

  • txid (Union[int, str]) –

    Open order transaction ID (txid) or user reference (userref)

Funding

Classes:

DepositMethod

Deposit Method

Attributes:

  • method (Union[Unset, str]) –

    Name of deposit method

  • limit (Union[Unset, Any]) –

    Maximum net amount that can be deposited right now, or false if no limit

  • fee (Union[Unset, str]) –

    Amount of fees that will be paid

  • address_setup_fee (Union[Unset, str]) –

    Whether or not method has an address setup fee

  • gen_address (Union[Unset, bool]) –

    Whether new addresses can be generated for this method.

  • minimum (Union[Unset, str]) –

    Minimum net amount that can be deposited right now

Earn

Classes:

EarnStrategy

Parameters for a single strategy

Attributes:

  • allocation_fee (Union[float, int, str]) –

    Fee applied when allocating to this strategy

  • allocation_restriction_info (List[AllocationRestrictionInfo]) –

    Reason list why user is not eligible for allocating to the strategy

  • asset (str) –

    The asset to invest for this earn strategy

  • can_allocate (bool) –

    Is allocation available for this strategy

  • can_deallocate (bool) –

    Is deallocation available for this strategy

  • deallocation_fee (Union[float, int, str]) –

    Fee applied when deallocating from this strategy

  • id (str) –

    The unique identifier for this strategy

  • apr_estimate (Union[Unset, None, EarnStrategyAprEstimate]) –

    The estimate is based on previous revenues from the strategy.

  • user_cap (Union[Unset, None, str]) –

    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 (Union[Unset, None, str]) –

    Minimum amount (in USD) for an allocation or deallocation


For the full list of schemas, see the kraken_connector.schemas package source or use:

from kraken_connector import schemas
dir(schemas)