Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/options_library/option_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Since Feb 13, 2011
# Based on Black-Scholes forumla for pricing options

module Option
module OptionLib
class Calculator
class << self
# used for finding implied vol based on a market (target) price
Expand Down Expand Up @@ -49,6 +49,7 @@ def vega( underlying, strike, time, interest, sigma, dividend )

# computes the fair value of the call based on the knowns and assumed volatility (sigma)
def price_call( underlying, strike, time, interest, sigma, dividend )
return 0 if underlying== strike && time <= 0.00000
d1 = d_one( underlying, strike, time, interest, sigma, dividend )
discounted_underlying = exp(-1.0 * dividend * time) * underlying
probability_weighted_value_of_being_exercised = discounted_underlying * norm_sdist( d1 )
Expand All @@ -62,6 +63,7 @@ def price_call( underlying, strike, time, interest, sigma, dividend )

# computes the fair value of the put based on the knowns and assumed volatility (sigma)
def price_put( underlying, strike, time, interest, sigma, dividend )
return 0 if underlying== strike && time <= 0.00000
d2 = d_two( underlying, strike, time, interest, sigma, dividend )
discounted_strike = strike * exp(-1.0 * interest * time)
probabiltity_weighted_value_of_discounted_strike = discounted_strike * norm_sdist( -1.0 * d2 )
Expand Down
2 changes: 1 addition & 1 deletion lib/options_library/option_call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Since Feb 18, 2011
# Based on Black-Scholes forumla for pricing options

module Option
module OptionLib
class Call < Model

def initialize
Expand Down
2 changes: 1 addition & 1 deletion lib/options_library/option_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Since Feb 18, 2011
# Based on Black-Scholes forumla for pricing options

module Option
module OptionLib
class Model

# The two known option types, Call and Put
Expand Down
2 changes: 1 addition & 1 deletion lib/options_library/option_put.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Since Feb 18, 2011
# Based on Black-Scholes forumla for pricing options

module Option
module OptionLib
class Put < Model

def initialize
Expand Down
2 changes: 1 addition & 1 deletion options_library.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = %q{options_library}
s.version = "1.0.3"
s.version = "1.0.32"

s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
s.authors = ["Dan Tylenda-Emmons"]
Expand Down