Class: Alpaca::Trade::Api::Order
- Inherits:
-
Object
- Object
- Alpaca::Trade::Api::Order
- Defined in:
- lib/alpaca/trade/api/order.rb
Instance Attribute Summary collapse
-
#asset_class ⇒ Object
readonly
Returns the value of attribute asset_class.
-
#asset_id ⇒ Object
readonly
Returns the value of attribute asset_id.
-
#canceled_at ⇒ Object
readonly
Returns the value of attribute canceled_at.
-
#client_order_id ⇒ Object
readonly
Returns the value of attribute client_order_id.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#expired_at ⇒ Object
readonly
Returns the value of attribute expired_at.
-
#extended_hours ⇒ Object
readonly
Returns the value of attribute extended_hours.
-
#failed_at ⇒ Object
readonly
Returns the value of attribute failed_at.
-
#filled_at ⇒ Object
readonly
Returns the value of attribute filled_at.
-
#filled_avg_price ⇒ Object
readonly
Returns the value of attribute filled_avg_price.
-
#filled_qty ⇒ Object
readonly
Returns the value of attribute filled_qty.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#legs ⇒ Object
readonly
Returns the value of attribute legs.
-
#limit_price ⇒ Object
readonly
Returns the value of attribute limit_price.
-
#order_class ⇒ Object
readonly
Returns the value of attribute order_class.
-
#qty ⇒ Object
readonly
Returns the value of attribute qty.
-
#replaced_at ⇒ Object
readonly
Returns the value of attribute replaced_at.
-
#replaced_by ⇒ Object
readonly
Returns the value of attribute replaced_by.
-
#replaces ⇒ Object
readonly
Returns the value of attribute replaces.
-
#side ⇒ Object
readonly
Returns the value of attribute side.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stop_price ⇒ Object
readonly
Returns the value of attribute stop_price.
-
#submitted_at ⇒ Object
readonly
Returns the value of attribute submitted_at.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
-
#time_in_force ⇒ Object
readonly
Returns the value of attribute time_in_force.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(json) ⇒ Order
constructor
A new instance of Order.
Constructor Details
#initialize(json) ⇒ Order
Returns a new instance of Order.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/alpaca/trade/api/order.rb', line 13 def initialize(json) @id = json['id'] @asset_class = json['asset_class'] @asset_id = json['asset_id'] @canceled_at = json['canceled_at'] @client_order_id = json['client_order_id'] @created_at = json['created_at'] @expired_at = json['expired_at'] @extended_hours = json['extended_hours'] @failed_at = json['failed_at'] @filled_at = json['filled_at'] @filled_avg_price = json['filled_avg_price'] @filled_qty = json['filled_qty'] @legs = (json['legs'] || []).map {|leg| Order.new(leg)} @limit_price = json['limit_price'] @order_class = json['order_class'] @qty = json['qty'] @replaced_at = json['replaced_at'] @replaced_by = json['replaced_by'] @replaces = json['replaces'] @side = json['side'] @status = json['status'] @stop_price = json['stop_price'] @submitted_at = json['submitted_at'] @symbol = json['symbol'] @time_in_force = json['time_in_force'] @type = json['type'] @updated_at = json['updated_at'] end |
Instance Attribute Details
#asset_class ⇒ Object (readonly)
Returns the value of attribute asset_class.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def asset_class @asset_class end |
#asset_id ⇒ Object (readonly)
Returns the value of attribute asset_id.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def asset_id @asset_id end |
#canceled_at ⇒ Object (readonly)
Returns the value of attribute canceled_at.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def canceled_at @canceled_at end |
#client_order_id ⇒ Object (readonly)
Returns the value of attribute client_order_id.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def client_order_id @client_order_id end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def created_at @created_at end |
#expired_at ⇒ Object (readonly)
Returns the value of attribute expired_at.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def expired_at @expired_at end |
#extended_hours ⇒ Object (readonly)
Returns the value of attribute extended_hours.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def extended_hours @extended_hours end |
#failed_at ⇒ Object (readonly)
Returns the value of attribute failed_at.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def failed_at @failed_at end |
#filled_at ⇒ Object (readonly)
Returns the value of attribute filled_at.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def filled_at @filled_at end |
#filled_avg_price ⇒ Object (readonly)
Returns the value of attribute filled_avg_price.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def filled_avg_price @filled_avg_price end |
#filled_qty ⇒ Object (readonly)
Returns the value of attribute filled_qty.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def filled_qty @filled_qty end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def id @id end |
#legs ⇒ Object (readonly)
Returns the value of attribute legs.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def legs @legs end |
#limit_price ⇒ Object (readonly)
Returns the value of attribute limit_price.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def limit_price @limit_price end |
#order_class ⇒ Object (readonly)
Returns the value of attribute order_class.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def order_class @order_class end |
#qty ⇒ Object (readonly)
Returns the value of attribute qty.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def qty @qty end |
#replaced_at ⇒ Object (readonly)
Returns the value of attribute replaced_at.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def replaced_at @replaced_at end |
#replaced_by ⇒ Object (readonly)
Returns the value of attribute replaced_by.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def replaced_by @replaced_by end |
#replaces ⇒ Object (readonly)
Returns the value of attribute replaces.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def replaces @replaces end |
#side ⇒ Object (readonly)
Returns the value of attribute side.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def side @side end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def status @status end |
#stop_price ⇒ Object (readonly)
Returns the value of attribute stop_price.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def stop_price @stop_price end |
#submitted_at ⇒ Object (readonly)
Returns the value of attribute submitted_at.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def submitted_at @submitted_at end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def symbol @symbol end |
#time_in_force ⇒ Object (readonly)
Returns the value of attribute time_in_force.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def time_in_force @time_in_force end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def type @type end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
7 8 9 |
# File 'lib/alpaca/trade/api/order.rb', line 7 def updated_at @updated_at end |