> For the complete documentation index, see [llms.txt](https://docs.metalx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metalx.com/dex-bot/installation.md).

# 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 \
*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&amp;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
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.metalx.com/dex-bot/installation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
