Trade
#
createTradeExactInConstructs an exact in trade with the given amount in and route
#
createTradeExactOutConstructs an exact out trade with the given amount out and route
#
createTradeFromRouteConstructs a trade by simulating swaps through the given route
#
createTradeFromRoutesConstructs a trade by simulating swaps through the given routes
#
createUncheckedTradeCreates a trade without computing the result of swapping through the route. Useful when you have simulated the trade elsewhere and do not have any tick data
#
createUncheckedTradeWithMultipleRoutesCreates a trade without computing the result of swapping through the routes. Useful when you have simulated the trade elsewhere and do not have any tick data
#
tradeInputAmountThe input amount for the trade assuming no slippage
#
tradeOutputAmountThe output amount for the trade assuming no slippage
#
tradeExecutionPriceThe price expressed in terms of output amount/input amount
#
tradePriceImpactReturns the percent difference between the route's mid price and the price impact
#
tradeMinimumAmountOutGet the minimum amount that must be received from the trade for the given slippage tolerance
#
tradeMaximumAmountInGet the maximum amount in that can be spent via the trade for the given slippage tolerance
#
tradeWorstExecutionPriceReturn the execution price after accounting for slippage tolerance
#
bestTradeExactInGiven a list of pools, and a fixed amount in, returns the top maxNumResults
trades that go from an input token
amount to an output token, making at most maxHops
hops.
Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting
the amount in among multiple routes.
#
bestTradeExactOutsimilar to bestTradeExactIn(...) but instead targets a fixed output amount
given a list of pools, and a fixed amount out, returns the top maxNumResults
trades that go from an input token
to an output token amount, making at most maxHops
hops
note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting
the amount in among multiple routes.