Module: Kucoin::Rest::Public::Klines
- Included in:
- Client
- Defined in:
- lib/kucoin/rest/public/klines.rb
Instance Method Summary collapse
- #chart_kline_data(symbol, resolution: :one_hour, from: nil, to: nil, options: {}) ⇒ Object
- #chart_symbol(symbol, options: {}) ⇒ Object
-
#kline_config(options: {}) ⇒ Object
TradingView related endpoints:.
-
#kline_data(symbol, type: :one_hour, from: nil, to: nil, limit: 100, options: {}) ⇒ Object
Not working propely / not implemented?.
Instance Method Details
#chart_kline_data(symbol, resolution: :one_hour, from: nil, to: nil, options: {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/kucoin/rest/public/klines.rb', line 39 def chart_kline_data(symbol, resolution: :one_hour, from: nil, to: nil, options: {}) to ||= Time.now.utc from ||= default_from_time(resolution, to) from = from.to_i unless from.is_a?(Integer) to = to.to_i unless to.is_a?(Integer) resolution = ::Kucoin::Constants::TRADING_VIEW_KLINE_RESOLUTIONS[resolution] params = { symbol: symbol, resolution: resolution, from: from, to: to } params.delete_if { |key, value| value.nil? } response = parse(get("/open/chart/history", params: params, options: )) ::Kucoin::Models::OHLCV.parse(response) if response end |
#chart_symbol(symbol, options: {}) ⇒ Object
35 36 37 |
# File 'lib/kucoin/rest/public/klines.rb', line 35 def chart_symbol(symbol, options: {}) response = parse(get("/open/chart/symbols", params: {symbol: symbol}, options: )) end |
#kline_config(options: {}) ⇒ Object
TradingView related endpoints:
31 32 33 |
# File 'lib/kucoin/rest/public/klines.rb', line 31 def kline_config(options: {}) parse(get("/open/chart/config", options: )) end |
#kline_data(symbol, type: :one_hour, from: nil, to: nil, limit: 100, options: {}) ⇒ Object
Not working propely / not implemented?
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kucoin/rest/public/klines.rb', line 7 def kline_data(symbol, type: :one_hour, from: nil, to: nil, limit: 100, options: {}) to ||= Time.now.utc from ||= default_from_time(type, to) from = from.to_i unless from.is_a?(Integer) to = to.to_i unless to.is_a?(Integer) type = ::Kucoin::Constants::STANDARD_KLINE_RESOLUTIONS[type] params = { symbol: symbol, type: type, from: from, to: to, limit: limit } params.delete_if { |key, value| value.nil? } response = parse(get("/open/kline", params: params, options: ))&.fetch("data", {}) end |