OneDeltaPriceHelper

Documentation for eth_defi.one_delta.price.OneDeltaPriceHelper Python class.

class OneDeltaPriceHelper[source]

Internal helper class for price calculations.

Methods summary

__init__(one_delta)

get_amount_in(amount_out, path, fees[, ...])

Get how much token we are going to spend.

get_amount_out(amount_in, path, fees[, ...])

Get how much token we are going to receive.

__init__(one_delta)[source]
Parameters

one_delta (eth_defi.one_delta.deployment.OneDeltaDeployment) –

get_amount_out(amount_in, path, fees, exchange=Exchange.UNISWAP_V3, *, slippage=0, block_identifier=None)[source]

Get how much token we are going to receive.

Parameters
  • amount_in (int) – Amount of input asset.

  • path (list[eth_typing.evm.HexAddress]) – List of token addresses how to route the trade

  • fees (list[int]) – List of trading fees of the pools in the route

  • exchange (eth_defi.one_delta.constants.Exchange) – exchange to be used for the swap

  • slippage (float) – Slippage express in bps

  • block_identifier (Optional[int]) – A specific block to estimate price

Return type

int

get_amount_in(amount_out, path, fees, exchange=Exchange.UNISWAP_V3, *, slippage=0, block_identifier=None)[source]

Get how much token we are going to spend.

Parameters
  • amount_in – Amount of output asset.

  • path (list[eth_typing.evm.HexAddress]) – List of token addresses how to route the trade

  • fees (list[int]) – List of trading fees of the pools in the route

  • exchange (eth_defi.one_delta.constants.Exchange) – exchange to be used for the swap

  • slippage (float) – Slippage express in bps

  • block_identifier (Optional[int]) – A specific block to estimate price

  • amount_out (int) –

Return type

int