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

#issuerObject

Returns the value of attribute issuer.



11
12
13
# File 'lib/bitex/order.rb', line 11

def issuer
  @issuer
end

#priceObject

Returns the value of attribute price.



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

def price
  @price
end

#reasonObject

Returns the value of attribute reason.



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

def reason
  @reason
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.



22
23
24
# File 'lib/bitex/order.rb', line 22

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.



16
17
18
# File 'lib/bitex/order.rb', line 16

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.



28
29
30
# File 'lib/bitex/order.rb', line 28

def self.find(id)
  from_json(Api.private(:get, "/private#{base_path}/#{id}"))
end

Instance Method Details

#cancel!Object



53
54
55
56
# File 'lib/bitex/order.rb', line 53

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