Class: Bitex::BaseOrder
- Inherits:
-
Object
- Object
- Bitex::BaseOrder
- Defined in:
- lib/bitex/base_order.rb
Overview
Base class for Bids and Asks
Instance Attribute Summary collapse
-
#created_at ⇒ Time
Time when this Bid was created.
-
#id ⇒ Integer
This Bid’s unique ID.
-
#issuer ⇒ String
The issuer of this order, helps you tell apart orders created from the web UI and the API.
-
#order_book ⇒ Symbol
:btc_usd or :btc_ars.
-
#price ⇒ BigDecimal
Maximum price to pay per unit.
-
#reason ⇒ Object
The cancellation reason for your Ask/Bid subclass, if any.
-
#status ⇒ Object
The status in its lifecycle, was defined into Ask/Bid subclass.
Class Method Summary collapse
-
.active ⇒ Object
Returns an array with all your active orders of this type.
-
.all ⇒ Object
Returns an array with all your active orders of this type and another order of this type that was active the last 2 hours.
-
.find(id) ⇒ Object
Find an order in your list of active orders.
Instance Method Summary collapse
Instance Attribute Details
#created_at ⇒ Time
Returns Time when this Bid was created.
10 11 12 |
# File 'lib/bitex/base_order.rb', line 10 def created_at @created_at end |
#id ⇒ Integer
Returns This Bid’s unique ID.
6 7 8 |
# File 'lib/bitex/base_order.rb', line 6 def id @id end |
#issuer ⇒ String
Returns The issuer of this order, helps you tell apart orders created from the web UI and the API.
34 35 36 |
# File 'lib/bitex/base_order.rb', line 34 def issuer @issuer end |
#order_book ⇒ Symbol
Returns :btc_usd or :btc_ars.
14 15 16 |
# File 'lib/bitex/base_order.rb', line 14 def order_book @order_book end |
#price ⇒ BigDecimal
Returns Maximum price to pay per unit.
18 19 20 |
# File 'lib/bitex/base_order.rb', line 18 def price @price end |
#reason ⇒ Object
The cancellation reason for your Ask/Bid subclass, if any.
-
:not_cancelled Has not been cancelled.
-
:not_enough_funds Not enough funds to place this order.
-
:user_cancelled Cancelled per user’s request
-
:system_cancelled Bitex cancelled this order, for a good reason.
30 31 32 |
# File 'lib/bitex/base_order.rb', line 30 def reason @reason end |
#status ⇒ Object
The status in its lifecycle, was defined into Ask/Bid subclass.
22 23 24 |
# File 'lib/bitex/base_order.rb', line 22 def status @status end |
Class Method Details
.active ⇒ Object
Returns an array with all your active orders of this type. Uses Order.active under the hood.
44 45 46 |
# File 'lib/bitex/base_order.rb', line 44 def self.active Order.active.select { |o| o.is_a?(self) } end |
.all ⇒ Object
Returns an array with all your active orders of this type and another order of this type that was active the last 2 hours. Uses Order.all under the hood.
38 39 40 |
# File 'lib/bitex/base_order.rb', line 38 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 Order.active under the hood.
50 51 52 |
# File 'lib/bitex/base_order.rb', line 50 def self.find(id) from_json(Api.private(:get, "/private#{base_path}/#{id}")) end |