Skip to content

044depth

杨晓强 edited this page Jan 20, 2022 · 13 revisions

Market depth API

  • Acquire market depth.

See request count and merge constraint here Acquire market depth

  • result: checksum is a signed integer (32 bit) of full depth data and is for verify the accuracy of depth data, the checksum string will be bid1_price:bid1_amount:bid2_price:bid2_amount:ask1_price:ask1_amount:... if there is no bids, the checksum string will be ask1_price:ask1_amount:ask2_price:ask2_amount...
#Example

#Request
{
  "method":"depth.query",
  "params":[
    "BTCBCH",           #1.market: See<API invocation description·market> 
    20,                 #2.limit: Count limit, Integer
    "0"                 #3.interval: Merge,String
  ],
  "id":15
}

#Response
{
  "error": null, 
  "result": {
    "bids": [          #Depth of Buy
      [
        "12.25",       #Buy in price
        "0.0588"       #Buy in count
      ]
    ],
    "asks": [          #Depth of Sell
      [
        "12.94",       #Sell out price
        "0.1524"       #Sell out count
      ]
    ],
    "checksum": 21658179
  },
  "id": 15
 }
  • Subscribe market depth, "depth.subscribe" does not support multi-market in websocket subscription, but "depth.subscribe_multi" support.

#Example

#Request

{
  "method":"depth.subscribe",
  "params":[
    "BTCBCH",               #1.market: See<API invocation description·market> 
    5,                      #2.limit: Count limit
    "0",                    #3.interval: Merge,String
    true                    #4.diff, Boolen, Optional, default is true          
  ],
  "id":15
}

#notify
{
  "method": "depth.update", 
  "params": [
    false,                  #Boolean, true: for complete result,false: for update based on latest retrun result
    {                       #Update info
      "bids": [             #Depth of Buy
        [
          "12.25",          #Buy in price
          "0.0588"          #Buy in count
        ]
      ],
      "asks": [             #Depth of Sell
        [
          "12.94",          #Sell out price
          "0.1524"          #Sell out count
        ]
      ],
      "checksum": 21658179
    }
  ], 
  "id": null
}
  • Subscribe market depth, support multi-market in websocket subscription

#Example

#Request

{
  "method":"depth.subscribe_multi",
  "params":
  [
    [
      "BTCBCH",               #1.market: See<API invocation description·market> 
      5,                      #2.limit: Count limit
      "0"                     #3.interval: Merge,String
      true                    #4.diff, Boolen, Optional, default is true
    ],
    [
      "BTCUSDT",              
      5,                      
      "0",
      false               
    ],
    [
      ...
    ]
  ]
  "id":15
}

#notify
{
  "method": "depth.update", 
  "params": [
    false,                  #Boolean, true: for complete result,false: for update based on latest retrun result
    {                       #Update info
      "bids": [             #Depth of Buy
        [
          "12.25",          #Buy in price
          "0.0588"          #Buy in count
        ]
      ],
      "asks": [             #Depth of Sell
        [
          "12.94",          #Sell out price
          "0.1524"          #Sell out count
        ]
      ],
      "checksum": 21658179
    }
  ], 
  "id": null
}

HTTP API Introduction

Common API

Market API

Account API

Trading API

Margin API

Contract API

WebSocket API Introduction

Clone this wiki locally