Class: Bitfinex::Models::FundingOffer

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

Constant Summary collapse

BOOL_FIELDS =
['notify', 'hidden', 'renew']
FIELDS =
{
  :id => 0,
  :symbol => 1,
  :mts_create => 2,
  :mts_update => 3,
  :amount => 4,
  :amount_orig => 5,
  :type => 6,
  :flags => 9,
  :status => 10,
  :rate => 14,
  :period => 15,
  :notify => 16,
  :hidden => 17,
  :renew => 19,
  :rate_real => 20
}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#apply, #serialize

Constructor Details

#initialize(data) ⇒ FundingOffer

Returns a new instance of FundingOffer.



29
30
31
# File 'lib/models/funding_offer.rb', line 29

def initialize (data)
  super(data, FIELDS, BOOL_FIELDS)
end

Class Method Details

.unserialize(data) ⇒ Object



33
34
35
# File 'lib/models/funding_offer.rb', line 33

def self.unserialize (data)
  return Model.unserialize(data, FIELDS, BOOL_FIELDS)
end

Instance Method Details

#to_new_order_packetObject



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/models/funding_offer.rb', line 37

def to_new_order_packet
  data = {
    :type => @type,
    :symbol => @symbol,
    :amount => BigDecimal.new(@amount, 8).to_s,
    :rate => BigDecimal.new(@rate, 8).to_s,
    :period => 2
  }
  if !@flags.nil?
    data[:flags] = @flags
  end
  data
end