LighterEquity
Documentation for eth_defi.lighter.valuation.LighterEquity Python class.
- class LighterEquity
Bases:
objectEquity breakdown for a Lighter trading account.
See
fetch_lighter_total_equity().Attributes summary
Lighter account index.
Account collateral before unrealised position PnL.
Sum of
positions[].unrealized_pnlin the collateral currency.Canonical account NAV reported by Lighter as
total_asset_value.Free collateral balance available for new orders or withdrawals.
Cross-margin initial margin requirement in the collateral currency.
Cross-margin maintenance margin requirement in the collateral currency.
Number of open position records returned by the Lighter API.
Methods summary
__init__(account_index, collateral, ...)Calculate account NAV from collateral and unrealised PnL.
Return canonical Lighter account NAV.
- account_index: int
Lighter account index.
- collateral: decimal.Decimal
Account collateral before unrealised position PnL.
- unrealised_pnl: decimal.Decimal
Sum of
positions[].unrealized_pnlin the collateral currency.
- total_asset_value: decimal.Decimal
Canonical account NAV reported by Lighter as
total_asset_value.
- available_balance: decimal.Decimal
Free collateral balance available for new orders or withdrawals.
- initial_margin_requirement: decimal.Decimal
Cross-margin initial margin requirement in the collateral currency.
- maintenance_margin_requirement: decimal.Decimal
Cross-margin maintenance margin requirement in the collateral currency.
- position_count: int
Number of open position records returned by the Lighter API.
- get_total()
Return canonical Lighter account NAV.
Lighter exposes
total_asset_valuedirectly, so this method returns the API value instead of recomputing it locally. Usecalculate_total_from_parts()for a collateral plus PnL sanity check.- Returns
Account net asset value in the deployment’s collateral currency.
- Return type
- calculate_total_from_parts()
Calculate account NAV from collateral and unrealised PnL.
- Returns
collateral + unrealised_pnlin the collateral currency.- Return type
- __init__(account_index, collateral, unrealised_pnl, total_asset_value, available_balance, initial_margin_requirement, maintenance_margin_requirement, position_count)
- Parameters
account_index (int) –
collateral (decimal.Decimal) –
unrealised_pnl (decimal.Decimal) –
total_asset_value (decimal.Decimal) –
available_balance (decimal.Decimal) –
initial_margin_requirement (decimal.Decimal) –
maintenance_margin_requirement (decimal.Decimal) –
position_count (int) –
- Return type
None