Kraken Websockets API 0.3.0

Overview

WebSockets API offers real-time market data updates. WebSockets is a bidirectional protocol offering fastest real-time data, helping you build real-time applications. The public message types presented below do not require authentication.

General Considerations

Connection details

  • Connection details for production environment:

    URL Scheme Description
    ws.kraken.com wss

    Once the socket is open you can subscribe to a public channel by sending a subscribe request message.

  • Connection details for authenticated production access:

    URL Scheme Description
    ws-auth.kraken.com wss

    Once the socket is open you can subscribe to both public and private channels by sending a subscribe request message.

  • Connection details for beta environment:

    URL Scheme Description
    beta-ws.kraken.com wss

    Once the socket is open you can subscribe to a public channel by sending a subscribe request message.
    Websockets Beta Documentation

    Authentication

    The API client must request an authentication "token" via the following REST API endpoint "GetWebSocketsToken" to connect to WebSockets Private endpoints. The token should be used within 15 minutes of creation. The token does not expire once a connection to a WebSockets API private message (openOrders or ownTrades) is maintained.

    Endpoint URL: https://api.kraken.com/0/private/GetWebSocketsToken

    The resulting token must be provided in the "token" field of any new private WebSocket feed subscription:

    {
      "event": "subscribe",
      "subscription":
      {
        "name": "ownTrades",
        "token": "WW91ciBhdXRoZW50aWNhdGlvbiB0b2tlbiBnb2VzIGhlcmUu"
      }
    }

    Supported Pairs

    ADA/CAD, ADA/ETH, ADA/EUR, ADA/USD, ADA/XBT, ATOM/CAD, ATOM/ETH, ATOM/EUR, ATOM/USD, ATOM/XBT, BAT/ETH, BAT/EUR, BAT/USD, BAT/XBT, BCH/EUR, BCH/USD, BCH/XBT, BTC/CAD, BTC/EUR, BTC/GBP, BTC/JPY, BTC/USD, DASH/EUR, DASH/USD, DASH/XBT, DOGE/XBT, EOS/ETH, EOS/EUR, EOS/USD, EOS/XBT, ETC/ETH, ETC/EUR, ETC/USD, ETC/XBT, ETH/CAD, ETH/EUR, ETH/GBP, ETH/JPY, ETH/USD, ETH/XBT, GNO/ETH, GNO/EUR, GNO/USD, GNO/XBT, LTC/EUR, LTC/USD, LTC/XBT, MLN/ETH, MLN/XBT, QTUM/CAD, QTUM/ETH, QTUM/EUR, QTUM/USD, QTUM/XBT, REP/ETH, REP/EUR, REP/USD, REP/XBT, STR/EUR, STR/USD, STR/XBT, USDT/USD, WAVES/ETH, WAVES/EUR, WAVES/USD, WAVES/XBT, XBT/CAD, XBT/EUR, XBT/GBP, XBT/JPY, XBT/USD, XDG/XBT, XLM/EUR, XLM/USD, XLM/XBT, XMR/EUR, XMR/USD, XMR/XBT, XRP/CAD, XRP/EUR, XRP/JPY, XRP/USD, XRP/XBT, XTZ/CAD, XTZ/ETH, XTZ/EUR, XTZ/USD, XTZ/XBT, ZEC/EUR, ZEC/JPY, ZEC/USD, ZEC/XBT

    Aliases: Few pairs have supported aliases. When a subscribe request is made for an alias pair, then the original pair is subscribed and is mentioned in the response payload. For example, XBT/USD is mentioned in response payload when a subscription is made for BTC/USD.

    Asset Name Symbol Alias
    Bitcoin XBT BTC
    Doge XDG DOGE
    Stellar XLM STR

    Error Types

    The following error messages are thrown as part of subscriptionStatus message.

    The following error messages may be thrown for public data requests:

    • Currency pair not in ISO 4217-A3 format
    • Malformed request
    • Pair field must be an array
    • Pair field unsupported for this subscription type
    • Pair(s) not found
    • Subscription book depth must be an integer
    • Subscription depth not supported
    • Subscription field must be an object
    • Subscription name invalid
    • Subscription object unsupported field
    • Subscription ohlc interval must be an integer
    • Subscription ohlc interval not supported
    • Subscription ohlc requires interval

    The following error messages may be thrown for private data requests:

    • EAccount:Invalid permissions
    • EAuth:Account temporary disabled
    • EAuth:Account unconfirmed
    • EAuth:Rate limit exceeded
    • EAuth:Too many requests
    • EGeneral:Invalid arguments
    • EOrder:Cannot open opposing position
    • EOrder:Cannot open position
    • EOrder:Insufficient funds (insufficient user funds)
    • EOrder:Insufficient margin (exchange does not have sufficient funds to allow margin trading)
    • EOrder:Margin allowance exceeded
    • EOrder:Margin level too low
    • EOrder:Order minimum not met (volume too low)
    • EOrder:Orders limit exceeded
    • EOrder:Positions limit exceeded
    • EOrder:Rate limit exceeded
    • EOrder:Scheduled orders limit exceeded
    • EOrder:Unknown position
    • EService:Unavailable
    • ETrade:Invalid request

    Example API Clients

    Below are sample API client code libraries that can be used when writing your own API client. Please keep in mind that Payward nor the third party authors are responsible for losses due to bugs or improper use of the APIs. Payward has performed an initial review of the safety of the third party code before listing them but cannot vouch for any changes added since then. If you have concerns, please contact support.

    Messages

    ping

    Request. Client can ping server to determine whether connection is alive, server responds with pong. This is an application level ping as opposed to default ping in websockets standard which is server initiated

    Payload

    Name Type Description
    event string
    reqid integer Optional, client originated ID reflected in response message.

    Example of payload

    {
      "event": "ping",
      "reqid": 42
    }

    pong

    Response. Server pong response to a ping to determine whether connection is alive. This is an application level pong as opposed to default pong in websockets standard which is sent by client in response to a ping

    Payload

    Name Type Description
    event string
    reqid integer Optional, matching client originated request ID.

    Example of payload

    {
      "event": "pong",
      "reqid": 42
    }

    heartbeat

    Publication: Server heartbeat sent if no subscription traffic within 1 second (approximately)

    Payload

    Name Type Description
    event string

    Example of payload

    {
      "event": "heartbeat"
    }

    systemStatus

    Publication: Status sent on connection or system status changes.

    Payload

    Name Type Description
    connectionID integer Connection ID
    event string systemStatus
    status string online|maintenance|(custom status tbd)
    version string

    Example of payload

    {
      "connectionID": 8628615390848610000,
      "event": "systemStatus",
      "status": "online",
      "version": "1.0.0"
    }

    subscribe

    Request. Subscribe to a topic on a single or multiple currency pairs.

    Payload

    Name Type Description
    event string subscribe
    reqid integer Optional, client originated ID reflected in response message.
    pair array Optional - Array of currency pairs. Format of each pair is "A/B", where A and B are ISO 4217-A3 for standardized assets and popular unique symbol if not standardized.
    subscription object
    depth integer Optional - depth associated with book subscription in float of levels each side, default 10. Valid Options are: 10, 25, 100, 500, 1000
    interval integer Optional - Time interval associated with ohlc subscription in minutes. Default 1. Valid Interval values: 1|5|15|30|60|240|1440|10080|21600
    token string Optional, base64-encoded authentication token for private-data endpoints.
    name string ticker|ohlc|trade|book|spread|ownTrades|openOrders|*, * for all available channels depending on the connected environment (ohlc interval value is 1 if all public channels subscribed)

    Example of payload

    {
      "event": "subscribe",
      "pair": [
        "XBT/USD",
        "XBT/EUR"
      ],
      "subscription": {
        "name": "ticker"
      }
    }
    {
      "event": "subscribe",
      "pair": [
        "XBT/EUR"
      ],
      "subscription": {
        "interval": 5,
        "name": "ohlc"
      }
    }
    {
      "event": "subscribe",
      "subscription": {
        "name": "ownTrades",
        "token": "WW91ciBhdXRoZW50aWNhdGlvbiB0b2tlbiBnb2VzIGhlcmUu"
      }
    }

    unsubscribe

    Request. Unsubscribe, can specify a channelID or multiple currency pairs.

    Payload

    Name Type Description
    Message Payload oneOf
    Anonymous object
    event string unsubscribe
    reqid integer Optional, client originated ID reflected in response message.
    pair array Optional - Array of currency pairs. Format of each pair is "A/B", where A and B are ISO 4217-A3 for standardized assets and popular unique symbol if not standardized.
    subscription object
    depth integer Optional - depth associated with book subscription in float of levels each side, default 10. Valid Options are: 10, 25, 100, 500, 1000
    interval integer Optional - Time interval associated with ohlc subscription in minutes. Default 1. Valid Interval values: 1|5|15|30|60|240|1440|10080|21600
    token string Optional, base64-encoded authentication token for private-data endpoints.
    name string ticker|ohlc|trade|book|spread|ownTrades|openOrders|*, * for all available channels depending on the connected environment (ohlc interval value is 1 if all public channels subscribed)
    Anonymous object
    event string unsubscribe
    reqid integer Optional, client originated ID reflected in response message.
    channelID integer ChannelID associated with pair subscription

    Example of payload

    {
      "event": "unsubscribe",
      "pair": [
        "XBT/EUR",
        "XBT/USD"
      ],
      "subscription": {
        "name": "ticker"
      }
    }
    {
      "channelID": 10001,
      "event": "unsubscribe"
    }
    {
      "event": "unsubscribe",
      "subscription": {
        "name": "ownTrades",
        "token": "WW91ciBhdXRoZW50aWNhdGlvbiB0b2tlbiBnb2VzIGhlcmUu"
      }
    }

    subscriptionStatus

    Response. Subscription status response to subscribe, unsubscribe or exchange initiated unsubscribe.

    Payload

    Name Type Description
    channelID integer ChannelID on successful subscription, applicable to public messages only
    channelName string Channel Name on successful subscription. For payloads 'ohlc' and 'book', respective interval or depth will be added as suffix.
    event string
    reqid integer Optional, matching client originated request ID.
    pair string Currency pair, applicable to public messages only
    status string Status of subscription
    subscription object
    depth integer Optional - depth associated with book subscription in float of levels each side, default 10. Valid Options are: 10, 25, 100, 500, 1000
    interval integer Optional - Time interval associated with ohlc subscription in minutes. Default 1. Valid Interval values: 1|5|15|30|60|240|1440|10080|21600
    token string Optional, base64-encoded authentication token for private-data endpoints.
    name string ticker|ohlc|trade|book|spread|ownTrades|openOrders|*, * for all available channels depending on the connected environment (ohlc interval value is 1 if all public channels subscribed)
    OneOf oneOf
    errorMessage string Error message
    channelID integer ChannelID on successful subscription operation, applicable to public messages only

    Example of payload

    {
      "channelID": 10001,
      "channelName": "ticker",
      "event": "subscriptionStatus",
      "pair": "XBT/EUR",
      "status": "subscribed",
      "subscription": {
        "name": "ticker"
      }
    }
    {
      "channelID": 10001,
      "channelName": "ohlc-5",
      "event": "subscriptionStatus",
      "pair": "XBT/EUR",
      "reqID": 42,
      "status": "unsubscribed",
      "subscription": {
        "interval": 5,
        "name": "ohlc"
      }
    }
    {
      "channelName": "ownTrades",
      "event": "subscriptionStatus",
      "status": "subscribed",
      "subscription": {
        "name": "ownTrades"
      }
    }
    {
      "errorMessage": "Subscription depth not supported",
      "event": "subscriptionStatus",
      "pair": "XBT/USD",
      "status": "error",
      "subscription": {
        "depth": 42,
        "name": "book"
      }
    }

    ticker

    Publication: Ticker information on currency pair.

    Payload

    Name Type Description
    channelID integer ChannelID of pair-ticker subscription
    (Anonymous) object
    a array Ask
    price float Best bid price
    wholeLotVolume integer Whole lot volume
    lotVolume float Lot volume
    b array Bid
    price float Best bid price
    wholeLotVolume integer Whole lot volume
    lotVolume float Lot volume
    c array Close
    price float Price
    lotVolume float Lot volume
    v array Volume
    today float Value today
    last24Hours float Value 24 hours ago
    p array Volume weighted average price
    today float Value today
    last24Hours float Value 24 hours ago
    t array Number of trades
    today float Value today
    last24Hours float Value 24 hours ago
    l array Low price
    today float Value today
    last24Hours float Value 24 hours ago
    h array High price
    today float Value today
    last24Hours float Value 24 hours ago
    o array Open Price
    today float Value today
    last24Hours float Value 24 hours ago
    channelName string Channel Name of subscription
    pair string Asset pair

    Example of payload

    [
      0,
      {
        "a": [
          "5525.40000",
          1,
          "1.000"
        ],
        "b": [
          "5525.10000",
          1,
          "1.000"
        ],
        "c": [
          "5525.10000",
          "0.00398963"
        ],
        "h": [
          "5783.00000",
          "5783.00000"
        ],
        "l": [
          "5505.00000",
          "5505.00000"
        ],
        "o": [
          "5760.70000",
          "5763.40000"
        ],
        "p": [
          "5631.44067",
          "5653.78939"
        ],
        "t": [
          11493,
          16267
        ],
        "v": [
          "2634.11501494",
          "3591.17907851"
        ]
      },
      "ticker",
      "XBT/USD"
    ]

    ohlc

    Publication: Open High Low Close (Candle) feed for a currency pair and interval period.

    Description: When subscribed for OHLC, a snapshot of the last valid candle (irrespective of the endtime) will be sent, followed by updates to the running candle. For example, if a subscription is made to 1 min candle and there have been no trades for 5 mins, a snapshot of the last 1 min candle from 5 mins ago will be published. The endtime can be used to determine that it is an old candle.

    Payload

    Name Type Description
    channelID integer ChannelID of pair-ohlc subscription
    Array array
    time integer Time, seconds since epoch
    etime integer End timestamp of the interval
    open float Open price at midnight UTC
    high float Intraday high price
    low float Intraday low price
    close float Closing price at midnight UTC
    vwap float Volume weighted average price
    volume integer Accumulated volume today
    count integer Number of trades today
    channelName string Channel Name of subscription
    pair string Asset pair

    Example of payload

    [
      42,
      [
        "1542057314.748456",
        "1542057360.435743",
        "3586.70000",
        "3586.70000",
        "3586.60000",
        "3586.60000",
        "3586.68894",
        "0.03373000",
        2
      ],
      "ohlc-5",
      "XBT/USD"
    ]

    trade

    Publication: Trade feed for a currency pair.

    Payload

    Name Type Description
    channelID integer ChannelID of pair-trade subscription
    Array array
    Array array
    price float Price
    volume float Volume
    time integer Time, seconds since epoch
    side string Triggering order side, buy/sell
    orderType string Triggering order type market/limit
    misc string Miscellaneous
    channelName string Channel Name of subscription
    pair string Asset pair

    Example of payload

    [
      0,
      [
        [
          "5541.20000",
          "0.15850568",
          "1534614057.321597",
          "s",
          "l",
          ""
        ],
        [
          "6060.00000",
          "0.02455000",
          "1534614057.324998",
          "b",
          "l",
          ""
        ]
      ],
      "trade",
      "XBT/USD"
    ]

    spread

    Publication: Spread feed for a currency pair.

    Payload

    Name Type Description
    channelID integer ChannelID of pair-spreads subscription
    Array array
    bid float Bid price
    ask integer Ask price
    timestamp integer Time, seconds since epoch
    bidVolume float Bid Volume
    askVolume float Ask Volume
    channelName string Channel Name of subscription
    pair string Asset pair

    Example of payload

    [
      0,
      [
        "5698.40000",
        "5700.00000",
        "1542057299.545897",
        "1.01234567",
        "0.98765432"
      ],
      "spread",
      "XBT/USD"
    ]

    book

    Publication: Order book levels. On subscription, a snapshot will be published at the specified depth, following the snapshot, level updates will be published

    Snapshot payload

    Name Type Description
    channelID integer ChannelID of pair-order book levels subscription
    (Anonymous) object
    as array Array of price levels, ascending from best ask
    Array array Anonymous array of level values
    price float Price level
    volume float Price level volume, for updates volume = 0 for level removal/deletion
    timestamp integer Price level last updated, seconds since epoch
    bs array Array of price levels, descending from best bid
    Array array Anonymous array of level values
    price float Price level
    volume float Price level volume, for updates volume = 0 for level removal/deletion
    timestamp integer Price level last updated, seconds since epoch
    channelName string Channel Name of subscription
    pair string Asset pair

    Example of snapshot payload

    [
      0,
      {
        "as": [
          [
            "5541.30000",
            "2.50700000",
            "1534614248.123678"
          ],
          [
            "5541.80000",
            "0.33000000",
            "1534614098.345543"
          ],
          [
            "5542.70000",
            "0.64700000",
            "1534614244.654432"
          ]
        ],
        "bs": [
          [
            "5541.20000",
            "1.52900000",
            "1534614248.765567"
          ],
          [
            "5539.90000",
            "0.30000000",
            "1534614241.769870"
          ],
          [
            "5539.50000",
            "5.00000000",
            "1534613831.243486"
          ]
        ]
      },
      "book-100",
      "XBT/USD"
    ]

    Update payload

    Name Type Description
    channelID integer ChannelID of pair-order book levels subscription
    AnyOf anyOf
    a array Ask array of level updates.
    Array array Anonymous array of level values
    price float Price level
    volume float Price level volume, for updates volume = 0 for level removal/deletion
    timestamp integer Price level last updated, seconds since epoch
    updateType string "r" to show republish updates, optional field
    b array Bid array of level updates.
    Array array Anonymous array of level values
    price float Price level
    volume float Price level volume, for updates volume = 0 for level removal/deletion
    timestamp integer Price level last updated, seconds since epoch
    updateType string "r" to show republish updates, optional field
    channelName string Channel Name of subscription
    pair string Asset pair

    Example of update payload

    [
      1234,
      {
        "a": [
          [
            "5541.30000",
            "2.50700000",
            "1534614248.456738"
          ],
          [
            "5542.50000",
            "0.40100000",
            "1534614248.456738"
          ]
        ]
      },
      "book-10",
      "XBT/USD"
    ]
    [
      1234,
      {
        "b": [
          [
            "5541.30000",
            "0.00000000",
            "1534614335.345903"
          ]
        ]
      },
      "book-10",
      "XBT/USD"
    ]
    [
      1234,
      {
        "a": [
          [
            "5541.30000",
            "2.50700000",
            "1534614248.456738"
          ],
          [
            "5542.50000",
            "0.40100000",
            "1534614248.456738"
          ]
        ]
      },
      {
        "b": [
          [
            "5541.30000",
            "0.00000000",
            "1534614335.345903"
          ]
        ]
      },
      "book-10",
      "XBT/USD"
    ]

    Example of republish payload

    [
      1234,
      {
        "a": [
          [
            "5541.30000",
            "2.50700000",
            "1534614248.456738",
            "r"
          ],
          [
            "5542.50000",
            "0.40100000",
            "1534614248.456738",
            "r"
          ]
        ]
      },
      "book-25",
      "XBT/USD"
    ]

    ownTrades

    Publication: Own trades. On subscription last 50 trades for the user will be sent, followed by new trades.

    Payload

    Name Type Description
    (Dictionary) object
    tradeid object Trade object
    ordertxid string order responsible for execution of trade
    postxid string Position trade id
    pair string Asset pair
    time float unix timestamp of trade
    type string type of order (buy/sell)
    ordertype string order type
    price float average price order was executed at (quote currency)
    cost float total cost of order (quote currency)
    fee float total fee (quote currency)
    vol float volume (base currency)
    margin float initial margin (quote currency)
    channelName string Channel Name of subscription

    Example of payload

    [
      [
        {
          "TDLH43-DVQXD-2KHVYY": {
            "cost": "1000000.00000",
            "fee": "1600.00000",
            "margin": "0.00000",
            "ordertxid": "TDLH43-DVQXD-2KHVYY",
            "ordertype": "limit",
            "pair": "XBT/EUR",
            "postxid": "OGTT3Y-C6I3P-XRI6HX",
            "price": "100000.00000",
            "time": "1560516023.070651",
            "type": "sell",
            "vol": "1000000000.00000000"
          }
        },
        {
          "TDLH43-DVQXD-2KHVYY": {
            "cost": "1000000.00000",
            "fee": "600.00000",
            "margin": "0.00000",
            "ordertxid": "TDLH43-DVQXD-2KHVYY",
            "ordertype": "limit",
            "pair": "XBT/EUR",
            "postxid": "OGTT3Y-C6I3P-XRI6HX",
            "price": "100000.00000",
            "time": "1560516023.070658",
            "type": "buy",
            "vol": "1000000000.00000000"
          }
        },
        {
          "TDLH43-DVQXD-2KHVYY": {
            "cost": "1000000.00000",
            "fee": "1600.00000",
            "margin": "0.00000",
            "ordertxid": "TDLH43-DVQXD-2KHVYY",
            "ordertype": "limit",
            "pair": "XBT/EUR",
            "postxid": "OGTT3Y-C6I3P-XRI6HX",
            "price": "100000.00000",
            "time": "1560520332.914657",
            "type": "sell",
            "vol": "1000000000.00000000"
          }
        },
        {
          "TDLH43-DVQXD-2KHVYY": {
            "cost": "1000000.00000",
            "fee": "600.00000",
            "margin": "0.00000",
            "ordertxid": "TDLH43-DVQXD-2KHVYY",
            "ordertype": "limit",
            "pair": "XBT/EUR",
            "postxid": "OGTT3Y-C6I3P-XRI6HX",
            "price": "100000.00000",
            "time": "1560520332.914664",
            "type": "buy",
            "vol": "1000000000.00000000"
          }
        }
      ],
      "ownTrades"
    ]

    openOrders

    Publication: Open orders. Feed to show all the open orders belonging to the user authenticated API key. Initial snapshot will provide list of all open orders and then any updates to the open orders list will be sent. For status change updates, such as 'closed', the fields orderid and status will be present in the payload.

    Payload

    Name Type Description
    (Dictionary) object
    orderid object Order object
    refid string Referral order transaction id that created this order
    userref integer user reference id
    status string status of order:
    opentm float unix timestamp of when order was placed
    starttm float unix timestamp of order start time (if set)
    expiretm float unix timestamp of order end time (if set)
    descr object order description info
    pair string asset pair
    type string type of order (buy/sell)
    ordertype string order type
    price float primary price
    price2 float secondary price
    leverage float amount of leverage
    order string order description
    close string conditional close order description (if conditional close set)
    vol float volume of order (base currency unless viqc set in oflags)
    vol_exec float volume executed (base currency unless viqc set in oflags)
    cost float total cost (quote currency unless unless viqc set in oflags)
    fee float total fee (quote currency)
    price float average price (quote currency unless viqc set in oflags)
    stopprice float stop price (quote currency, for trailing stops)
    limitprice float triggered limit price (quote currency, when limit based order type triggered)
    misc string comma delimited list of miscellaneous info: stopped=triggered by stop price, touched=triggered by touch price, liquidation=liquidation, partial=partial fill
    oflags string Comma delimited list of order flags (optional). viqc = volume in quote currency (not available for leveraged orders), fcib = prefer fee in base currency, fciq = prefer fee in quote currency, nompp = no market price protection, post = post only order (available when ordertype = limit)
    channelName string Channel Name of subscription

    Example of payload

    [
      [
        {
          "OGTT3Y-C6I3P-XRI6HX": {
            "cost": "0.00000",
            "descr": {
              "close": "",
              "leverage": "0:1",
              "order": "sell 10.00345345 XBT/EUR @ limit 34.50000 with 0:1 leverage",
              "ordertype": "limit",
              "pair": "XBT/EUR",
              "price": "34.50000",
              "price2": "0.00000",
              "type": "sell"
            },
            "expiretm": "0.000000",
            "fee": "0.00000",
            "limitprice": "34.50000",
            "misc": "",
            "oflags": "fcib",
            "opentm": "0.000000",
            "price": "34.50000",
            "refid": "OKIVMP-5GVZN-Z2D2UA",
            "starttm": "0.000000",
            "status": "open",
            "stopprice": "0.000000",
            "userref": 0,
            "vol": "10.00345345",
            "vol_exec": "0.00000000"
          }
        },
        {
          "OGTT3Y-C6I3P-XRI6HX": {
            "cost": "0.00000",
            "descr": {
              "close": "",
              "leverage": "0:1",
              "order": "sell 0.00000010 XBT/EUR @ limit 5334.60000 with 0:1 leverage",
              "ordertype": "limit",
              "pair": "XBT/EUR",
              "price": "5334.60000",
              "price2": "0.00000",
              "type": "sell"
            },
            "expiretm": "0.000000",
            "fee": "0.00000",
            "limitprice": "5334.60000",
            "misc": "",
            "oflags": "fcib",
            "opentm": "0.000000",
            "price": "5334.60000",
            "refid": "OKIVMP-5GVZN-Z2D2UA",
            "starttm": "0.000000",
            "status": "open",
            "stopprice": "0.000000",
            "userref": 0,
            "vol": "0.00000010",
            "vol_exec": "0.00000000"
          }
        },
        {
          "OGTT3Y-C6I3P-XRI6HX": {
            "cost": "0.00000",
            "descr": {
              "close": "",
              "leverage": "0:1",
              "order": "sell 0.00001000 XBT/EUR @ limit 90.40000 with 0:1 leverage",
              "ordertype": "limit",
              "pair": "XBT/EUR",
              "price": "90.40000",
              "price2": "0.00000",
              "type": "sell"
            },
            "expiretm": "0.000000",
            "fee": "0.00000",
            "limitprice": "90.40000",
            "misc": "",
            "oflags": "fcib",
            "opentm": "0.000000",
            "price": "90.40000",
            "refid": "OKIVMP-5GVZN-Z2D2UA",
            "starttm": "0.000000",
            "status": "open",
            "stopprice": "0.000000",
            "userref": 0,
            "vol": "0.00001000",
            "vol_exec": "0.00000000"
          }
        },
        {
          "OGTT3Y-C6I3P-XRI6HX": {
            "cost": "0.00000",
            "descr": {
              "close": "",
              "leverage": "0:1",
              "order": "sell 0.00001000 XBT/EUR @ limit 9.00000 with 0:1 leverage",
              "ordertype": "limit",
              "pair": "XBT/EUR",
              "price": "9.00000",
              "price2": "0.00000",
              "type": "sell"
            },
            "expiretm": "0.000000",
            "fee": "0.00000",
            "limitprice": "9.00000",
            "misc": "",
            "oflags": "fcib",
            "opentm": "0.000000",
            "price": "9.00000",
            "refid": "OKIVMP-5GVZN-Z2D2UA",
            "starttm": "0.000000",
            "status": "open",
            "stopprice": "0.000000",
            "userref": 0,
            "vol": "0.00001000",
            "vol_exec": "0.00000000"
          }
        }
      ],
      "openOrders"
    ]

    Example of status-change payload

    [
      [
        {
          "OGTT3Y-C6I3P-XRI6HX": {
            "status": "closed"
          }
        },
        {
          "OGTT3Y-C6I3P-XRI6HX": {
            "status": "closed"
          }
        }
      ],
      "openOrders"
    ]

    addOrder

    Request. Add new order.

    Payload

    Name Type Description
    event string addOrder
    token string Session token string
    ordertype string Order type
    type string Side, buy or sell
    pair string Currency pair
    price float **Optional dependent on order type. Order price
    price2 float **Optional dependent on order type. Order secondary price
    volume float Order volume in lots
    leverage float amount of leverage desired (optional. default = none)
    oflags string Comma delimited list of order flags (optional). viqc = volume in quote currency (not available for leveraged orders), fcib = prefer fee in base currency, fciq = prefer fee in quote currency, nompp = no market price protection, post = post only order (available when ordertype = limit)
    starttm string Scheduled start time (optional) 0 = now (default) +<n> = schedule start time <n> seconds from now <n> = unix timestamp of start time
    expiretm string Expiration time (optional) 0 = no expiration (default) +<n> = expire <n> seconds from now <n> = unix timestamp of expiration time
    userref string User reference id. 32-bit signed float. (optional)
    validate string Validate inputs only. Do not submit order (optional)
    close[ordertype] string **Optional dependent on order type. Order type.
    close[price] float **Optional dependent on order type. Close order price
    close[price2] float **Optional dependent on order type. Close order secondary price

    Example of payload

    {
      "close[price]": "12",
      "event": "addOrder",
      "ordertype": "limit",
      "pair": "BTC/EUR",
      "price": "1",
      "token": "0000000000000000000000000000000000000000",
      "type": "buy",
      "volume": "10"
    }

    Response payload

    Name Type Description
    event string addOrderStatus
    status string Status. "ok" or "error"
    txid string order ID (if successful)
    descr string order description info (if successful)
    errorMessage string error message (if unsuccessful)

    Example of payload

    {
      "descr": "buy 0.01770000 XBTUSD @ limit 4000",
      "event": "addOrderStatus",
      "status": "ok",
      "txid": "ONPNXH-KMKMU-F4MR5V"
    }
    {
      "errorMessage": "EOrder:Order minimum not met",
      "event": "addOrderStatus",
      "status": "error"
    }

    cancelOrder

    Request. Cancel order or list of orders.

    Payload

    Name Type Description
    event string cancelOrder
    token string Session token string
    txid array Array of order IDs to be canceled. These can be user reference IDs.

    Example of payload

    {
      "event": "cancelOrder",
      "token": "0000000000000000000000000000000000000000",
      "txid": [
        "OGTT3Y-C6I3P-XRI6HX",
        "OGTT3Y-C6I3P-X2I6HX"
      ]
    }

    Response payload

    Name Type Description
    event string cancelOrderStatus
    status string Status. "ok" or "error"
    errorMessage string error message (if unsuccessful)

    Example of payload

    {
      "event": "cancelOrderStatus",
      "status": "ok"
    }
    {
      "errorMessage": "EOrder:Unknown order",
      "event": "cancelOrderStatus",
      "status": "error"
    }
  • 148053