# Cross Chain Trade Test (CCTT)
Test automated trades between multiple chains on Mach.
[PyPI](https://pypi.org/project/mach-cctt/)
[Test PyPI](https://test.pypi.org/project/mach-cctt/)
## 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
```bash
# If using pip
python -m pip install mach-cctt
# If using uv
uv pip install mach-cctt
```
1. Usage
```bash
cctt --help
```
1. Example
```bash
# 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. |
Raw data
{
"_id": null,
"home_page": null,
"name": "mach_cctt",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.13.0",
"maintainer_email": null,
"keywords": "crypto, cryptocurrencies, cryptocurrency, defi, exchange, liquidity, mach, pool, swap, tristero",
"author": null,
"author_email": "Richard Dong <richard@tristero.xyz>, Marwan Hassanien <marwan@stanford.edu>",
"download_url": "https://files.pythonhosted.org/packages/23/ef/3547f6ced0ab49feeea456e5161d4990e09e7ea052c17082358cbef7d064/mach_cctt-0.1.13.tar.gz",
"platform": null,
"description": "# Cross Chain Trade Test (CCTT)\n\nTest automated trades between multiple chains on Mach.\n\n[PyPI](https://pypi.org/project/mach-cctt/)\n\n[Test PyPI](https://test.pypi.org/project/mach-cctt/)\n\n## Overview\n\nTest 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.\n\n## Usage\n\n1. Install\n\n ```bash\n # If using pip\n python -m pip install mach-cctt\n # If using uv\n uv pip install mach-cctt\n ```\n\n1. Usage\n\n ```bash\n cctt --help\n ```\n\n1. Example\n\n ```bash\n # The script will create log files. Recommended to create a directory for it.\n mkdir cctt/ && cd cctt/\n\n # Fill in this config file according to the template. Make sure you fill in the accounts section with your private keys.\n touch config.yaml\n export CONFIG_PATH=config.yaml\n\n # Show balances of all your accounts\n cctt balances\n\n # Test trading USDC between random chains, starting from Optimism-USDC\n cctt run --source Optimism-USDC --destination-policy fixed:USDC\n\n # Test trading USDC on only Arbitrum and Optimism, but fund the test by selling your Polygon-USDC balance\n cctt run --source Polygon-USDC --destination-policy cheap:USDC\n\n # Trade between random tokens on random chains, starting from Arbitrum-USDT\n cctt run --source Arbitrum-USDT --destination-policy random\n \n # If the --source is made explicitly empty, then whatever token has the highest value balance in your accounts is automatically chosen as the source\n cctt run --destination-policy random\n\n # 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.\n cctt withdraw\n ```\n\n Notes:\n\n - 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.\n\n## Destination Policies\n\n| **CLI Flag** | **Example** | **Name in Code** | **Description** |\n|---------------------------------|------------------------------------------------------|---------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `--destination fixed:<SYMBOL>` | `--destination fixed:USDC` | `RandomChainFixedSymbolPolicy` | Trade the token with symbol `<SYMBOL>` on random chains in a random order |\n| `--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. |\n| `--destination random` | `--destination random` | `RandomTokenPolicy` | Trade completely random tokens in a random order |\n| N/A | N/A | `TokenIteratorPolicy` | Takes a sequence of tokens and trades exactly those tokens in that order |\n| `--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. |\n",
"bugtrack_url": null,
"license": null,
"summary": "Test automated trades on the Mach exchange.",
"version": "0.1.13",
"project_urls": {
"Homepage": "https://github.com/tristeroresearch/cross-chain-trade-test",
"Issues": "https://github.com/tristeroresearch/cross-chain-trade-test/issues"
},
"split_keywords": [
"crypto",
" cryptocurrencies",
" cryptocurrency",
" defi",
" exchange",
" liquidity",
" mach",
" pool",
" swap",
" tristero"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e3002b35aa4d8e1923b91b1840c16ccbafbacc42c743194dc8cc563a1f04477e",
"md5": "1976cc79502e682a47280b0aa40c06ee",
"sha256": "d71794153bfef5f8b231ab88471fd5934846dbe52ba370188c86bd68c1c939fb"
},
"downloads": -1,
"filename": "mach_cctt-0.1.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1976cc79502e682a47280b0aa40c06ee",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.13.0",
"size": 22217,
"upload_time": "2024-12-20T14:20:22",
"upload_time_iso_8601": "2024-12-20T14:20:22.547063Z",
"url": "https://files.pythonhosted.org/packages/e3/00/2b35aa4d8e1923b91b1840c16ccbafbacc42c743194dc8cc563a1f04477e/mach_cctt-0.1.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "23ef3547f6ced0ab49feeea456e5161d4990e09e7ea052c17082358cbef7d064",
"md5": "a880581bcc2f3850077f0c30ce88acfd",
"sha256": "98bf7521d861543418da5cf4eafea114a02f603bdea0c4a617f19291b429bda5"
},
"downloads": -1,
"filename": "mach_cctt-0.1.13.tar.gz",
"has_sig": false,
"md5_digest": "a880581bcc2f3850077f0c30ce88acfd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.13.0",
"size": 18082,
"upload_time": "2024-12-20T14:20:25",
"upload_time_iso_8601": "2024-12-20T14:20:25.099309Z",
"url": "https://files.pythonhosted.org/packages/23/ef/3547f6ced0ab49feeea456e5161d4990e09e7ea052c17082358cbef7d064/mach_cctt-0.1.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-20 14:20:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tristeroresearch",
"github_project": "cross-chain-trade-test",
"github_not_found": true,
"lcname": "mach_cctt"
}