pure_greeks

Gem Version CI License: MIT

Pure-Ruby options Greeks (delta, gamma, theta, vega, rho), pricing, and implied volatility for vanilla European and American options. No Python, no QuantLib system dep, no native code.

Documentation, examples, and engine internals: https://jayrav13.github.io/ruby-pure-greeks/

Installation

Add to your Gemfile:

gem "pure_greeks"

Then bundle install. Or install directly:

gem install pure_greeks

Requires Ruby 3.2 or newer. No system dependencies.

Quick example

require "pure_greeks"

option = PureGreeks::Option.new(
  exercise_style: :american, type: :call,
  strike: 150.0, expiration: Date.new(2026, 6, 19),
  underlying_price: 148.5, implied_volatility: 0.35,
  risk_free_rate: 0.05, dividend_yield: 0.0,
  valuation_date: Date.today
)

option.price   # => 4.27
option.delta   # => 0.42

For the full API, the implied-volatility solver, how the three engines fall back to one another, validation methodology, and limitations, see the documentation site.

Development

Clone and bootstrap:

git clone https://github.com/jayrav13/ruby-pure-greeks.git
cd ruby-pure-greeks
bin/setup

Run the test suite:

bundle exec rspec

Run the linter:

bundle exec rubocop

Open a console with the gem loaded:

bin/console

To install this gem onto your local machine for trial use:

bundle exec rake install

Releasing

Releases are tag-driven through CI — no manual gem push needed.

  1. On a feature branch, bump lib/pure_greeks/version.rb to the new version.
  2. Add a section to CHANGELOG.md for the new version (Keep-a-Changelog format).
  3. Open a PR; CI must be green.
  4. Merge to main. The release workflow (.github/workflows/release.yml) detects the version bump, runs the test suite, builds the gem, publishes to RubyGems via Trusted Publishing (no API key), creates a vX.Y.Z git tag, and opens a GitHub Release with auto-generated notes from the merged PRs.

The RubyGems version badge above refreshes automatically once the new version indexes on rubygems.org (usually within a minute).

Contributing

Bug reports and pull requests are welcome at https://github.com/jayrav13/ruby-pure-greeks. Please run bundle exec rspec and bundle exec rubocop locally before opening a PR. CI runs both on Ruby 3.2, 3.3, and 3.4.

License

MIT. See LICENSE.txt.