Class: Bitex::OrderBase

Inherits:
Object
  • Object
show all
Defined in:
lib/bitex/order.rb

Overview

Base class for Bids and Asks

Direct Known Subclasses

Ask, Bid

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



6
7
8
# File 'lib/bitex/order.rb', line 6

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/bitex/order.rb', line 5

def id
  @id
end

#priceObject

Returns the value of attribute price.



8
9
10
# File 'lib/bitex/order.rb', line 8

def price
  @price
end

#specieObject

Returns the value of attribute specie.



7
8
9
# File 'lib/bitex/order.rb', line 7

def specie
  @specie
end

#statusObject

Returns the value of attribute status.



9
10
11
# File 'lib/bitex/order.rb', line 9

def status
  @status
end

Class Method Details

.activeObject

Returns an array with all your active orders of this type Uses Bitex::Order.active under the hood.



20
21
22
# File 'lib/bitex/order.rb', line 20

def self.active
  Order.active.select{|o| o.is_a?(self) }
end

.allObject

Returns an array with all your active orders of this type, and any other order of this type that was active in the last 2 hours. Uses Bitex::Order.all under the hood.



14
15
16
# File 'lib/bitex/order.rb', line 14

def self.all
  Order.all.select{|o| o.is_a?(self) }
end

.find(id) ⇒ Object

Find an order in your list of active orders. Uses Bitex::Order.active under the hood.



26
27
28
# File 'lib/bitex/order.rb', line 26

def self.find(id)
  active.select{|o| o.id == id}.first
end

Instance Method Details

#cancel!Object



30
31
32
33
# File 'lib/bitex/order.rb', line 30

def cancel!
  path = "/private#{self.class.base_path}/cancel"
  self.class.from_json(Api.private(:post, path), self)
end