public_order_book: GET current public order book data

Description Usage Arguments Examples

View source: R/public_order_book.R

Description

GET current public order book data

Usage

1
2
3
4
5
6
7
8
9
public_order_book(
  exchange = "binance",
  base_asset = "BTC",
  quote_asset = "USD",
  dry_run = FALSE,
  ...,
  level = NULL,
  depth = NULL
)

Arguments

exchange

Which exchange to use for price and market data. Choices are "binance", "binance-us", "bitstamp", "bittrex", "coinbase-pro", "crypto.com", "ftx", "ftx-us", "gemini", "huobi", "kraken", "kucoin", and "poloniex".

base_asset

Base asset (default BTC)

quote_asset

Quote asset (default USD)

dry_run

If TRUE, call httr2::req_dry_run, which shows the API call without actually sending it.

...

Query parameters passed to API call

level

Parameter used for varying aggregations of order book.

  • Optional for "bitstamp"

    • 0 (orders are not grouped at same price)

    • 1 (orders are grouped at same price - default)

    • 2 (orders with their order ids are not grouped at same price).

  • Optional for "coinbase-pro"

    • Level 1 (Default) - The best bid, ask and auction info

    • Level 2 - Full order book (aggregated) and auction info

    • Level 3 - Full order book (non aggregated) and auction info. Abuse of Level 3 via polling will cause your access to be limited or blocked.

    • The size field is the sum of the size of the orders at that price, and num-orders is the count of orders at that price; size should not be multiplied by num-orders.

  • Required for "huobi"

    • step0 No market depth aggregation. When type is set to "step0", the default value of "depth" is 150 instead of 20.

    • step1 Aggregation level = precision*10

    • step2 Aggregation level = precision*100

    • step3 Aggregation level = precision*1000

    • step4 Aggregation level = precision*10000

    • step5 Aggregation level = precision*100000

depth

Optional parameter used to specify number of bids and asks to return.

  • Default for "binance" and "binance-us" is 100. Valid limits of 5, 10, 20, 50, 100, 500, 1000, 5000.

  • Default for "bittrex" is 25. Allowed values are 1, 25, 500.

  • Default for "crypto.com" is max of 150.

  • Default for "ftx" and "ftx-us" is 20 with max of 100.

  • Default for "gemini" is 50. May be 0 to return the full order book.

  • Default for "huobi" is 20, unless type is set to "step0". Valid limits of 5, 10, 20.

  • Default for "kraken" is 100 with max of 500.

  • Default for "poloniex" is 50 with max of 100.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
public_order_book(exchange = "binance")
public_order_book(exchange = "binance-us")
public_order_book(exchange = "bitstamp")
public_order_book(exchange = "bittrex")
public_order_book(exchange = "coinbase-pro")
public_order_book(exchange = "crypto.com")
public_order_book(exchange = "ftx")
public_order_book(exchange = "ftx-us")
public_order_book(exchange = "gemini")
public_order_book(exchange = "huobi", level = "step0")
public_order_book(exchange = "kraken")
public_order_book(exchange = "kucoin")
public_order_book(exchange = "poloniex")

cstjohn810/cryptoapi documentation built on Feb. 6, 2022, 4:50 a.m.