interbtc-api

@interlay/interbtc-api / Exports / Trade

Class: Trade

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Trade(path, inputAmount, outputAmount): Trade

Parameters

Name Type
path MultiPath
inputAmount MonetaryAmount<CurrencyExt>
outputAmount MonetaryAmount<CurrencyExt>

Returns

Trade

Defined in

src/parachain/amm/trade/trade.ts:11

Properties

executionPrice

executionPrice: MonetaryAmount<CurrencyExt>

Defined in

src/parachain/amm/trade/trade.ts:9


inputAmount

inputAmount: MonetaryAmount<CurrencyExt>

Defined in

src/parachain/amm/trade/trade.ts:13


outputAmount

outputAmount: MonetaryAmount<CurrencyExt>

Defined in

src/parachain/amm/trade/trade.ts:14


path

path: MultiPath

Defined in

src/parachain/amm/trade/trade.ts:12


priceImpact

priceImpact: Big

Defined in

src/parachain/amm/trade/trade.ts:10

Methods

getMinimumOutputAmount

getMinimumOutputAmount(maxSlippage): MonetaryAmount<CurrencyExt>

Get minimum output amount for trade with provided maximum allowed slippage.

Parameters

Name Type Description
maxSlippage number Maximum slippage in percentage.

Returns

MonetaryAmount<CurrencyExt>

Minimum output amount of trade allowed with provided slippage.

Defined in

src/parachain/amm/trade/trade.ts:52


isBetter

isBetter(anotherTrade): boolean

Comparator for 2 trades with same input and output.

Parameters

Name Type Description
anotherTrade null | Trade Trade to compare.

Returns

boolean

true if this trade is better, false if anotherTrade is better.

Throws

When provided trade has different input or output currency.

Defined in

src/parachain/amm/trade/trade.ts:28