Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OrderBook

Hierarchy

  • OrderBook

Index

Constructors

constructor

Properties

buyOrders

buyOrders: IBuyOrder[]

sellOrders

sellOrders: ISellOrder[]

Methods

estimateMarketBuy

  • estimateMarketBuy(tokenAmount: Tokens, ethFiatRate: Tokens): IMarketMatch
  • calculate price for n amount of token to buy

    Parameters

    • tokenAmount: Tokens

      amount of token to buy

    • ethFiatRate: Tokens

      current rate

    Returns IMarketMatch

    simple buy data { tokens, ethers, limitPrice, averagePrice }

estimateMarketSell

  • estimateMarketSell(tokenAmount: Tokens, ethFiatRate: Tokens): IMarketMatch
  • calculate price for n amount of token to sell

    Parameters

    • tokenAmount: Tokens

      amount of token to sell

    • ethFiatRate: Tokens

      current rate

    Returns IMarketMatch

    simple buy data { tokens, ethers, limitPrice, averagePrice }

getMatchingOrders

  • calculate matching pairs from ordered ordebook for sending in Exchange.matchMultipleOrders ethereum tx

    Parameters

    • ethFiatRate: Tokens

      current ETHFiat rate to use for calculation

    • gasLimit: number

      return as many matches as it fits to gasLimit based on gas cost estimate.

    Returns IMatchingOrders

    pairs of matching order id , ordered by execution sequence { buyIds: [], sellIds: [], gasEstimate }

hasMatchingOrders

  • hasMatchingOrders(): boolean
  • Returns boolean

Static compareBuyOrders

Static compareSellOrders

Generated using TypeDoc