Class: Bitfinex::Models::FundingTicker

Inherits:
Model
  • Object
show all
Defined in:
lib/models/funding_ticker.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#apply

Constructor Details

#initialize(data) ⇒ FundingTicker

Returns a new instance of FundingTicker.



10
11
12
# File 'lib/models/funding_ticker.rb', line 10

def initialize (data)
  super(data, {}, [])
end

Instance Attribute Details

#askObject

Returns the value of attribute ask.



6
7
8
# File 'lib/models/funding_ticker.rb', line 6

def ask
  @ask
end

#ask_periodObject

Returns the value of attribute ask_period.



7
8
9
# File 'lib/models/funding_ticker.rb', line 7

def ask_period
  @ask_period
end

#ask_sizeObject

Returns the value of attribute ask_size.



7
8
9
# File 'lib/models/funding_ticker.rb', line 7

def ask_size
  @ask_size
end

#bidObject

Returns the value of attribute bid.



6
7
8
# File 'lib/models/funding_ticker.rb', line 6

def bid
  @bid
end

#bid_periodObject

Returns the value of attribute bid_period.



6
7
8
# File 'lib/models/funding_ticker.rb', line 6

def bid_period
  @bid_period
end

#bid_sizeObject

Returns the value of attribute bid_size.



6
7
8
# File 'lib/models/funding_ticker.rb', line 6

def bid_size
  @bid_size
end

#daily_changeObject

Returns the value of attribute daily_change.



7
8
9
# File 'lib/models/funding_ticker.rb', line 7

def daily_change
  @daily_change
end

#daily_change_percObject

Returns the value of attribute daily_change_perc.



7
8
9
# File 'lib/models/funding_ticker.rb', line 7

def daily_change_perc
  @daily_change_perc
end

#frrObject

Returns the value of attribute frr.



6
7
8
# File 'lib/models/funding_ticker.rb', line 6

def frr
  @frr
end

#highObject

Returns the value of attribute high.



8
9
10
# File 'lib/models/funding_ticker.rb', line 8

def high
  @high
end

#last_priceObject

Returns the value of attribute last_price.



8
9
10
# File 'lib/models/funding_ticker.rb', line 8

def last_price
  @last_price
end

#lowObject

Returns the value of attribute low.



8
9
10
# File 'lib/models/funding_ticker.rb', line 8

def low
  @low
end

#symbolObject

Returns the value of attribute symbol.



6
7
8
# File 'lib/models/funding_ticker.rb', line 6

def symbol
  @symbol
end

#volumeObject

Returns the value of attribute volume.



8
9
10
# File 'lib/models/funding_ticker.rb', line 8

def volume
  @volume
end

Class Method Details

.unserialize(arr) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/models/funding_ticker.rb', line 26

def self.unserialize (arr)
  symbol = arr[0]
  payload = arr[1]
  data = payload.kind_of?(Array) ? payload : arr.dup[1..-1]

  {
    :symbol => symbol,
    :frr => data[0],
    :bid => data[1],
    :bid_period => data[2],
    :bid_size => data[3],
    :ask => data[4],
    :ask_period => data[5],
    :ask_size => data[6],
    :daily_change => data[7],
    :daily_change_perc => data[8],
    :last_price => data[9],
    :volume => data[10],
    :high => data[11],
    :low => data[12]
  }
end

Instance Method Details

#serializeObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/models/funding_ticker.rb', line 14

def serialize ()
  [
    self.symbol,
    [
      self.frr, self.bid, self.bid_period, self.bid_size, self.ask,
      self.ask_period, self.ask_size, self.daily_change,
      self.daily_change_perc, self.last_price, self.volume, self.high,
      self.low
    ]
  ]
end