Account Model
Exchange Account
PDA Seeds
Account
Value | Definition | |
---|---|---|
accounting | Struct holding exchange accounting values (see below) | |
settings | Struct holding exchange settings (see below) | |
id | unique id for exchange account used in PDA | |
market_ids | Set of ids corresponding to the exchange's active markets | |
oracle_configs | Set of authorized oracle programs | |
status | Bitmask where bits are paused actions for the exchange. Actions include DepositMargin, WithdrawMargin, AddLiquidity, RemoveLiquidity, IncreasePosition, DecreasePosition, Liquidate, ProcessSettlementRequests | |
collateral_expo | Collateral token's decimals stored as i16 | |
collateral_mint | Collateral token mint address | |
collateral_vault | Exchange's collateral token account | |
admin | Exchange's admin address | |
nominated_admin | Staged new admin address | |
authorized_settler | Address of authorized account that does not accept settlement tips | |
authorized_protocol_fees_collector | Address of account authorized to collect protocol fees on admin's behalf | |
Exchange Accounting
Value | Definition | |
---|---|---|
notional_open_interest | Notional collateral value of open interest across all markets | |
unrealized_pnl | Last cached unrealized pnl estimate | |
last_time_locked_open_interest_accounting_refreshed | Last unix timestamp when unrealized pnl and notional oi were refreshed | |
balance | The exchange's collateral balance. This value increases and decreases with trader pnl and trading fees | |
margin_balance | Total deposited margin collateral | |
lp_balance | Total deposited LP collateral | |
lp_shares | Total shares outstanding | |
protocol_fees | Uncollected protocol fees | |
unsettled_collateral_amount | Total withdrawn collateral amount that is pending settlement |
Exchange Settings
Value | Definition | |
---|---|---|
min_lp_duration | The minimum amount of time in seconds an LP must hold their LP deposit | |
settlement_delay | The amount of time used to set a settlement request's maturity field during withdraw_margin or remove_liquidity instructions. Used for settlement request validation in process_settlement_requests | |
min_liquidation_fee | If liquidation fee is smaller than this collateral value, then use this value. | |
max_liquidation_fee | If liquidation fee is larger than this collateral value, then use this value. | |
locked_open_interest_staleness_threshold | Max staleness tolerance in seconds for refreshing unrealized pnl and notional oi cache | |
protocol_fee_rate | Protocol's percentage share of each trading fee | |
locked_open_interest_ratio | Percentage of notional oi that LPs must maintain. | |
max_keeper_tip_rate | The maximum keeper tip percentage of collateral to settle. |
Market Account
PDA Seeds
Value | Definition | |
---|---|---|
settings | Struct holding exchange settings (see below) | |
accounting | Struct holding exchange accounting values (see below) | |
id | Unique market id used in PDA | |
exchange | Exchange address | |
price_feed | Price feed address | |
status | Bitmask where bits are paused actions for this market. Actions include IncreasePosition and DecreasePosition |
Market Accounting
Value | Definition | |
---|---|---|
weighted_position_price | Weighted average price for all open positions using position base asset units for weighting. Used in unrealized pnl estimates | |
last_utilized_liquidation_capacity | Amount of notional oi that has been utilized in the current epoch | |
size | Market's total open interest measured in base asset units. | |
skew | Market's skew measured in base asset units. Signed where positive means long skew and negative means short skew. | |
weighted_position_funding_per_unit | Weighted average funding per unit for all open positions using position base asset units for weighting. Used in unrealized pnl estimates | |
last_funding_rate | Latest funding rate accumulation. Stored as a PreciseInt. | |
last_funding_per_unit | Latest funding per unit accumulation. Stored as a PreciseInt. | |
last_time_funding_updated | Unix timestamp updated with the current timestamp each time an instruction cranks funding | |
first_liquidation_epoch_start_time | Tracks the start of the liquidation epochs for discrete epoch index calculations | |
last_liquidation_epoch_index | Last seen liquidation epoch index which reflects which discrete period the market is in | |
last_time_liquidation_capacity_updated | Unix timestamp marking last time a liquidate instruction updated the epoch's capacity | |
Market Settings
Value | Definition | |
---|---|---|
min_position_margin | Smallest margin amount a position must maintain | |
skew_scale | Normalization scaler for skew | |
max_side_size | Open interest cap per side of the market | |
max_liquidation_limit_accumulation_multiplier | Multiplier used in determining liquidation epoch capacity | |
max_seconds_in_liquidation_epoch | Max length of a liquidation epoch. Each liquidation epoch has a maximum amount of capacity that can be liquidated. | |
initial_margin_ratio | The percentage applied to the position's size normalized by skew_scale | |
maker_fee_rate | Percentage fee rate applied to the notional maker portion of a trade | |
taker_fee_rate | Percentage fee rate applied to the notional taker portion of a trade | |
max_funding_velocity | Max possible rate of change per day for the funding rate if skew is 100% of skew_scale | |
liquidation_fee_rate | Percentage fee rate applied to notional liquidation amounts paid to liquidator's margin account | |
min_initial_margin_ratio | The constant initial margin percentage added to the dynamic portion. Sets the maximum leverage multiple. | |
maintenance_margin_proportion | Percentage applied to computed initial margin ratio | |
max_liquidation_pd | Premium/discount (skew/skew_scale) percentage that the market tolerates for liquidation capacity being used even if epoch capacity is depleted. | |
authorized_liquidator | Address of the market's authorized account that can optionally skip liquidation epoch capacity and fully liquidate eligible accounts. This account does not accept liquidation fees. |
LP Position
PDA Seeds
Value | Definition | |
---|---|---|
id | Unique id for lp position account used in PDA | |
liquidity | Total collateral amount deposited as exchange liquidity | |
shares | Total LP shares owned by this account | |
maturity | Unix timestamp after which this position's liquidity can be can be partially or fully removed. | |
exchange | Exchange address | |
owner | Position owner's address |
Margin Account
PDA Seeds
Value | Definition | |
---|---|---|
positions | Set of active positions (see below) | |
margin | Total margin collateral deposited. This value increases and decreases with settled pnl | |
max_liquidation_fee | Set during the first liquidation ix for this account and updatd in subsequent liquidaitons, if there are any. Used to cap liquidation fees over potentially multiple ixs. | |
id | Unique id for the account used in PDA | |
exchange | Exchange address | |
owner | Account owner's address | |
delegate | Delegate's address. Delegate is set and unset by owner. Delegate can sign for deposit_margin ix and modify_position ix but cannot sign for any other margin account ixs. | |
in_liquidation | Flag marking the account is currently in liquidation. This means the account is being liquidated across multiple liquidation ixs. |
Position
Value | Definition | |
---|---|---|
size | Size of the position in base asset units. Signed where positive means long position and negative means short position | |
last_interaction_price | Fill price of last trade. Subtracted from current fill price in next pnl calculation | |
last_interaction_funding_per_unit | Associated market's funding per unit during last trade. Subtracted from current funding per unit in next pnl calculation | |
market_id | Id of the market this position belongs to |
Settlement Request
PDA Seeds
Value | Definition | |
---|---|---|
id | Unique id for request used in PDA | |
maturity | Unix timestamp when the request can be processed and settled. | |
amount | The collateral amount that will be transferred to request.owner_token_account during settlement. | |
keeper_tip | Collateral tip that the owner has allocated to the keeper who processes the settlement request once it has reached maturity calling the process_settlement_requests ix. Tip is a percentage of request.amount. This percentage cannot exceed the exchange's max tip percentage setting. | |
exchange | Address of the associated exchange | |
owner | Address of the request's owner who is the authority of the request.owner_token_account | |
owner_token_account | Destination token account address for settled collateral transfer. Protocol enforces must be ata. | |
LP Account (deprecated)
Value | Definition | |
---|---|---|
liquidity | Total collateral amount deposited as exchange liquidity | |
shares | Total LP shares controlled by this account | |
last_add_liquidity_timestamp | Weighted average unix timestamp using liquidity deposits for weighting. Validated against exchange.min_lp_duration in remove_liquidity ix | |
exchange | Exchange address | |
owner | Account owner's address | |
delegate | Delegate's address. Delegate is set and unset by owner. Delegate can sign for add_liquidity ix but cannot sign for any other LP account ixs. |
Last updated