Class: SchwabRb::DataObjects::OrderPreview::OrderStrategy
- Inherits:
-
Object
- Object
- SchwabRb::DataObjects::OrderPreview::OrderStrategy
- Defined in:
- lib/schwab_rb/data_objects/order_preview.rb
Instance Attribute Summary collapse
-
#order_legs ⇒ Object
readonly
Returns the value of attribute order_legs.
-
#order_type ⇒ Object
readonly
Returns the value of attribute order_type.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#strategy_id ⇒ Object
readonly
Returns the value of attribute strategy_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ OrderStrategy
constructor
A new instance of OrderStrategy.
- #to_h ⇒ Object
Constructor Details
#initialize(attrs) ⇒ OrderStrategy
Returns a new instance of OrderStrategy.
68 69 70 71 72 73 74 75 76 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 68 def initialize(attrs) @status = attrs[:status] @price = attrs[:price] @quantity = attrs[:quantity] @order_type = attrs[:orderType] @type = attrs[:type] @strategy_id = attrs[:strategyId] @order_legs = attrs[:orderLegs]&.map { |leg| OrderLeg.build(leg) } || [] end |
Instance Attribute Details
#order_legs ⇒ Object (readonly)
Returns the value of attribute order_legs.
66 67 68 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 66 def order_legs @order_legs end |
#order_type ⇒ Object (readonly)
Returns the value of attribute order_type.
66 67 68 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 66 def order_type @order_type end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
66 67 68 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 66 def price @price end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
66 67 68 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 66 def quantity @quantity end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
66 67 68 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 66 def status @status end |
#strategy_id ⇒ Object (readonly)
Returns the value of attribute strategy_id.
66 67 68 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 66 def strategy_id @strategy_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
66 67 68 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 66 def type @type end |
Instance Method Details
#to_h ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/schwab_rb/data_objects/order_preview.rb', line 78 def to_h { status: @status, price: @price, quantity: @quantity, orderType: @order_type, type: @type, strategyId: @strategy_id, orderLegs: @order_legs.map(&:to_h) } end |