UniswapV3PoolRevaluator#

API documentation for tradeexecutor.ethereum.uniswap_v3.uniswap_v3_valuation.UniswapV3PoolRevaluator Python class in Trading Strategy framework.

class UniswapV3PoolRevaluator[source]#

Bases: EthereumPoolRevaluator

Re-value assets based on their on-chain price.

Does directly JSON-RPC call to get the latest price in the Uniswap pools.

Only uses direct route - mostly useful for testing, may not give a realistic price in real world with multiple order routing options.

Warning

This valuation method always uses the latest price. It cannot be used for backtesting.

__init__(pricing_model)[source]#
Parameters:

pricing_model (UniswapV3LivePricing) –

Methods

__init__(pricing_model)

__init__(pricing_model)[source]#
Parameters:

pricing_model (UniswapV3LivePricing) –

__call__(ts, position)[source]#
Parameters:
  • ts (datetime) – When to revalue. Used in backesting. Live strategies may ignore.

  • position (TradingPosition) – Open position

Returns:

(revaluation date, price) tuple. Note that revaluation date may differ from the wantead timestamp if there is no data available.

Return type:

Tuple[datetime, float]