Class: Alpaca::Trade::Api::Order

Inherits:
Object
  • Object
show all
Defined in:
lib/alpaca/trade/api/order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_classObject (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_idObject (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_atObject (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_idObject (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_atObject (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_atObject (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_hoursObject (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_atObject (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_atObject (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_priceObject (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_qtyObject (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

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/alpaca/trade/api/order.rb', line 7

def id
  @id
end

#legsObject (readonly)

Returns the value of attribute legs.



7
8
9
# File 'lib/alpaca/trade/api/order.rb', line 7

def legs
  @legs
end

#limit_priceObject (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_classObject (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

#qtyObject (readonly)

Returns the value of attribute qty.



7
8
9
# File 'lib/alpaca/trade/api/order.rb', line 7

def qty
  @qty
end

#replaced_atObject (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_byObject (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

#replacesObject (readonly)

Returns the value of attribute replaces.



7
8
9
# File 'lib/alpaca/trade/api/order.rb', line 7

def replaces
  @replaces
end

#sideObject (readonly)

Returns the value of attribute side.



7
8
9
# File 'lib/alpaca/trade/api/order.rb', line 7

def side
  @side
end

#statusObject (readonly)

Returns the value of attribute status.



7
8
9
# File 'lib/alpaca/trade/api/order.rb', line 7

def status
  @status
end

#stop_priceObject (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_atObject (readonly)

Returns the value of attribute submitted_at.



7
8
9
# File 'lib/alpaca/trade/api/order.rb', line 7

def 
  @submitted_at
end

#symbolObject (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_forceObject (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

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/alpaca/trade/api/order.rb', line 7

def type
  @type
end

#updated_atObject (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