marginpy.utp.zo.utils.client package

class Zo(program, config, state, state_signer, margin, margin_key)

Bases: object

dex_markets: dict[str, marginpy.utp.zo.utils.client.dex.Market]
cache: Any
control: Any
config: Config
state: Any
state_signer: PublicKey
margin: Any
margin_key: PublicKey
async static new(conn: AsyncClient, cluster: Literal['devnet', 'mainnet'], payer: Optional[Keypair] = None, url: Optional[str] = None, margin_pk: Optional[PublicKey] = None, tx_opts: TxOpts = TxOpts(skip_confirmation=False, skip_preflight=False, preflight_commitment='processed', max_retries=None, last_valid_block_height=None))

Create a new client instance.

Parameters
  • cluster – Which cluster to connect to.

  • payer – The transaction payer and margin owner. Defaults to the local transaction payer.

  • url – URL for the RPC endpoint.

  • load_margin – Whether to load the associated margin account. If False, any transaction requiring a margin will fail.

  • create_margin – Whether to create the associated margin account if it doesn’t already exist.

  • tx_opts – The transaction options.

property program: Program
property provider: Provider
property connection: AsyncClient
property wallet: Wallet
property collaterals

List of collaterals and their metadata.

property markets

List of collaterals and markets metadata.

property orderbook

Current state of the orderbook.

property balance

Current account balance.

property position

Current position.

property orders

Currently active orders.

async refresh(*, commitment: Commitment = 'processed')

Refresh the loaded accounts to see updates.

collaterals_map(k: str) str
markets_map(k: str) str

Submodules