Class: Kucoin::Models::OHLCV
Constant Summary collapse
- MAPPING =
{ timestamp: :time, open: :float, high: :float, low: :float, close: :float, volume: :float }
Class Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Kucoin::Models::Base
Class Method Details
.parse(data) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/kucoin/models/ohlcv.rb', line 13 def self.parse(data) ohlcvs = [] = data.fetch("t", []) opens = data.fetch("o", []) highs = data.fetch("h", []) lows = data.fetch("l", []) closes = data.fetch("c", []) volumes = data.fetch("v", []) if &.any? && opens&.any? && highs&.any? && lows&.any? && closes&.any? && volumes&.any? .each_with_index do |, index| item = {timestamp: , open: opens[index], high: highs[index], low: lows[index], close: closes[index], volume: volumes[index]} ohlcvs << ::Kucoin::Models::OHLCV.new(item) end end return ohlcvs end |