estimate_sell_price_decimals

Documentation for eth_defi.uniswap_v2.fees.estimate_sell_price_decimals function.

estimate_sell_price_decimals(uniswap, base_token_address, quote_token_address, quantity, *, fee=30, slippage=0, intermediate_token_address=None)[source]

Estimate how much we are going to get paid when doing a sell.

Much like estimate_sell_price() but in/out is expressed as python Decimal units. Furthermore, no ERC-20 token contract needed ABI, but it is loaded by the function.

Parameters
  • quantity (decimal.Decimal) – How much of the base token we want to sell, in token units (will be decimal autoconverted).

  • uniswap (eth_defi.uniswap_v2.deployment.UniswapV2Deployment) – Uniswap v2 deployment

  • base_token – Base token of the trading pair

  • quote_token – Quote token of the trading pair

  • fee (int) – Trading fee express in bps, default = 30 bps (0.3%)

  • slippage (float) – Slippage express in bps

  • base_token_address (eth_typing.evm.HexAddress) –

  • quote_token_address (eth_typing.evm.HexAddress) –

  • intermediate_token_address (Optional[eth_typing.evm.HexAddress]) –

Returns

Expected quote token amount to receive in quota tokens (decimal converted).

Raises

TokenDetailError – If we have an issue with ERC-20 contracts

Return type

decimal.Decimal