PositionSizingResult

Documentation for eth_defi.gmx.market_depth.PositionSizingResult Python class.

class PositionSizingResult

Bases: object

Result of whale-risk position sizing for one side of a market.

Computed by calculate_max_position_whale_risk(). The maximum position is the tightest of three constraints:

  1. Portfolio: the total capital available (portfolio_usd).

  2. Whale risk: a fraction of the side’s open interest (max_oi_pct * side_oi), so the position doesn’t move the market disproportionately.

  3. Pool capacity: the remaining OI capacity before the reserve cap.

Attributes summary

max_position_usd

Maximum position size in USD after applying all constraints

pct_of_total_oi

The maximum position as a percentage of total (both-side) OI

whale_ok

True if the full portfolio fits within the whale-risk threshold

cap_ok

True if the full portfolio fits within pool capacity

binding_constraint

The constraint that limits the position: "none", "whale", or "cap"

Methods summary

__init__(max_position_usd, pct_of_total_oi, ...)

max_position_usd: float

Maximum position size in USD after applying all constraints

pct_of_total_oi: float

The maximum position as a percentage of total (both-side) OI

whale_ok: bool

True if the full portfolio fits within the whale-risk threshold

cap_ok: bool

True if the full portfolio fits within pool capacity

binding_constraint: str

The constraint that limits the position: "none", "whale", or "cap"

__init__(max_position_usd, pct_of_total_oi, whale_ok, cap_ok, binding_constraint)
Parameters
  • max_position_usd (float) –

  • pct_of_total_oi (float) –

  • whale_ok (bool) –

  • cap_ok (bool) –

  • binding_constraint (str) –

Return type

None