ZenQuant.Options.GammaWalls (zen_quant v0.2.0)

Copy Markdown View Source

Gamma exposure (GEX) wall computation from option chains.

Computes per-strike GEX values to identify support and resistance levels created by dealer hedging activity. Positive GEX indicates support (dealers buy dips), negative GEX indicates resistance (dealers sell rips).

Side Convention

The :side option controls sign interpretation:

  • :dealer (default) — calls +1, puts -1 (standard market making assumption)
  • :customer — inverted signs

Example

GammaWalls.aggregate(chain, 68000.0, top_n: 5)
# => [%{strike: 70000.0, gex: 1500.0, type: :support}, ...]

API Functions

FunctionArityDescriptionParam Kinds
aggregate3Aggregate gamma exposure by strike from an enriched option chain.chain: exchange_data, spot: value

Summary

Types

A single gamma wall entry with strike, GEX value, and classification

Functions

Aggregate gamma exposure by strike from an enriched option chain.

Types

wall_entry()

@type wall_entry() :: %{strike: float(), gex: float(), type: :support | :resistance}

A single gamma wall entry with strike, GEX value, and classification

Functions

aggregate(chain, spot, opts \\ [])

@spec aggregate(map(), number(), keyword()) :: [wall_entry()]

Aggregate gamma exposure by strike from an enriched option chain.

Parameters

  • chain - Option chain map %{symbol => option_map} with greeks in :raw (exchange_data)
  • spot - Current spot price (value)

Options

  • side - :dealer or :customer sign convention (default: :dealer)
  • min_oi - Minimum OI to include (default: 0)
  • top_n - Return only top N walls by absolute GEX

Returns

List of %{strike, gex, type: :support | :resistance} sorted by abs GEX desc (list)

Example

[%{type: :support, strike: 84000.0, gex: 1250.0}]
# descripex:contract
%{
  opts: %{
    side: %{
      default: :dealer,
      type: :atom,
      description: ":dealer or :customer sign convention"
    },
    min_oi: %{default: 0, type: :number, description: "Minimum OI to include"},
    top_n: %{
      default: nil,
      type: :integer,
      description: "Return only top N walls by absolute GEX"
    }
  },
  params: %{
    spot: %{description: "Current spot price", kind: :value},
    chain: %{
      description: "Option chain map %{symbol => option_map} with greeks in :raw",
      source: "Options.Deribit.chain(exchange_mod, enrich: :greeks)",
      kind: :exchange_data
    }
  },
  returns: %{
    type: :list,
    description: "List of %{strike, gex, type: :support | :resistance} sorted by abs GEX desc"
  },
  returns_example: [%{type: :support, strike: 84000.0, gex: 1250.0}]
}