Class: Options::Strategies::IronStrategy

Inherits:
Strategy
  • Object
show all
Defined in:
lib/options/strategies.rb

Direct Known Subclasses

IronCondor, IronFly, LongIronCondor, LongIronFly

Instance Attribute Summary

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

Methods inherited from Strategy

#construct, #initialize, #long=, #lot_size=, #merge_legs, #parse_option_type_klasses, #short=, #to_hash, #to_json

Constructor Details

This class inherits a constructor from Options::Strategies::Strategy

Instance Method Details

#buildObject



188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/options/strategies.rb', line 188

def build
  @strategy_type_klasses.each do |strategy_klass, _strike_price|
    sk = strategy_klass.new(@options)
    sk.lot_size = self.input_lot_size
    unless (strategy_klass == Hedge && strategy_klass == ShortHedge)
      sk_option_type_klasses = sk.option_type_klasses
      @options[:parent_ce_strike_price] = sk_option_type_klasses[CEOption]
      @options[:parent_pe_strike_price] = sk_option_type_klasses[PEOption]
    end
    self.merge_legs(sk.build.legs)
  end
  self.legs
end