class

Binance::Responses::Kline

Inherits Reference < Object

Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.

Weight: 1

Parameters:

Name Type Mandatory Description
symbol STRING YES
interval ENUM YES
startTime LONG NO
endTime LONG NO
limit INT NO Default 500; max 1000.
  • If startTime and endTime are not sent, the most recent klines are returned.

Example Usage

response = client.klines("BNBUSDT", "1h", 5)
response.klines.size               # => 5
response.klines.map(&.open_price)  # => [34.4949, 34.3671, 34.3842, 34.2751, 34.2592]
response.klines.map(&.close_price) # => [34.3887, 34.376, 34.2218, 34.2658, 34.2749]
response.klines[0].open_time       # => "2019-06-28 17:00:00 UTC"
response.klines[0].close_time      # => "2019-06-28 17:59:59 UTC"
response.klines[4].open_time       # => "2019-06-28 21:00:00 UTC"
response.klines[4].close_time      # => "2019-06-28 21:59:59 UTC"

Typical server response (unparsed JSON)

[
  1499040000000,      // Open time
  "0.01634790",       // Open
  "0.80000000",       // High
  "0.01575800",       // Low
  "0.01577100",       // Close
  "148976.11427815",  // Volume
  1499644799999,      // Close time
  "2434.19055334",    // Quote asset volume
  308,                // Number of trades
  "1756.87402397",    // Taker buy base asset volume
  "28.46694368",      // Taker buy quote asset volume
  "17928899.62484339" // Ignore.
]

Instance methods

base_volume

Volume expressed in the base asset

Source
close_price

Close Price (this can fluxuate for still open candles!)

Source
close_time

Close Time in UTC

Source
high_price

High Price

Source
low_price

Low Price

Source
open_price

Open Price

Source
open_time

Open Time in UTC

Source
quote_volume

Volume expressed in the target (quote) asset

Source
reserved

Unknown/undocumented

Source
taker_base_volume

Volume of taker trades on base asset

Source
taker_quote_volume

Volume of taker trades expressed in the target (quote) asset

Source
trades

Number of trades on asset pair in interval

Source