Class: Kucoin::Models::Trade

Inherits:
Base
  • Object
show all
Defined in:
lib/kucoin/models/trade.rb

Constant Summary collapse

ARRAY_MAPPING =
{
  0 => "timestamp",
  1 => "order_type",
  2 => "price",
  3 => "amount",
  4 => "volume"
}
MAPPING =
{
  timestamp:  :time,
  order_type: :string,
  price:      :float,
  amount:     :float,
  volume:     :float,
}

Class Method Summary collapse

Methods inherited from Base

#attributes, #initialize

Constructor Details

This class inherits a constructor from Kucoin::Models::Base

Class Method Details

.parse(response) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/kucoin/models/trade.rb', line 20

def self.parse(response)
  trades              =   []
  
  response&.each do |item|
    data              =   {}
    
    item.each_with_index do |value, index|
      data[ARRAY_MAPPING[index]] = value
    end
    
    trades << ::Kucoin::Models::Trade.new(data)
  end
  
  return trades
end