Class: OptionLab::Models::Outputs

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/option_lab/models.rb

Overview

Strategy outputs model

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Outputs

Returns a new instance of Outputs.



448
449
450
451
452
453
454
455
456
# File 'lib/option_lab/models.rb', line 448

def initialize(attributes = {})
  # Set defaults
  @probability_of_profit_target = 0.0
  @profit_target_ranges = []
  @probability_of_loss_limit = 0.0
  @loss_limit_ranges = []

  super(attributes)
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def data
  @data
end

#deltaObject

Returns the value of attribute delta.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def delta
  @delta
end

#expected_lossObject

Returns the value of attribute expected_loss.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def expected_loss
  @expected_loss
end

#expected_profitObject

Returns the value of attribute expected_profit.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def expected_profit
  @expected_profit
end

#gammaObject

Returns the value of attribute gamma.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def gamma
  @gamma
end

#implied_volatilityObject

Returns the value of attribute implied_volatility.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def implied_volatility
  @implied_volatility
end

#in_the_money_probabilityObject

Returns the value of attribute in_the_money_probability.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def in_the_money_probability
  @in_the_money_probability
end

#inputsObject

Returns the value of attribute inputs.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def inputs
  @inputs
end

#loss_limit_rangesObject

Returns the value of attribute loss_limit_ranges.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def loss_limit_ranges
  @loss_limit_ranges
end

#maximum_return_in_the_domainObject

Returns the value of attribute maximum_return_in_the_domain.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def maximum_return_in_the_domain
  @maximum_return_in_the_domain
end

#minimum_return_in_the_domainObject

Returns the value of attribute minimum_return_in_the_domain.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def minimum_return_in_the_domain
  @minimum_return_in_the_domain
end

#per_leg_costObject

Returns the value of attribute per_leg_cost.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def per_leg_cost
  @per_leg_cost
end

#probability_of_loss_limitObject

Returns the value of attribute probability_of_loss_limit.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def probability_of_loss_limit
  @probability_of_loss_limit
end

#probability_of_profitObject

Returns the value of attribute probability_of_profit.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def probability_of_profit
  @probability_of_profit
end

#probability_of_profit_targetObject

Returns the value of attribute probability_of_profit_target.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def probability_of_profit_target
  @probability_of_profit_target
end

#profit_rangesObject

Returns the value of attribute profit_ranges.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def profit_ranges
  @profit_ranges
end

#profit_target_rangesObject

Returns the value of attribute profit_target_ranges.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def profit_target_ranges
  @profit_target_ranges
end

#rhoObject

Returns the value of attribute rho.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def rho
  @rho
end

#strategy_costObject

Returns the value of attribute strategy_cost.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def strategy_cost
  @strategy_cost
end

#thetaObject

Returns the value of attribute theta.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def theta
  @theta
end

#vegaObject

Returns the value of attribute vega.



426
427
428
# File 'lib/option_lab/models.rb', line 426

def vega
  @vega
end

Instance Method Details

#to_sObject



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# File 'lib/option_lab/models.rb', line 458

def to_s
  result = "Probability of profit: #{probability_of_profit}\n"
  result += "Expected profit: #{expected_profit}\n" if expected_profit
  result += "Expected loss: #{expected_loss}\n" if expected_loss
  result += "Strategy cost: #{strategy_cost}\n"
  result += "Min return: #{minimum_return_in_the_domain}\n"
  result += "Max return: #{maximum_return_in_the_domain}\n"

  if probability_of_profit_target > 0.0
    result += "Probability of reaching profit target: #{probability_of_profit_target}\n"
  end

  if probability_of_loss_limit > 0.0
    result += "Probability of reaching loss limit: #{probability_of_loss_limit}\n"
  end

  result
end