swap_cow_interactive#

API documentation for tradeexecutor.cli.repl_utils.swap_cow_interactive Python function.

swap_cow_interactive(console_context, in_token, out_token, amount_in, max_slippage=0.01)[source]#

Swap some tokens (stablecoins) using CowSwap.

  • Get a quote from CowSwap

  • Ask yes/no confirmation

Example:

# from tradeexecutor.cli.repl_utils import swap_cow_interactive

# Swap from USDC to crvUSD on Arbitrum
usdc = "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
crvusd = "0x498Bf2B1e120FeD3ad3D42EA2165E9b73f99C1e5"

swap_cow_interactive(
    locals(),
    in_token=usdc,
    out_token=crvusd,
    amount_in=50.0,
)
Parameters:
  • console_context (dict) –

  • in_token (Union[HexAddress, str]) –

  • out_token (Union[HexAddress, str]) –

  • amount_in (float) –