Class: BitfinexOrder

Inherits:
Object
  • Object
show all
Defined in:
lib/bitex_bot/models/bitfinex_api_wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order_data) ⇒ BitfinexOrder

Returns a new instance of BitfinexOrder.



91
92
93
94
95
96
97
# File 'lib/bitex_bot/models/bitfinex_api_wrapper.rb', line 91

def initialize(order_data)
  self.id = order_data['id'].to_i
  self.amount = order_data['original_amount'].to_d
  self.price = order_data['price'].to_d
  self.type = order_data['side'].to_sym
  self.datetime = order_data['timestamp'].to_i
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



90
91
92
# File 'lib/bitex_bot/models/bitfinex_api_wrapper.rb', line 90

def amount
  @amount
end

#datetimeObject

Returns the value of attribute datetime.



90
91
92
# File 'lib/bitex_bot/models/bitfinex_api_wrapper.rb', line 90

def datetime
  @datetime
end

#idObject

Returns the value of attribute id.



90
91
92
# File 'lib/bitex_bot/models/bitfinex_api_wrapper.rb', line 90

def id
  @id
end

#priceObject

Returns the value of attribute price.



90
91
92
# File 'lib/bitex_bot/models/bitfinex_api_wrapper.rb', line 90

def price
  @price
end

#typeObject

Returns the value of attribute type.



90
91
92
# File 'lib/bitex_bot/models/bitfinex_api_wrapper.rb', line 90

def type
  @type
end

Instance Method Details

#cancel!Object



99
100
101
# File 'lib/bitex_bot/models/bitfinex_api_wrapper.rb', line 99

def cancel!
  Bitfinex::Client.new.cancel_orders(id)
end