mach-cctt


Namemach-cctt JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryTest automated trades on the Mach exchange.
upload_time2024-12-04 18:54:13
maintainerNone
docs_urlNone
authorMarwan Hassanien
requires_python>=3.13.0
licenseNone
keywords crypto cryptocurrencies cryptocurrency defi exchange liquidity mach pool swap tristero
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 policy determining how the destination token will be chosen (randomize chain and symbol, randomize chain and fix symbol). 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 because the new source token for the next trade. This continues until the script is killed by the user.

## Usage

1. Install

    ```bash
    python -m pip install mach-cctt
    ```

1. Usage

    ```bash
    cctt --help
    ```

1. Example

    ```bash
    # The script will create log files and an account data file. Make a working directory for it.
    mkdir cctt/ && cd cctt/

    # Set password to avoid being prompted
    # export CCTT_PASSWORD="abc"

    # Backend defaults to production, change if necessary
    # export MACH_BACKEND_URL="https://cache-half-full-staging.fly.dev"
    
    cctt import # Import account
    cctt decrypt # Show public/private key
    cctt balances # Show account balances

    # Trade USDC on random chains, starting from optimism-USDC
    cctt run --source optimism-USDC --destination-policy fixed:USDC

    # Trade USDC on only arbitrum and optimism, starting from polygon-USDC
    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 empty, then an appropriate source with a non-zero balance is chosen for you.
    cctt run --source --destination-policy random
    ```

    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.
    - The `--source` token should be one that you hold a non-zero balance of in your wallet. If you set it to empty, it will be automatically chosen as any token with a non-zero balance in the wallet.
    - There is a known issue with trades filling for a single tick less than the order was placed at. As a preventative measure, any token balance of 1 tick in the wallet is treated as an empty balance.

## Log Files

There are 4 log files created by the application:

- `app.log` - everything
- `delayed_transactions.log` - the source funds where not withdrawn in time
- `stuck_transactions.log` - the source funds were withdrawn but the destination funds were not received in time
- `improper_fill.log` - the trade filled on the source chain for 1 tick less than the order was placed for. This has been observed to happen primarily to USDM (on multiple chains)

## Account File

A plaintext JSON file storing your account encrypted with your password will be created once you first generate or import a wallet. By default this file is called `account.json` but you can give a path to your own file via the `--file PATH` flag. This file is required to be present for any operation other than importing or generating a new wallet.

## Development

### Requirements

You need the [`just`](https://github.com/casey/just) command runner and either Python 3.12.5+ with `virtualenv`, or `pyenv`.

### Setup

1. **Clone the repository**

    ```bash
    git clone https://github.com/tristeroresearch/cross-chain-trade-test.git
    cd cross-chain-trade-test
    ```

1. **Create and activate a virtual environment**

    Using `venv`:

    ```bash
    python -m venv .venv
    source .venv/bin/activate
    ```

    Or using `pyenv`:

    ```bash
    pyenv virtualenv 3.12.5 cctt
    pyenv activate
    ```

1. **Install dependencies**

    ```bash
    just init
    ```

1. **View available recipes**

    ```bash
    just -l
    ```

    Note that there are recipes that allow you to run the application in-source without needed to build and package to PyPI first:

    ```bash
    just account_file=account.json import <private key> # Import a new account
    just decrypt # Show public and private key
    just balances # List balances of account
    just source=arbitrum-USDC policy=random run # Run the trade tester, starting from arbitrum-USDC and trading to random tokens
    just wallet=<public key> withdraw # Withdraw funds from the stored account to the given wallet
    ```

1. **Building**

    ```bash
    just build
    ```

#### Packaging

Make sure to bump the version number in `pyproject.toml`.

To upload to the test PyPI:

```bash
just upload-test
```

To upload to the main PyPI:

```bash
just upload
```

            

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": "Marwan Hassanien",
    "author_email": "Richard Dong <richard@tristero.xyz>",
    "download_url": "https://files.pythonhosted.org/packages/1c/37/c589d23e93349bb069b451fb1b52db4e0f5c735dc0dbacdc84e2ae5857c8/mach_cctt-0.1.1.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 policy determining how the destination token will be chosen (randomize chain and symbol, randomize chain and fix symbol). 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 because the new source token for the next trade. This continues until the script is killed by the user.\n\n## Usage\n\n1. Install\n\n    ```bash\n    python -m 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 and an account data file. Make a working directory for it.\n    mkdir cctt/ && cd cctt/\n\n    # Set password to avoid being prompted\n    # export CCTT_PASSWORD=\"abc\"\n\n    # Backend defaults to production, change if necessary\n    # export MACH_BACKEND_URL=\"https://cache-half-full-staging.fly.dev\"\n    \n    cctt import # Import account\n    cctt decrypt # Show public/private key\n    cctt balances # Show account balances\n\n    # Trade USDC on random chains, starting from optimism-USDC\n    cctt run --source optimism-USDC --destination-policy fixed:USDC\n\n    # Trade USDC on only arbitrum and optimism, starting from polygon-USDC\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 empty, then an appropriate source with a non-zero balance is chosen for you.\n    cctt run --source --destination-policy random\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    - The `--source` token should be one that you hold a non-zero balance of in your wallet. If you set it to empty, it will be automatically chosen as any token with a non-zero balance in the wallet.\n    - There is a known issue with trades filling for a single tick less than the order was placed at. As a preventative measure, any token balance of 1 tick in the wallet is treated as an empty balance.\n\n## Log Files\n\nThere are 4 log files created by the application:\n\n- `app.log` - everything\n- `delayed_transactions.log` - the source funds where not withdrawn in time\n- `stuck_transactions.log` - the source funds were withdrawn but the destination funds were not received in time\n- `improper_fill.log` - the trade filled on the source chain for 1 tick less than the order was placed for. This has been observed to happen primarily to USDM (on multiple chains)\n\n## Account File\n\nA plaintext JSON file storing your account encrypted with your password will be created once you first generate or import a wallet. By default this file is called `account.json` but you can give a path to your own file via the `--file PATH` flag. This file is required to be present for any operation other than importing or generating a new wallet.\n\n## Development\n\n### Requirements\n\nYou need the [`just`](https://github.com/casey/just) command runner and either Python 3.12.5+ with `virtualenv`, or `pyenv`.\n\n### Setup\n\n1. **Clone the repository**\n\n    ```bash\n    git clone https://github.com/tristeroresearch/cross-chain-trade-test.git\n    cd cross-chain-trade-test\n    ```\n\n1. **Create and activate a virtual environment**\n\n    Using `venv`:\n\n    ```bash\n    python -m venv .venv\n    source .venv/bin/activate\n    ```\n\n    Or using `pyenv`:\n\n    ```bash\n    pyenv virtualenv 3.12.5 cctt\n    pyenv activate\n    ```\n\n1. **Install dependencies**\n\n    ```bash\n    just init\n    ```\n\n1. **View available recipes**\n\n    ```bash\n    just -l\n    ```\n\n    Note that there are recipes that allow you to run the application in-source without needed to build and package to PyPI first:\n\n    ```bash\n    just account_file=account.json import <private key> # Import a new account\n    just decrypt # Show public and private key\n    just balances # List balances of account\n    just source=arbitrum-USDC policy=random run # Run the trade tester, starting from arbitrum-USDC and trading to random tokens\n    just wallet=<public key> withdraw # Withdraw funds from the stored account to the given wallet\n    ```\n\n1. **Building**\n\n    ```bash\n    just build\n    ```\n\n#### Packaging\n\nMake sure to bump the version number in `pyproject.toml`.\n\nTo upload to the test PyPI:\n\n```bash\njust upload-test\n```\n\nTo upload to the main PyPI:\n\n```bash\njust upload\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Test automated trades on the Mach exchange.",
    "version": "0.1.1",
    "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": "",
            "digests": {
                "blake2b_256": "0dc27e19e15d72358a3468e28759390097168af1ff16454d151484b28418d7c5",
                "md5": "ce82c1d567985ea789632bb7dfd01701",
                "sha256": "86a86b1d1093d10b05bf1532ce6bb3e1ed85d9477b7ab3b0a943ce38b37724b1"
            },
            "downloads": -1,
            "filename": "mach_cctt-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ce82c1d567985ea789632bb7dfd01701",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13.0",
            "size": 23029,
            "upload_time": "2024-12-04T18:54:10",
            "upload_time_iso_8601": "2024-12-04T18:54:10.264224Z",
            "url": "https://files.pythonhosted.org/packages/0d/c2/7e19e15d72358a3468e28759390097168af1ff16454d151484b28418d7c5/mach_cctt-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c37c589d23e93349bb069b451fb1b52db4e0f5c735dc0dbacdc84e2ae5857c8",
                "md5": "8da558d35c6af94cc9b5bc59301c2533",
                "sha256": "853218585911be847b6aab0bab4fce115da3410e625d0ae0066bdffcce3fbd1f"
            },
            "downloads": -1,
            "filename": "mach_cctt-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8da558d35c6af94cc9b5bc59301c2533",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13.0",
            "size": 18513,
            "upload_time": "2024-12-04T18:54:13",
            "upload_time_iso_8601": "2024-12-04T18:54:13.642258Z",
            "url": "https://files.pythonhosted.org/packages/1c/37/c589d23e93349bb069b451fb1b52db4e0f5c735dc0dbacdc84e2ae5857c8/mach_cctt-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-04 18:54:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tristeroresearch",
    "github_project": "cross-chain-trade-test",
    "github_not_found": true,
    "lcname": "mach-cctt"
}
        
Elapsed time: 0.99034s