class Binance::Responses::Kline

Overview

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.

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.
]

Defined in:

binance/client/rest/responses/kline.cr

Instance Method Summary

Instance Method Detail

def base_volume : Float64 #

Volume expressed in the base asset


[View source]
def close_price : Float64 #

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


[View source]
def close_time : Time #

Close Time in UTC


[View source]
def high_price : Float64 #

High Price


[View source]
def low_price : Float64 #

Low Price


[View source]
def open_price : Float64 #

Open Price


[View source]
def open_time : Time #

Open Time in UTC


[View source]
def quote_volume : Float64 #

Volume expressed in the target (quote) asset


[View source]
def reserved : Float64 #

Unknown/undocumented


[View source]
def taker_base_volume : Float64 #

Volume of taker trades on base asset


[View source]
def taker_quote_volume : Float64 #

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


[View source]
def trades : Int64 #

Number of trades on asset pair in interval


[View source]