Skip to main content

Carbon Arbitrage Bot, an open-source arbitrage protocol, allows any user to perform arbitrage between Bancor ecosystem protocols and external exchanges and redirect arbitrage profits back to the protocol.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Fastlane Arbitrage Bot

⚠️ WARNING: Use at Your Own Risk

The Fastlane Bot requires an Ethereum private key. Your funds are AT RISK when you run the Fastlane Arbitrage Bot. Read the Preparation section below. The bot is provided as-is, with the authors and the Bprotocol Foundation not liable for any losses.

Overview

The Fastlane Arbitrage Bot identifies and executes arbitrage opportunities between Carbon, Bancor, and the broader market, enhancing market efficiency by aligning Carbon and Bancor with market trends.

Permanent URL for this repository: github.com/bancorprotocol/fastlane-bot

Getting Started

Installation

Install Fastlane Arbitrage Bot from PyPi using the following command:

pip install fastlane_bot

Or clone the repo from Bancor's GitHub:

git clone https://github.com/bancorprotocol/fastlane-bot
cd fastlane-bot
pip install -r requirements.txt
python setup.py install

Preparation

The Fastlane Arbitrage Bot needs access to an Ethereum wallet's private key. THIS KEY IS AT RISK AND SHOULD NOT BE USED ELSEWHERE. Maintain some ETH in the wallet for gas fees and regularly sweep profits. Supply the private key to the bot using an environment variable, as shown:

set ETH_PRIVATE_KEY_BE_CAREFUL="0x9c..."

The bot also needs access to the Ethereum blockchain, preconfigured to use Alchemy. Obtain a free API key from alchemy.com and supply it to the bot using an environment variable:

set WEB3_ALCHEMY_PROJECT_ID="0-R5..."

The bot uses python-dotenv to load environment variables from a .env file in the root directory. However, this is not recommended for security reasons, especially on unencrypted disks.

export WEB3_ALCHEMY_PROJECT_ID="0-R5..."
export ETH_PRIVATE_KEY_BE_CAREFUL="0x9c..."

Execution

After installation, run the bot with default parameters using the command:

python main.py 

Configuration Options

You can configure the Fastlane Arbitrage Bot using the options in the @click.option section of main.py. An overview of options is provided below:

  • cache_latest_only (bool): Whether to cache only the latest events.
  • arb_mode (str): Specifies the arbitrage mode. Options include:
    • single: Arbitrage between one Carbon curve and one other exchange curve.
    • multi (default): Arbitrage between multiple Carbon curves and one other exchange curve.
    • triangle: Triangular arbitrage between one Carbon curve and two other exchange curves.
    • multi_triangle: Triangular arbitrage between multiple Carbon curves and two other exchange curves.
    • bancor_v3: Arbitrage between two Bancor v3 pools and one other exchange curve.
  • flashloan_tokens (str): Tokens the bot can use for flash loans. Specify tokens as a comma-separated string in TKN-ADDR format (e.g., BNT-FF1C, WETH-6Cc2).
  • exchanges (str): Comma-separated string of exchanges to include.
  • polling_interval (int): Bot's polling interval for new events.
  • alchemy_max_block_fetch (int): Maximum number of blocks to fetch in a single request.
  • reorg_delay (int): Number of blocks to wait to avoid reorgs.
  • loglevel (str): Logging level, which can be DEBUG, INFO, WARNING, or ERROR.

Specify options in the command line. For example:

python main.py --arb_mode=multi --polling_interval=12 --reorg_delay=10 --loglevel=INFO

Troubleshooting

If you encounter import errors or ModuleNotFound exceptions, try:

python <absolute_path>/main.py

The Fastlane Arbitrage Bot uses Brownie with Alchemy for Ethereum network calls. If you need to manually configure Brownie, follow these steps:

brownie networks update_provider alchemy https://eth-{}.alchemyapi.io/v2/$WEB3_ALCHEMY_PROJECT_ID
brownie networks modify mainnet provider=alchemy
brownie networks set_provider alchemy

For further issues, check the Brownie documentation.

Change Log

We follow semantic versioning (major.minor.patch), updating the major number for backward incompatible API changes, minor for compatible changes, and patch for minor patches.

  • v2.0 - Complete rewrite to include Carbon along with Bancor.
  • v1.0 - Initial bot version for Bancor protocol pools only.

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

fastlane_bot-0.27.1.tar.gz (159.3 kB view details)

Uploaded Source

Built Distributions

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

fastlane_bot-0.27.1-py3.9.egg (463.2 kB view details)

Uploaded Egg

fastlane_bot-0.27.1-py3-none-any.whl (192.1 kB view details)

Uploaded Python 3

File details

Details for the file fastlane_bot-0.27.1.tar.gz.

File metadata

  • Download URL: fastlane_bot-0.27.1.tar.gz
  • Upload date:
  • Size: 159.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for fastlane_bot-0.27.1.tar.gz
Algorithm Hash digest
SHA256 454938abe9891f3c47fc79f3537df1f5814c789952bd2601f6a42c328bee2d3a
MD5 1979a65a103b399361959bd765fa331a
BLAKE2b-256 6733f43373bc395838ae909936e9599c684bd76851bc6602d1ab3c05c7f867ce

See more details on using hashes here.

File details

Details for the file fastlane_bot-0.27.1-py3.9.egg.

File metadata

  • Download URL: fastlane_bot-0.27.1-py3.9.egg
  • Upload date:
  • Size: 463.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for fastlane_bot-0.27.1-py3.9.egg
Algorithm Hash digest
SHA256 529f83aeb2ad08e224bd5765538c6eaa59a76785e9ffd91ba94bbe3a2ef501b2
MD5 32c33295f260150e639a576b6ab28be2
BLAKE2b-256 24a7322e5e379e1ff5c358c9c12efac1b61d348ef33bb8d1ffa18b307f9fa40f

See more details on using hashes here.

File details

Details for the file fastlane_bot-0.27.1-py3-none-any.whl.

File metadata

  • Download URL: fastlane_bot-0.27.1-py3-none-any.whl
  • Upload date:
  • Size: 192.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for fastlane_bot-0.27.1-py3-none-any.whl
Algorithm Hash digest
SHA256 47aa91cfd435b32593a8076bc4abf2cb19e2375500d320804c89e017d0ae9dcb
MD5 6e8a9b6ff84a5a7b6527bfe241870cb9
BLAKE2b-256 d5c6c6e4cbe5b73d9ce9f536717c9926bb3d5352ba822e895043231a378f245f

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