Class: Tastytrade::OrderLeg
- Inherits:
-
Object
- Object
- Tastytrade::OrderLeg
- Defined in:
- lib/tastytrade/order.rb
Overview
Represents a single leg of an order
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#instrument_type ⇒ Object
readonly
Returns the value of attribute instrument_type.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Instance Method Summary collapse
-
#initialize(action:, symbol:, quantity:, instrument_type: "Equity") ⇒ OrderLeg
constructor
A new instance of OrderLeg.
- #to_api_params ⇒ Object
Constructor Details
#initialize(action:, symbol:, quantity:, instrument_type: "Equity") ⇒ OrderLeg
Returns a new instance of OrderLeg.
37 38 39 40 41 42 43 44 |
# File 'lib/tastytrade/order.rb', line 37 def initialize(action:, symbol:, quantity:, instrument_type: "Equity") validate_action!(action) @action = action @symbol = symbol @quantity = quantity.to_i @instrument_type = instrument_type end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
35 36 37 |
# File 'lib/tastytrade/order.rb', line 35 def action @action end |
#instrument_type ⇒ Object (readonly)
Returns the value of attribute instrument_type.
35 36 37 |
# File 'lib/tastytrade/order.rb', line 35 def instrument_type @instrument_type end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
35 36 37 |
# File 'lib/tastytrade/order.rb', line 35 def quantity @quantity end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
35 36 37 |
# File 'lib/tastytrade/order.rb', line 35 def symbol @symbol end |
Instance Method Details
#to_api_params ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/tastytrade/order.rb', line 46 def to_api_params { "action" => @action, "symbol" => @symbol, "quantity" => @quantity, "instrument-type" => @instrument_type } end |