marginpy.utp package

class UtpAccount(client: MarginfiClient, marginfi_account: MarginfiAccount, is_active: bool, utp_config: UTPAccountConfig)

Bases: ABC

[internal] Abstract class for common behaviour in UTP proxies.

is_active: bool
abstract async get_observation_accounts() List[AccountMeta]
abstract async observe() UtpObservation
abstract async deposit(ui_amount: float) TransactionSignature
abstract async withdraw(ui_amount: float) TransactionSignature
abstract property config: UtpConfig
property index: UtpIndex
property cached_observation: UtpObservation
property equity: float
property free_collateral: float
property init_margin_requirement: float
property liquidation_value: float
property is_rebalance_deposit_needed: bool
property max_rebalance_deposit_amount: float
property is_empty: bool
property address: PublicKey
async authority(seed: Optional[PublicKey] = None) Tuple[PublicKey, int]

Gets UTP authority (PDA).

Parameters

seed (PublicKey, optional) – seed required only at UTP activation. Defaults to None.

compute_liquidation_prices() LiquidationPrices

Calculates liquidation parameters given an account value.

throw_if_not_active()
async make_create_proxy_token_account_ixs(proxy_token_account_key: Keypair, utp_authority_pk: PublicKey) InstructionsWrapper
class UtpObservation(timestamp: datetime, equity: float, free_collateral: float, init_margin_requirement: float, liquidation_value: float, is_rebalance_deposit_needed: bool, max_rebalance_deposit_amount: float, is_empty: bool)

Bases: object

UtpObservation struct mirroring on-chain data. Contains a UTP health metrics.

timestamp: datetime
equity: float
free_collateral: float
init_margin_requirement: float
liquidation_value: float
is_rebalance_deposit_needed: bool
max_rebalance_deposit_amount: float
is_empty: bool
static from_raw(raw: ObservationRaw) UtpObservation

Subpackages

Submodules