Skip to content

Using Arbitrader

Peter Keeler edited this page Jun 1, 2021 · 5 revisions

Configuration

Arbitrader uses a configuration file called application.yaml. There is an example file in the project named application.example.yaml that shows all the options and explains what they do. You will need to copy that file and fill in the configuration that you want. When you run Arbitrader the configuration file must be in the directory you run the bot from. If no configuration can be found you'll get an error saying Spring couldn't start up.

How to Run the Bot

The easiest way to run Arbitrader is through Docker. If you don't already have it, go ahead and install Docker on your machine. This project includes a Docker Compose file so you can get up and running in just a few steps:

  1. Install Docker if you don't have it already.
  2. Clone the project from GitHub.
  3. Create your application.yaml based on application.example.yaml.
  4. Run docker-compose up to start the bot.

If everything works properly you'll see Docker download the container and some log messages as it reads your configuration file and connects to the exchanges. Once you see the "Started Arbitrader..." message you may not see any further messages for awhile until it finds a trading opportunity.

Important Note for Windows Users

In Windows docker-compose does not understand the ${PWD} environment variable and will not turn it into the current working directory automatically. A workaround is to create a file called .env (TIP: Name it .env. in the Save... dialog!) in the same directory as you are running Arbitrader in with one line of configuration that points to Arbitrader's directory:

PWD=C:\absolute\path\to\arbitrader\directory

Adding the aforementioned configuration will set the ${PWD} variable to the hard coded value that you picked.

Running Without Docker

If you would rather run Arbitrader directly from the JAR file instead of using Docker you will need to compile the JAR yourself. Please see the Development Guide to learn how to build the JAR. After it is built you can execute it like this, replacing x.y.z with the version number:

java -jar arbitrader-x.y.z-SNAPSHOT.jar

Running it this way is the hard way and our ability to support you is much more limited. Trust us, Docker is much easier.

Stopping and Restarting

When Arbitrader enters a trade it will write a JSON file in .arbitrader/arbitrader-state.json with the details of that trade. If you need to restart the bot for any reason, such as to update to a newer version, it will read that file on startup and remember the open trades.

To stop Arbitrader simply hit Ctrl+C and it will stop. If any trades were active they will be reloaded when you start it again the next time. Look for the log message as it starts up to be sure.

If something has gone wrong and you need to restart the bot due to an error, it may be necessary to delete .arbitrader/arbitrader-state.json and log into your exchanges to close any open positions manually. In general the bot will prefer to "fail fast" and exit rather than compounding any problems it faces by trying to fix them automatically. This is a deliberate design decision to avoid making things worse once we already know something is wrong.