Class: Gekko::LimitOrder
Overview
Represents a limit order. These order must specify a price.
Instance Attribute Summary collapse
-
#price ⇒ Object
Returns the value of attribute price.
Attributes inherited from Order
#created_at, #expiration, #id, #remaining, #side, #size
Instance Method Summary collapse
- #done? ⇒ Boolean
-
#filled? ⇒ Boolean
Returns
trueif the order is filled. -
#initialize(side, id, size, price, expiration = nil) ⇒ LimitOrder
constructor
A new instance of LimitOrder.
Methods inherited from Order
#ask?, #bid?, #crosses?, #expired?, #fill_or_kill?, #message
Constructor Details
#initialize(side, id, size, price, expiration = nil) ⇒ LimitOrder
Returns a new instance of LimitOrder.
10 11 12 13 14 |
# File 'lib/gekko/limit_order.rb', line 10 def initialize(side, id, size, price, expiration = nil) super(side, id, size, expiration) @price = price raise 'Price must be a positive integer' if @price.nil? || (!@price.is_a?(Fixnum) || (@price <= 0)) end |
Instance Attribute Details
#price ⇒ Object
Returns the value of attribute price.
8 9 10 |
# File 'lib/gekko/limit_order.rb', line 8 def price @price end |
Instance Method Details
#done? ⇒ Boolean
23 24 25 |
# File 'lib/gekko/limit_order.rb', line 23 def done? filled? end |
#filled? ⇒ Boolean
Returns true if the order is filled
19 20 21 |
# File 'lib/gekko/limit_order.rb', line 19 def filled? remaining.zero? end |