# Installation

### Prerequisites

To get started make sure that you have the following:

* A [WebAuth.com](https://wauth.co) account with enough funds for trading
* [Nodejs and npm](https://nodejs.org/en) installed on your computer (nodejs 18.0.0)
* [VS Code](https://code.visualstudio.com/) (or some other editor)

**Important:** You must use node 18.0.0 \
\&#xNAN;*You can use Node Version Manager (nvm) to manage your node version.*

First clone the [repo](https://github.com/XPRNetwork/dex-bot)

```
git clone https://github.com/XPRNetwork/dex-bot.git
```

Navigate to the folder and in your terminal run

```
npm install
```

Edit your default.json using vscode or your code editor of choice.

<figure><img src="https://1068387139-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2KWLHP2zE3VO3AoelaSy%2Fuploads%2FCArKLv5ZGQaKg1YLdzNK%2Fimage.png?alt=media&#x26;token=fb057780-d7f6-4922-8059-9395ad6137bd" alt=""><figcaption></figcaption></figure>

If you want the bot to automatically cancel open orders on exit (when you command + c) for your convenience you can set this parameter to true

```
    "cancelOpenOrdersOnExit": true,
```

Choose the strategy, either gridBot or marketMaker

```
    "strategy": "gridBot",
```

Set your pairs and parameters (covered in next section)

```
    "gridBot": {
      "pairs": [
        {
          "symbol": "XPR_XMD",
          "upperLimit": 0.0009000,
          "lowerLimit": 0.0006000,
          "gridLevels": 14,
          "bidAmountPerLevel": 40000
        }             
      ]
    },
```

Enter environment variables in terminal. Depending on your operating system, enter the PROTON\_USERNAME and PROTON\_PRIVATE\_KEY

```
Mac and Linux:
export PROTON_USERNAME=user1
export PROTON_PRIVATE_KEY=private_key

Windows using powershell:
$env:PROTON_USERNAME = 'user1'
$env:PROTON_PRIVATE_KEY = 'private_key'
```

Then you can run the bot

```
npm run bot
```

To stop the bot you can use **Cmd**+C (mac) or **Ctrl**+C (windows)

### Important Notes

* Minimum order is $1 or 1 XMD on Metal X
* Bot will automatically add more orders once old ones are filled
* If you have trouble using the trading interface make sure you have [verified identity](https://identity.metalx.com/)
* Keep your private key protected

You can clear your private key from the screen in your terminal before you run the bot you can run the following command;\
\
**Windows**&#x20;

```
cls
```

**Mac / Linux**

```
clear
```
