UniswapV2ExecutionModelVersion0#

tradeexecutor.ethereum.uniswap_v2_execution_v0.UniswapV2ExecutionModelVersion0 class.

class UniswapV2ExecutionModelVersion0[source]#

Bases: ExecutionModel

Run order execution on a single Uniswap v2 style exchanges.

TODO: This model was used in the first prototype and later discarded.

__init__(uniswap, hot_wallet, min_balance_threshold=Decimal('0.5'), confirmation_block_count=6, confirmation_timeout=datetime.timedelta(seconds=300), max_slippage=0.01, stop_on_execution_failure=True)[source]#
Parameters
  • state

  • uniswap (UniswapV2Deployment) –

  • hot_wallet (HotWallet) –

  • min_balance_threshold – Abort execution if our hot wallet gas fee balance drops below this

  • confirmation_block_count – How many blocks to wait for the receipt confirmations to mitigate unstable chain tip issues

  • confirmation_timeout – How long we wait transactions to clear

  • stop_on_execution_failure – Raise an exception if any of the trades fail top execute

Methods

__init__(uniswap, hot_wallet[, ...])

param state

execute_trades(ts, state, trades, ...[, ...])

Execute the trades determined by the algo on a designed Uniswap v2 instance.

get_routing_state_details()

Prototype does not know much about routing.

initialize()

Set up the wallet

is_live_trading()

preflight_check()

Check that we can connect to the web3 node

Attributes

chain_id

Which chain the live execution is connected to.

__init__(uniswap, hot_wallet, min_balance_threshold=Decimal('0.5'), confirmation_block_count=6, confirmation_timeout=datetime.timedelta(seconds=300), max_slippage=0.01, stop_on_execution_failure=True)[source]#
Parameters
  • state

  • uniswap (UniswapV2Deployment) –

  • hot_wallet (HotWallet) –

  • min_balance_threshold – Abort execution if our hot wallet gas fee balance drops below this

  • confirmation_block_count – How many blocks to wait for the receipt confirmations to mitigate unstable chain tip issues

  • confirmation_timeout – How long we wait transactions to clear

  • stop_on_execution_failure – Raise an exception if any of the trades fail top execute

property chain_id: int#

Which chain the live execution is connected to.

preflight_check()[source]#

Check that we can connect to the web3 node

initialize()[source]#

Set up the wallet

execute_trades(ts, state, trades, routing_model, routing_state, check_balances=False)[source]#

Execute the trades determined by the algo on a designed Uniswap v2 instance.

Parameters
Returns

Tuple List of succeeded trades, List of failed trades

Return type

Tuple[List[TradeExecution], List[TradeExecution]]

get_routing_state_details()[source]#

Prototype does not know much about routing.

Return type

object