Skip to main content

Test automated trades on the Mach exchange.

Project description

Cross Chain Trade Test (CCTT)

Test automated trades between multiple chains on Mach.

PyPI

Test PyPI

Overview

Test automated trades on Mach. Specify a start chain and symbol, and a destination policy determining how the destination token will be chosen. In each trade, the test wallet's entire balance of the source token will be sold for the destination token, and then the destination token becomes the new source token for the next trade. This continues until the script is killed by the user, or there are no more tokens yielded by the destination policy.

Usage

  1. Install

    # If using pip
    python -m pip install mach-cctt
    # If using uv
    uv pip install mach-cctt
    
  2. Usage

    cctt --help
    
  3. Example

    # The script will create log files. Recommended to create a directory for it.
    mkdir cctt/ && cd cctt/
    
    # Fill in this config file according to the template. Make sure you fill in the accounts section with your private keys.
    touch config.yaml
    export CONFIG_PATH=config.yaml
    
    # Show balances of all your accounts
    cctt balances
    
    # Test trading USDC between random chains, starting from Optimism-USDC
    cctt run --source Optimism-USDC --destination-policy fixed:USDC
    
    # Test trading USDC on only Arbitrum and Optimism, but fund the test by selling your Polygon-USDC balance
    cctt run --source Polygon-USDC --destination-policy cheap:USDC
    
    # Trade between random tokens on random chains, starting from Arbitrum-USDT
    cctt run --source Arbitrum-USDT --destination-policy random
    
    # If the --source is made explicitly empty, then whatever token has the highest value balance in your accounts is automatically chosen as the source
    cctt run  --destination-policy random
    
    # Once you're done, you can set withdrawal addresses in the config file and withdraw the funds from the test accounts into the withdraw addresses. Note that gas is not withdrawn.
    cctt withdraw
    

    Notes:

    • You need to have a gas on every chain, or a gas of exactly 0 on chains that you do not wish the testing script to trade on, which will cause those chains to be disabled.

Destination Policies

CLI Flag Example Name in Code Description
--destination fixed:<SYMBOL> --destination fixed:USDC RandomChainFixedSymbolPolicy Trade the token with symbol <SYMBOL> on random chains in a random order
--destination cheap:<SYMBOL> --destination cheap:WETH CheapChainFixedSymbolPolicy Trade the token with symbol <SYMBOL> on only chains with "cheap" gas. Currently hardcoded to only Arbitrum and Optimism.
--destination random --destination random RandomTokenPolicy Trade completely random tokens in a random order
N/A N/A TokenIteratorPolicy Takes a sequence of tokens and trades exactly those tokens in that order
--destination chains:<CHAINS> --destination chains:Arbitrum,Optimism,Base,Solana SingleChainPolicy Trades all tokens in the given list of chains <CHAINS>. Trades all tokens on one chain in a random order, and trades between chains in a random order. Used to test single-chain trades.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mach_cctt-0.1.22.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mach_cctt-0.1.22-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file mach_cctt-0.1.22.tar.gz.

File metadata

  • Download URL: mach_cctt-0.1.22.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.8

File hashes

Hashes for mach_cctt-0.1.22.tar.gz
Algorithm Hash digest
SHA256 1a3e5defb6c6259705451b6655c527e325ce788321d70f68614335b8f108ecf4
MD5 6747fa2e945c47c862e0f79e4ee216a2
BLAKE2b-256 cb2601fce3dc86c37ea745e60dcd67653aca751e04836c2f2e353bab2e753e27

See more details on using hashes here.

File details

Details for the file mach_cctt-0.1.22-py3-none-any.whl.

File metadata

  • Download URL: mach_cctt-0.1.22-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.8

File hashes

Hashes for mach_cctt-0.1.22-py3-none-any.whl
Algorithm Hash digest
SHA256 e604daf6866465f3bc41ae8459629ee29c88454e247a88628bc20338e6ab304d
MD5 efdd7146f96bec2efba1de0e473c4619
BLAKE2b-256 3dd860dd33ccd3f692e6aee1ef547b72a90fe54b054c6b6f6d30ef9748cdbb3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page