Skip to content

Commit

Permalink
Merge pull request #465 from enarjord/v7.0.0
Browse files Browse the repository at this point in the history
Passivbot v7.0.0
  • Loading branch information
enarjord authored Sep 6, 2024
2 parents f807c67 + 7a0d5c1 commit 2698a52
Show file tree
Hide file tree
Showing 3,764 changed files with 12,278 additions and 160,615 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
108 changes: 94 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,117 @@
![Passivbot](docs/images/pbot_logo_full.svg)

# Trading bot running on Bybit, Binance, OKX, Kucoin, Bitget, BingX and Hyperliquid
# Trading bot running on Bybit, Binance, OKX, Bitget, GateIO and Hyperliquid

:warning: **Used at one's own risk** :warning:

v6.1.4
v7.0.0


## Overview

Passivbot is a cryptocurrency trading bot written in Python, intended to require minimal user intervention.
Passivbot is a cryptocurrency trading bot written in Python and Rust, intended to require minimal user intervention.

It operates on perpetual futures derivatives markets, automatically creating and cancelling limit buy and sell orders on behalf of the user. It does not try to predict future price movements, it does not use technical indicators, nor does it follow trends. Rather, it is a contrarian market maker, providing resistance to price changes in both directions, thereby "serving the market" as a price stabilizer.

Passivbot's behavior may be backtested on historical price data, using the included backtester whose CPU heavy functions are written compatible with Numba for speed. Also included is an optimizer, which finds better configurations by iterating thousands of backtests with different candidates, converging on the optimal ones with an evolutionary algorithm.
Passivbot's behavior may be backtested on historical price data, using the included backtester whose CPU heavy functions are written in Rust for speed. Also included is an optimizer, which finds better configurations by iterating thousands of backtests with different candidates, converging on the optimal ones with an evolutionary algorithm.

## Strategy

Inspired by the Martingale betting strategy, the robot will make a small initial entry and double down on its losing positions multiple times to bring the average entry price closer to current price action. The orders are placed in a grid, ready to absorb sudden price movements. After each re-entry, the robot quickly updates its closing orders at a set take-profit markup. This way, if there is even a minor market reversal, or "bounce", the position can be closed in profit, and it starts over.

### Forager
The Forager feature dynamically chooses the most volatile markets on which to open positions. Volatility is defined as the mean of the normalized relative range for the most recent candles (15m by default), i.e. `mean((ohlcv.high - ohlcv.low) / ohlcv.close)`.
The Forager feature dynamically chooses the most volatile markets on which to open positions. Volatility is defined as the mean of the normalized relative range for the most recent 1m candles, i.e. `mean((ohlcv.high - ohlcv.low) / ohlcv.close)`.

### Unstucking Mechanism
Passivbot manages underperforming, or "stuck", positions by realizing small losses over time. If multiple positions are stuck, the bot prioritizes positions with the smallest gap between the entry price and current market price for "unstucking". Losses are limited by ensuring that the account balance does not fall under a set percentage below the past peak balance.

## Controlling the bot

Passivbot is controlled via terminal commands.
To let Passivbot run on multiple markets simultaneously, use passivbot_multi (see docs/passivbot_multi.md)
There is also an integrated manager for controlling multiple single symbol bots (see docs/manager.md).
See also https://github.com/msei99/pbgui/ for a web based Passivbot GUI.
## Installation

To install Passivbot and its dependencies, follow the steps below.

### Step 1: Clone the Repository

First, clone the Passivbot repository to the local machine:

```sh
git clone https://github.com/enarjord/passivbot.git
cd passivbot
```


### Step 2: Install Rust
Passivbot uses Rust for some of its components. Install Rust by following these steps:

Visit https://www.rust-lang.org/tools/install
Follow the instructions for your operating system to install Rustup, the Rust installer and version management tool.
After installation, restart your terminal or command prompt.

### Step 3: Create and Activate a Virtual Environment

Create a virtual environment to manage dependencies:

```sh
python3 -m venv venv
```

Activate the virtual environment:

- On Windows:
```sh
.\venv\Scripts\activate
```
- On macOS and Linux:
```sh
source venv/bin/activate
```

### Step 4: Install Python Dependencies

Install all the required Python dependencies listed in the `requirements.txt` file:

```sh
pip install -r requirements.txt
```

### Step 5: Build Rust Extensions

Navigate to the `passivbot-rust` directory and build the Rust extensions using `maturin`:

```sh
cd passivbot-rust
maturin develop --release
cd ..
```

Note that the Rust bindings must be recompiled for changes in the Rust source to take effect.

### Step 6: Add API keys

Make a copy of the api-keys template file:

```sh
cp api-keys.json.example api-keys.json
```

Add your keys to api-keys.json.

### Step 6: Run Passivbot

Make a live configuration file, using `configs/live/example_config.hjson` as a template.

To start the bot, run:

```sh
python src/main.py configs/live/example_config.hjson
```

## Jupyter Lab

Jupyter lab needs to be run in the same virtual environment as the bot. Activate venv (see installation instructions above, step 3), and launch Jupyter lab from the Passivbot root dir with:
```shell
python3 -m jupyter lab
```

## Requirements

Expand All @@ -39,13 +120,13 @@ See also https://github.com/msei99/pbgui/ for a web based Passivbot GUI.

## Pre-optimized configurations

Pre-optimized configurations for Passivbot can be found in the directory `configs/live/`
Coming soon...

See also https://pbconfigdb.scud.dedyn.io/

## Documentation:

For more detailed information about Passivbot, see documentation on https://www.passivbot.com
For more detailed information about Passivbot, see documentation files here: [docs/](docs/) or on www.passivbot.com

## Support

Expand All @@ -56,7 +137,7 @@ For more detailed information about Passivbot, see documentation on https://www.
## Third Party Links, Referrals and Tip Jar

**Passivbot Manager Service:**
For users uncomfortable with or unwilling to run the robot themselves, there is a paid manager service to run Passivbot on the user's behalf.
There is a paid manager service to run Passivbot on the user's behalf:
www.passivbotmanager.com

**Referrals:**
Expand All @@ -66,7 +147,6 @@ https://partner.bybit.com/b/passivbot
https://partner.bitget.com/bg/Y8FU1W
https://www.okx.com/join/PASSIVBOT (20% rebate)
https://www.kucoin.com/r/rf/QBSFZ5HT
https://bingx.com/invite/DFONXA

**BuyMeACoffee:**
https://www.buymeacoffee.com/enarjord
Expand Down
11 changes: 5 additions & 6 deletions api-keys.example.json → api-keys.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"bitget": "https://partner.bitget.com/bg/Y8FU1W",
"okx": "https://www.okx.com/join/PASSIVBOT",
"kucoin": "https://www.kucoin.com/r/rf/QBSFZ5HT",
"bingx": "https://bingx.com/invite/DFONXA"
},
"binance_01" : {
"exchange": "binance",
Expand Down Expand Up @@ -40,15 +39,15 @@
"secret": "secret",
"passphrase": "passphrase"
},
"bingx_01" : {
"exchange": "bingx",
"key": "key",
"secret": "secret"
},
"hyperliquid_01" : {
"exchange": "hyperliquid",
"wallet_address": "wallet_address",
"private_key": "private_key",
"is_vault": false
},
"gateio_01" : {
"exchange": "gateio",
"key": "key",
"secret": "secret"
}
}
Loading

0 comments on commit 2698a52

Please sign in to comment.