Bourse.Unified.OptionQuantity (bourse v0.1.0)

Copy Markdown View Source

Converts option quantities between unified base exposure and venue wire units.

Unified option order quantities and position contracts are expressed in units of the option's base currency. Each authored venue declares whether its native quantity field uses base units or contract counts.

Summary

Functions

Converts an option contract count to canonical base exposure.

Converts a venue option quantity to canonical base-currency exposure.

Converts parsed option orders and positions from venue wire units to base exposure.

Applies authored option quantity semantics to a parsed market.

Converts canonical base exposure to an option contract count.

Converts a canonical base-currency option amount to the venue wire unit.

Converts unified option order amounts before venue request shaping.

Functions

from_contracts(market, contracts)

@spec from_contracts(Bourse.Market.t(), number() | String.t()) ::
  {:ok, number()} | {:error, Bourse.Error.t()}

Converts an option contract count to canonical base exposure.

from_native(market, amount)

@spec from_native(Bourse.Market.t(), number() | String.t()) ::
  {:ok, number()} | {:error, Bourse.Error.t()}

Converts a venue option quantity to canonical base-currency exposure.

from_native_result!(orders, exchange)

@spec from_native_result!(term(), Bourse.Exchange.t()) :: term()

Converts parsed option orders and positions from venue wire units to base exposure.

normalize_market(market, raw, exchange)

@spec normalize_market(Bourse.Market.t(), map(), Bourse.Exchange.t()) ::
  Bourse.Market.t()

Applies authored option quantity semantics to a parsed market.

to_contracts(market, amount)

@spec to_contracts(Bourse.Market.t(), number() | String.t()) ::
  {:ok, number()} | {:error, Bourse.Error.t()}

Converts canonical base exposure to an option contract count.

to_native(market, amount)

@spec to_native(Bourse.Market.t(), number() | String.t()) ::
  {:ok, number()} | {:error, Bourse.Error.t()}

Converts a canonical base-currency option amount to the venue wire unit.

to_native_request!(params, exchange, js_name)

@spec to_native_request!(map(), Bourse.Exchange.t(), String.t()) :: map()

Converts unified option order amounts before venue request shaping.