arb-bot 0.0.1
Bancor python arb-bot library.
Requires Python: >=3.8

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# Arb Bot
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

**Warning**

_The arb-bot is a work in progress with potentially broken features, unfinished sections, and a non-exhaustive overview of commands and example usage. Moreover, the entirety of the codebase and documentation is subject to change without warning. Having said this -- we will make an effort to keep the interface backwards compatible so that existing code will not break._

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


## About the Arb Bot

The Arb Bot is a tool developed to find and close arbitrage opportunities that occur on Bancor products. This serves to increase market efficiency by ensuring Bancor liquidity 

The permament URL for this repo is [github.com/bancorprotocol/arb-bot][repo]. 

## Getting started
Running the Arb Bot requires the ability to read and write to Ethereum. It is preconfigured to use Alchemy & Etherscan, and requires API keys for each of these services. 
* [Alchemy](https://www.alchemy.com/)
* [Etherscan](https://etherscan.io/)

Add the API keys to a file named `.env`, using the format provided in `.env.example`, in the main arb_bot project folder. 

To use Infura instead of Alchemy, add your Infura API key to the .env file in the format: `export WEB3_INFURA_PROJECT_ID='INFURA_API_KEY'`

## Project setup
The Arb Bot uses Brownie for Ethereum network calls, however Brownie uses Infura by default. 

To configure Brownie with Alchemy, open a terminal in the Arb Bot project's folder, and execute the following commands:

1: `brownie networks update_provider alchemy https://eth-{}.alchemyapi.io/v2/$WEB3_ALCHEMY_PROJECT_ID`

2: `brownie networks modify mainnet provider=alchemy`

3: `brownie networks set_provider alchemy`

If you receive the error: `ValueError: Unable to expand environment variable in host setting: 'https://mainnet.infura.io/v3/$WEB3_INFURA_PROJECT_ID'`, try repeating the previous steps, and check [Brownie documentation](https://eth-brownie.readthedocs.io/en/stable/network-management.html#adding-providers). 


### Method 1. Quick setup

Navigate to the top level project directory and run:

````{tab} PyPI
$ python arb_bot/run.py
````

if you get import errors or a `ModuleNotFound` exception, try: 

````{tab} PyPI
$ python your-local-absolute-path/arb_bot/run.py
````

The upside of this method is that you get started quickly and easily. The downside is that the `carbon` library may only work for notebooks and scripts located in the root directory of this project.

### Method 2. Installation

This method will install the `carbon` package as well as all its dependencies on your system. We highly recommend to do this [in a virtual environment][venv], in which case no permanent changes will be made. To install the simulator, navigate to the top level project directory, and run the installation process via
````{tab} PyPI
$ python setup.py install
````

Then try running the following command:
````{tab} PyPI
$ python arb_bot/run.py
````

As the `carbon` library is now installed on your system, you can run the code from anywhere whilst the virtual environment is active.

# Branches and versioning

## 
This repo contains three key branches, `main`, `beta` and `dev`. Their respective properties are as follows:

- `main`. The main branch is the main release branch of this project. It may not contain all bleeding edge features, but it has been tested thoroughly (but see the disclaimer on top). The main branch will never be rewritten.

- `dev`. The dev branch contains the latest features. The test suit will not usually run before pushing to dev, so this branch may be broken. Also you should expect it to be rewritten.

## Versioning

We attempt to use [semantic versioning][semver] (`major.minor.patch`), so the major number is changed on backward incompatible API changes, the minor number on compatible changes, and the patch number for minor patches.

[semver]:https://semver.org/

# Change log

- **v1.0** - initial release