Class: Options::Strategies::StrategyBuilder

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

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



232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/options/strategies.rb', line 232

def build
  @strategy_type_klasses.each do |strategy_klass, strike_prices|
    strike_prices.each do |strike_price|
      @options[:strike_price] = strike_price
      sk = strategy_klass.new(@options)
      sk.lot_size = self.input_lot_size
      self.merge_legs(sk.build.legs)
    end
  end
  @options[:strike_price] = @strike_price
  self.legs
end