Trade
tokenEquals
Checks if the current instance is equal to another (has an identical chainId and address).
tokenEquals(token: Token!, other: Token!): Boolean!
createTrade
Creates a new trade.
createTrade(
route: Route!
amount: TokenAmount!
tradeType: TradeType!
): Trade!
tradeExecutionPrice
Calculates the average price that the trade would execute at.
tradeExecutionPrice(
trade: Trade!
): String!
tradeNextMidPrice
What the new mid price would be if the trade were to execute.
tradeNextMidPrice(
trade: Trade!
): String!
tradeSlippage
The slippage incurred by the trade. (strictly > 0.30%) result is a percent like 100.0%
tradeSlippage(
trade: Trade!
): String!
tradeMinimumAmountOut
Trades the minimum amount out.
tradeMinimumAmountOut(
trade: Trade!
slippageTolerance: String! # Float32!
): TokenAmount!
tradeMaximumAmountIn
Trades the maximum amount in.
tradeMaximumAmountIn(
trade: Trade!
slippageTolerance: String! # Float32!
): TokenAmount!
bestTradeExactIn
Given a list of pairs, a fixed amount in, and token out, this method returns the best maxNumResults trades that swap an input token amount to an output token, making at most maxHops hops. The returned trades are sorted by output amount, in decreasing order, and all share the given input amount.
bestTradeExactIn(
pairs: [Pair!]!
amountIn: TokenAmount!
tokenOut: Token!
options: BestTradeOptions
): [Trade!]!
bestTradeExactOut
Similar to the above method, but targets a fixed output token amount. The returned trades are sorted by input amount, in increasing order, and all share the given output amount.
bestTradeExactOut(
pairs: [Pair!]!
tokenIn: Token!
amountOut: TokenAmount!
options: BestTradeOptions
): [Trade!]!