Class: OptionLab::Models::PricingResult
- Defined in:
- lib/option_lab/models.rb
Overview
Option pricing result with prices and Greeks
Instance Attribute Summary collapse
-
#delta ⇒ Object
Returns the value of attribute delta.
-
#gamma ⇒ Object
Returns the value of attribute gamma.
-
#model ⇒ Object
Returns the value of attribute model.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#price ⇒ Object
Returns the value of attribute price.
-
#rho ⇒ Object
Returns the value of attribute rho.
-
#theta ⇒ Object
Returns the value of attribute theta.
-
#vega ⇒ Object
Returns the value of attribute vega.
Instance Method Summary collapse
Constructor Details
This class inherits a constructor from OptionLab::Models::BaseModel
Instance Attribute Details
#delta ⇒ Object
Returns the value of attribute delta.
746 747 748 |
# File 'lib/option_lab/models.rb', line 746 def delta @delta end |
#gamma ⇒ Object
Returns the value of attribute gamma.
746 747 748 |
# File 'lib/option_lab/models.rb', line 746 def gamma @gamma end |
#model ⇒ Object
Returns the value of attribute model.
746 747 748 |
# File 'lib/option_lab/models.rb', line 746 def model @model end |
#parameters ⇒ Object
Returns the value of attribute parameters.
746 747 748 |
# File 'lib/option_lab/models.rb', line 746 def parameters @parameters end |
#price ⇒ Object
Returns the value of attribute price.
746 747 748 |
# File 'lib/option_lab/models.rb', line 746 def price @price end |
#rho ⇒ Object
Returns the value of attribute rho.
746 747 748 |
# File 'lib/option_lab/models.rb', line 746 def rho @rho end |
#theta ⇒ Object
Returns the value of attribute theta.
746 747 748 |
# File 'lib/option_lab/models.rb', line 746 def theta @theta end |
#vega ⇒ Object
Returns the value of attribute vega.
746 747 748 |
# File 'lib/option_lab/models.rb', line 746 def vega @vega end |
Instance Method Details
#to_h ⇒ Object
766 767 768 769 770 771 772 773 774 775 776 777 |
# File 'lib/option_lab/models.rb', line 766 def to_h { price: price, delta: delta, gamma: gamma, theta: theta, vega: vega, rho: rho, model: model, parameters: parameters, } end |
#to_s ⇒ Object
755 756 757 758 759 760 761 762 763 764 |
# File 'lib/option_lab/models.rb', line 755 def to_s result = "Option Price: #{price.round(4)}\n" result += "Delta: #{delta.round(4)}\n" if delta result += "Gamma: #{gamma.round(4)}\n" if gamma result += "Theta: #{theta.round(4)}\n" if theta result += "Vega: #{vega.round(4)}\n" if vega result += "Rho: #{rho.round(4)}\n" if rho result += "Model: #{model}\n" if model result end |