Class: Options::Strategies::Hedge
- Defined in:
- lib/options/strategies.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#parent_ce_strike_price ⇒ Object
Returns the value of attribute parent_ce_strike_price.
-
#parent_pe_strike_price ⇒ Object
Returns the value of attribute parent_pe_strike_price.
Attributes inherited from Strategy
#ce_increment, #default_lot_size, #increment, #index_name, #input_lot_size, #legs, #option_type_klasses, #options_data, #pe_increment, #strike_price
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(options = {}) ⇒ Hedge
constructor
A new instance of Hedge.
Methods inherited from Strategy
#construct, #long=, #lot_size=, #merge_legs, #parse_option_type_klasses, #short=, #to_hash, #to_json
Constructor Details
#initialize(options = {}) ⇒ Hedge
Returns a new instance of Hedge.
82 83 84 85 86 87 88 89 |
# File 'lib/options/strategies.rb', line 82 def initialize(={}) super() @ce_increment = 3 * @increment @pe_increment = -3 * @increment @parent_pe_strike_price = .key?(:parent_pe_strike_price) ? [:parent_pe_strike_price] : @strike_price @parent_ce_strike_price = .key?(:parent_ce_strike_price) ? [:parent_ce_strike_price] : @strike_price @option_type_klasses = {CEOption => @parent_ce_strike_price + @ce_increment, PEOption => @parent_pe_strike_price + @pe_increment} end |
Instance Attribute Details
#parent_ce_strike_price ⇒ Object
Returns the value of attribute parent_ce_strike_price.
81 82 83 |
# File 'lib/options/strategies.rb', line 81 def parent_ce_strike_price @parent_ce_strike_price end |
#parent_pe_strike_price ⇒ Object
Returns the value of attribute parent_pe_strike_price.
81 82 83 |
# File 'lib/options/strategies.rb', line 81 def parent_pe_strike_price @parent_pe_strike_price end |
Instance Method Details
#build ⇒ Object
91 92 93 |
# File 'lib/options/strategies.rb', line 91 def build construct {|option_data| self.long = option_data } end |