Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • MangoAccount

Index

Constructors

constructor

Properties

advancedOrders

advancedOrders: { perpTrigger?: PerpTriggerOrder }[]

advancedOrdersKey

advancedOrdersKey: PublicKey

beingLiquidated

beingLiquidated: boolean

borrows

borrows: I80F48[]

clientOrderIds

clientOrderIds: BN[]

delegate

delegate: PublicKey

deposits

deposits: I80F48[]

inMarginBasket

inMarginBasket: boolean[]

info

info: number[]

isBankrupt

isBankrupt: boolean

mangoGroup

mangoGroup: PublicKey

metaData

metaData: MetaData

msrmAmount

msrmAmount: BN

notUpgradable

notUpgradable: boolean

numInMarginBasket

numInMarginBasket: number

orderMarket

orderMarket: number[]

orderSide

orderSide: string[]

orders

orders: BN[]

owner

owner: PublicKey

perpAccounts

perpAccounts: PerpAccount[]

publicKey

publicKey: PublicKey

spotOpenOrders

spotOpenOrders: PublicKey[]

spotOpenOrdersAccounts

spotOpenOrdersAccounts: (undefined | OpenOrders)[]

Accessors

name

  • get name(): string

Methods

calcTotalPerpPosUnsettledPnl

calcTotalPerpUnsettledPnl

computeValue

getAssetsVal

getAvailableBalance

getBasePositionUiWithGroup

  • getBasePositionUiWithGroup(marketIndex: number, group: MangoGroup): number
  • Return the current position for the market at marketIndex in UI units e.g. if you buy 1 BTC in the UI, you're buying 1,000,000 native BTC, 10,000 BTC-PERP contracts and exactly 1 BTC in UI Find the marketIndex in the ids.json list of perp markets

    Parameters

    Returns number

getCollateralValueUi

getEquityUi

getHealth

getHealthComponents

getHealthFromComponents

getHealthRatio

getHealthsFromComponents

getLeverage

getLiabsVal

getLiquidationPrice

getMarketMarginAvailable

  • getMarketMarginAvailable(mangoGroup: MangoGroup, mangoCache: MangoCache, marketIndex: number, marketType: "spot" | "perp"): I80F48

getMaxLeverageForMarket

getMaxWithBorrowForToken

getModHealthComponents

getModWeightedAssetsLiabsVals

getNativeBorrow

getNativeDeposit

getNativeLiabsVal

getNet

getNetExposureByAsset

  • Calculates the exposure for each spot asset and perp contract in standard UI numbers. E.g. if a user has net borrowed $100, and is long 10,000 MNGO contracts this would return: [{asset: "USDC", symbol: "USDC", amount: -100, value: -100}, {asset: "MNGO-PERP", symbol: "MNGO", amount: 10000, value: 2000}] All perp markets that are active for the mango group need to be loaded before calling this method and can passed in arbitrary order.

    Parameters

    Returns { amount: number; asset: string; symbol: string; value: number }[]

getOpenOrdersKeysInBasket

getOpenOrdersKeysInBasketPacked

  • getOpenOrdersKeysInBasketPacked(): PublicKey[]

getPerpOpenOrders

  • getPerpOpenOrders(): { marketIndex: number; price: BN; side: string }[]
  • Get all the open orders using only info in MangoAccount; Does not contain information about the size of the order.

    Returns { marketIndex: number; price: BN; side: string }[]

getPerpPositionUi

  • getPerpPositionUi(marketIndex: number, perpMarket: PerpMarket): number
  • Return the current position for the market at marketIndex in UI units e.g. if you buy 1 BTC in the UI, you're buying 1,000,000 native BTC, 10,000 BTC-PERP contracts and exactly 1 BTC in UI Find the marketIndex in the ids.json list of perp markets

    Parameters

    Returns number

getPriceMoveToLiquidate

getSpotVal

  • getSpotVal(mangoGroup: any, mangoCache: any, index: any, assetWeight: any): I80F48

getUiBorrow

getUiDeposit

getWeightedAssetsLiabsVals

hasAnySpotOrders

  • hasAnySpotOrders(): boolean

isLiquidatable

loadAdvancedOrders

  • loadAdvancedOrders(connection: Connection): Promise<{ perpTrigger?: PerpTriggerOrder }[]>

loadOpenOrders

  • loadOpenOrders(connection: Connection, serumDexPk: PublicKey): Promise<(undefined | OpenOrders)[]>

loadSpotOrdersForMarket

  • loadSpotOrdersForMarket(connection: Connection, market: Market, marketIndex: number): Promise<Order[]>
  • Parameters

    • connection: Connection
    • market: Market
    • marketIndex: number

    Returns Promise<Order[]>

mgnoAccruedValue

reload

reloadFromSlot

  • reloadFromSlot(connection: Connection, lastSlot?: number, dexProgramId?: undefined | PublicKey): Promise<[MangoAccount, number]>

toPrettyString

Generated using TypeDoc