Module: Binance::Client::REST::PublicAPI

Included in:
Binance::Client::REST
Defined in:
lib/binance/client/rest/public_api.rb

Overview

Public: A Module containing all of the Public API endpoints

Instance Method Summary collapse

Instance Method Details

#agg_trades(options) ⇒ Object

Public: Retrieve aggregate trade data for the specified symbol

options - The Hash which hosts various REST query params.

:symbol     - The String of which trading pair to retrieve.
:fromId     - The String of which trade ID to fetch from (optional).
:startTime  - The Timestamp of when to get trades from in
              milliseconds (optional).
:endTime    - The Timestamp of when to get trades until in
              milliseconds (optional).
:limit      - The Number of how many trades to request (optional).

Returns a Hash with the request response



82
83
84
# File 'lib/binance/client/rest/public_api.rb', line 82

def agg_trades(options)
  request :public, :get, :aggTrades, options
end

#all_book_tickersObject

Public: Retrieve all book ticker data for all symbols

Returns a Hash with the request response



143
144
145
# File 'lib/binance/client/rest/public_api.rb', line 143

def all_book_tickers
  request :public, :get, :bookTicker
end

#all_pricesObject

Public: Retrieve all price ticker data

Returns a Hash with the request response



126
127
128
# File 'lib/binance/client/rest/public_api.rb', line 126

def all_prices
  request :public, :get, :price
end

#book_ticker(options) ⇒ Object

Public: Retrieve best price per quantity on the order book

options - The Hash which hosts various REST query params.

:symbol - The String of which trading pair to retrieve (optional).

Returns a Hash with the request response



136
137
138
# File 'lib/binance/client/rest/public_api.rb', line 136

def book_ticker(options)
  request :public, :get, :bookTicker, options
end

#depth(options) ⇒ Object

Public: Retrieve depth information for the specified symbol

options - The Hash which hosts various REST query params.

:symbol - The String of which trading pair to retrieve.
:limit  - The Number of how many updates to request (optional).

Returns a Hash with the request response



43
44
45
# File 'lib/binance/client/rest/public_api.rb', line 43

def depth(options)
  request :public, :get, :depth, options
end

#exchange_infoObject

Public: Retrieve current exchange trading rules and symbol information

Returns a Hash with the request response



24
25
26
# File 'lib/binance/client/rest/public_api.rb', line 24

def exchange_info
  request :public, :get, :exchangeInfo
end

#historical_trades(options) ⇒ Object

Public: Retrieve old trade data for the specified symbol

options - The Hash which hosts various REST query params.

:symbol - The String of which trading pair to retrieve.
:limit  - The Number of how many trades to request (optional).
:fromId - The String of which trade ID to fetch from (optional).

Returns a Hash with the request response



66
67
68
# File 'lib/binance/client/rest/public_api.rb', line 66

def historical_trades(options)
  request :verified, :get, :historicalTrades, options
end

#klines(options) ⇒ Object

Public: Retrieve kline data for the specified symbol

options - The Hash which hosts various REST query params.

:symbol     - The String of which trading pair to retrieve.
:interval   - The String of which interval to retrieve (optional).
:fromId     - The String of which trade ID to fetch from (optional).
:startTime  - The Timestamp of when to get trades from in
              milliseconds (optional).
:endTime    - The Timestamp of when to get trades until in
              milliseconds (optional).
:limit      - The Number of how many trades to request (optional).

Returns a Hash with the request response



99
100
101
# File 'lib/binance/client/rest/public_api.rb', line 99

def klines(options)
  request :public, :get, :klines, options
end

#pingObject

Public: Ping the server to test connectivity

Returns a Hash with the request response



10
11
12
# File 'lib/binance/client/rest/public_api.rb', line 10

def ping
  request :public, :get, :ping
end

#price(options) ⇒ Object

Public: Retrieve price ticker data for the specified symbol

options - The Hash which hosts various REST query params.

:symbol - The String of which trading pair to retrieve (optional).

Returns a Hash with the request response



119
120
121
# File 'lib/binance/client/rest/public_api.rb', line 119

def price(options)
  request :public, :get, :price, options
end

#productsObject

Public: Retrieve current exchange asset information. This is an undocumented endpoint.

Returns a Hash with the request response



32
33
34
# File 'lib/binance/client/rest/public_api.rb', line 32

def products
  request :public, :get, :products
end

#timeObject

Public: Retrieve the server time in milliseconds

Returns a Hash with the request response



17
18
19
# File 'lib/binance/client/rest/public_api.rb', line 17

def time
  request :public, :get, :time
end

#trades(options) ⇒ Object

Public: Retrieve recent trades for the specified symbol

options - The Hash which hosts various REST query params.

:symbol - The String of which trading pair to retrieve.
:limit  - The Number of how many trades to request (optional).

Returns a Hash with the request response



54
55
56
# File 'lib/binance/client/rest/public_api.rb', line 54

def trades(options)
  request :public, :get, :trades, options
end

#twenty_four_hour(options) ⇒ Object

Public: Retrieve 24 hour ticker price data

options - The Hash which hosts various REST query params.

:symbol - The String of which trading pair to retrieve (optional).

Returns a Hash with the request response



109
110
111
# File 'lib/binance/client/rest/public_api.rb', line 109

def twenty_four_hour(options)
  request :public, :get, :twenty_four_hour, options
end