Posted on

BITCOINPROSPER WEBSOCKET API

Overview

Bitcoin Prosper supports two ways for disseminating real-time public data. The Push API method mentioned in https://BitcoinProsper.com/support/api/v1/ uses WAMP protocol and requires autobahn. This method has been deprecated. The second method uses plain old websockets and this document describes the request and response formats with examples.

URL

wss://api2.BitcoinProsper.com

Channels

The following <channel id> – <channel name> are supported.

1010 Heartbeat
1002 Ticker
1003 24 hour Exchange Volume

Order Books: The ids below serve as <channel id> and <currency pair id>

7 BTC_BCN
8 BTC_BELA
10 BTC_BLK
12 BTC_BTCD
13 BTC_BTM
14 BTC_BTS
15 BTC_BURST
20 BTC_CLAM
24 BTC_DASH
25 BTC_DGB
27 BTC_DOGE
28 BTC_EMC2
31 BTC_FLDC
32 BTC_FLO
38 BTC_GAME
40 BTC_GRC
43 BTC_HUC
50 BTC_LTC
51 BTC_MAID
58 BTC_OMNI
61 BTC_NAV
63 BTC_NEOS
64 BTC_NMC
69 BTC_NXT
73 BTC_PINK
74 BTC_POT
75 BTC_PPC
83 BTC_RIC
89 BTC_STR
92 BTC_SYS
97 BTC_VIA
98 BTC_XVC
99 BTC_VRC
100 BTC_VTC
104 BTC_XBC
108 BTC_XCP
112 BTC_XEM
114 BTC_XMR
116 BTC_XPM
117 BTC_XRP
121 USDT_BTC
122 USDT_DASH
123 USDT_LTC
124 USDT_NXT
125 USDT_STR
126 USDT_XMR
127 USDT_XRP
129 XMR_BCN
130 XMR_BLK
131 XMR_BTCD
132 XMR_DASH
137 XMR_LTC
138 XMR_MAID
140 XMR_NXT
148 BTC_ETH
149 USDT_ETH
150 BTC_SC
151 BTC_BCY
153 BTC_EXP
155 BTC_FCT
158 BTC_RADS
160 BTC_AMP
162 BTC_DCR
163 BTC_LSK
166 ETH_LSK
167 BTC_LBC
168 BTC_STEEM
169 ETH_STEEM
170 BTC_SBD
171 BTC_ETC
172 ETH_ETC
173 USDT_ETC
174 BTC_REP
175 USDT_REP
176 ETH_REP
177 BTC_ARDR
178 BTC_ZEC
179 ETH_ZEC
180 USDT_ZEC
181 XMR_ZEC
182 BTC_STRAT
183 BTC_NXC
184 BTC_PASC
185 BTC_GNT
186 ETH_GNT
187 BTC_GNO
188 ETH_GNO
189 BTC_BCH
190 ETH_BCH
191 USDT_BCH
192 BTC_ZRX
193 ETH_ZRX
194 BTC_CVC
195 ETH_CVC
196 BTC_OMG
197 ETH_OMG
198 BTC_GAS
199 ETH_GAS
200 BTC_STORJ

Requests and Response

There are two type of requests supported; subscribe and unsubscribe. The requests are for a specific channel. For non-book requests, the first response is always an acknowledgement of the request. All channel updates are of the following format

  [<channel>, <sequence id>, <update data...>]

<sequence id> is a number increasing by one with each update and is unique within its channel. The sequence-id is always null for non-book channels.

Subscribe

Subscribe to real-time streaming data by channel. The request body is JSON object.

  {
    "command": "subscribe",
    "channel": "<channel id>"
  }

The <channel id> is the number from the Channels section documented earlier.

Ticker

Subscribe to ticker updates for all currency pairs.

Subscription example

  {
    "command": "subscribe",
    "channel": 1002
  }

The first message is acknowledgement of the subscription.

  [<id>, 1]

Subsequent messages are ticker updates.

  [
    <id>,
    null,
    [
      <currency pair id>,
      "<last trade price>",
      "<lowest ask>",
      "<highest bid>",
      "<percent change in last 24 hours>",
      "<base currency volume in last 24 hours>",
      "<quote currency volume in last 24 hours>",
      <is frozen>,
      "<highest trade price in last 24 hours>",
      "<lowest trade price in last 24 hours>"
    ],
     …
  ]

For example:

  [
    1002,
    null,
    [
      149,
      "382.98901522",
      "381.99755898",
      "379.41296309",
      "-0.04312950",
      "14969820.94951828",
      "38859.58435407",
      0,
      "412.25844455",
      "364.56122072"
    ]
  ]

<currency pair id> is the same as the order book channel number.

Price Aggregated Book

Subscribe to price aggregated depth of book by currency pair. Response includes an initial book snapshot, book modifications, and trades. Book modification updates with 0 quantity should be treated as removal of the price level. Note that the updates are price aggregated and do not contain individual orders.

Subscription example for BTC_BTS pair (id is 14). You can either subscribe using the currency pair ID or name.

  {
    "command":"subscribe",
    "channel": 14
  }

Or

  {
    "command": "subscribe",
    "channel": "BTC_BTS"
  }

The first response is the initial dump of the book

  [
    <channel id>,
    <sequence number>,
    [
      "i",
      {
        "currencyPair": "<currency pair name>",
        "orderBook": [
          {
            "<lowest ask price>": "<lowest ask size>",
            "<next ask price>": "<next ask size>",
            …
          },
          {
            "<highest bid price>": "<highest bid size>",
            "<next bid price>": "<next bid size>",
            …
          }
        ]
      }
    ]
  ]

For example:

  [
    14,
    8767,
    [
      "i",
      {
        "currencyPair": "BTC_BTS",
        "orderBook": [
          {
            "0.00001853": "2537.5637",
            "0.00001854": "1567238.172367"
          },
          {
            "0.00001841": "3645.3647",
            "0.00001840": "1637.3647"
          }
        ]
      }
    ]
  ]

Subsequent responses are updates to the book and trades

  [
    <channel id>,
    <sequence number>,
    ["o", <1 for buy 0 for sell>, "<price>", "<size>"],
    ["o", <1 for buy 0 for sell>, "<price>", "<size>"],
    ["t", "<trade id>", <1 for buy 0 for sell>, "<size>", "<price>", <timestamp>]
    …
  ]

For example

  [
    14,
    8768,
    ["o", 1, "0.00001823", "5534.6474"],
    ["o", 0, "0.00001824", "6575.464"],
    ["t", "42706057", 1, "0.05567134", "0.00181421", 1522877119]
  ]

Exchange Volume

Subscribe to 24 hour exchange volume statistics. Updates are sent every 20 seconds.

Subscription example for exchange volume

  {
    "command": "subscribe",
    "channel": 1003
  }

The first response is acknowledgement of subscription

  [<channel id>, 1]

For example:

  [1003, 1]

Subsequent responses are exchange volume update sent every 20 seconds. Base currencies are BTC, ETH, XMR, USDT

  [
    <channel id>,
    null,
    [
      "<time as YYYY-MM-DD HH:SS>",
      "<number of users online>",
      {
        "<base currency>": "<24 hours volume>",
        …
      }
    ]
  ]

For example

  [
    1003,
    null,
    [
      "2018-04-04 21:33",
      8592,
      {
        "BTC": "6482.518",
        "ETH": "1315.332",
        "XMR": "179.914",
        "USDT": "42935638.731"
      }
    ]
  ]

Unsubscribe

  {
    "command": "unsubscribe",
    "channel": <channel id>
  }

Heartbeats

When no messages have been sent out for one second, the server will send a heartbeat message as follows. Absence of heartbeats indicates a protocol or networking issue and the client application is expected to close the socket and try again.

  [1010]
Leave a Reply

Review now to get coupon!

Your email address will not be published. Required fields are marked *