marginpy.utp.mango.account module

class UtpMangoAccount(client: MarginfiClient, marginfi_account: MarginfiAccount, account_data: UtpData)

Bases: UtpAccount

[internal] Mango proxy, encapsulating Mango-specific interactions.

!! Do not instantiate on its own !!

property config: MangoConfig

Gets Mango-specific config.

async make_activate_ix() InstructionsWrapper
async activate() TransactionSignature
async make_deactivate_ix() InstructionsWrapper
async deactivate() TransactionSignature
async make_deposit_ix(ui_amount: float) InstructionsWrapper
async deposit(ui_amount: float) TransactionSignature
async make_withdraw_ix(ui_amount: float) InstructionsWrapper
async withdraw(ui_amount: float) TransactionSignature
async make_place_perp_order_ix(perp_market: mango.PerpMarket, side: MangoSide, price: float, quantity: float, options: UtpMangoPlacePerpOrderOptions = UtpMangoPlacePerpOrderOptions(max_quote_quantity=None, limit=None, order_type=None, client_order_id=None, reduce_only=None, expiry_timestamp=None, expiry_type=None)) InstructionsWrapper
async place_perp_order(perp_market: mango.PerpMarket, side: MangoSide, price: float, quantity: float, options: UtpMangoPlacePerpOrderOptions = UtpMangoPlacePerpOrderOptions(max_quote_quantity=None, limit=None, order_type=None, client_order_id=None, reduce_only=None, expiry_timestamp=None, expiry_type=None)) TransactionSignature
async make_cancel_perp_order_ix(perp_market: PerpMarket, order_id: int, invalid_id_ok: bool) InstructionsWrapper
async cancel_perp_order(perp_market: PerpMarket, order_id: int, invalid_id_ok: bool) TransactionSignature
async compute_mango_account_address(account_number: int = 0)

[internal]

async get_observation_accounts() List[AccountMeta]

Creates list of account metas required to observe a Mango account.

async observe() UtpObservation

Retrieves the Mango observation directly from the Mango accounts and refreshes the cache.

get_logger()
get_mango_account_pda(mango_group_pk: PublicKey, authority: PublicKey, account_number: int, program_id: PublicKey) Tuple[PublicKey, int]

[internal] Computes the Mango account PDA tied to the specified user.