Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Market

Hierarchy

  • Market

Index

Constructors

  • new Market(algodClient: default, historicalIndexerClient: default, marketAppId: number): Market
  • This is the constructor for the Market class.

    Note, do not call this to create a new market. Instead call the static method init as there are asynchronous set up steps in creating an market and a constructor can only return an instance of the class and not a promise.

    Example

    //Correct way to instantiate new market
    const newMarket = await Market.init(algodClient, historicalIndexerClient, marketAppId)

    //Incorrect way to instantiate new market
    const newMarket = new Market(algodClient, historicalIndexerClient, marketAppId)

    Parameters

    • algodClient: default

      algod client

    • historicalIndexerClient: default

      historical indexer client

    • marketAppId: number

      application id of the market we are interested in

    Returns Market

Properties

activeCollateral: number
algod: default
asset: Asset
bankAssetId: number
bankCirculation: number
bankToUnderlyingExchange: number
baseInterestRate: number
collateralFactor: number
historicalIndexer: default
liquidationIncentive: number
marketAddress: string
marketAppId: number
marketBorrowCapInDollars: number
marketCounter: number
marketSupplyCapInDollars: number
oracleAppId: number
oraclePriceField: string
oraclePriceScaleFactor: number
outstandingBorrowShares: number
reserveFactor: number
slope1: number
slope2: number
totalBorrowInterestRate: number
underlyingAssetId: number
underlyingBorrowed: number
underlyingCash: number
underlyingReserves: number
utilizationOptimal: number

Methods

  • getActiveCollateral(): number
  • Returns active collateral for this market

    Returns number

    active collateral

  • getBankCirculation(): number
  • Returns bank circulation for this market

    Returns number

    bank circulation

  • getBankToUnderlyingExchange(): number
  • Returns bank to underlying exchange for this market

    Returns number

    bank to underlying exchange

  • getCollateralFactor(): number
  • Returns collateral factor for this market

    Returns number

    collateral factor

  • getLiquidationIncentive(): number
  • Returns liquidation incentive for this market

    Returns number

    liquidation incentive

  • getMarketAddress(): string
  • Returns the market address for this market

    Returns string

    market address

  • getMarketAppId(): number
  • Returns the app id for this market

    Returns number

    market app id

  • getMarketCounter(): number
  • Returns the market counter for this market

    Returns number

    market counter

  • getOutstandingBorrowShares(): number
  • Returns outstanding borrow shares for this market

    Returns number

    outstanding borrow shares

  • getStorageState(storageAddress: string): Promise<{}>
  • Returns the market local state for address

    Parameters

    • storageAddress: string

      storage addres to get info for

    Returns Promise<{}>

    market local state for address

  • getTotalBorrowInterestRate(block?: any): Promise<number>
  • Returns total borrow interest rate for this market

    Parameters

    • block: any = null

      block to get total borrow interest rate for

    Returns Promise<number>

    total borrow interest rate

  • getUnderlyingBorrowed(block?: number): Promise<number>
  • Returns underlying borrowed for this market

    Parameters

    • block: number = null

      specific block to get underlying borrowe for

    Returns Promise<number>

  • getUnderlyingCash(block?: any): Promise<number>
  • Returns underlying cash for this market

    Parameters

    • block: any = null

      block to get underlying cash for

    Returns Promise<number>

    underlying cash

  • getUnderlyingReserves(block?: any): Promise<number>
  • Returns underlying reserves for this market

    Parameters

    • block: any = null

      block to get underlying reserves for

    Returns Promise<number>

    underlying reserves

  • updateGlobalState(): Promise<void>
  • Method to fetch most recent market global state

    Returns Promise<void>

  • init(algodClient: default, historicalIndexerClient: default, marketAppId: number): Promise<Market>
  • This is the function that should be called when creating a new market. You pass everything you would to the constructor, but to this function instead and this returns the new and created market.

    Example

    //Correct way to instantiate new market
    const newMarket = await Market.init(algodClient, historicalIndexerClient, marketAppId)

    //Incorrect way to instantiate new market
    const newMarket = new Market(algodClient, historicalIndexerClient, marketAppId)

    Parameters

    • algodClient: default

      algod client

    • historicalIndexerClient: default

      historical indexer client

    • marketAppId: number

      application id of the market we are interested in

    Returns Promise<Market>

    a new instance of the market class fully constructed

Generated using TypeDoc