Skip to content

Latest commit

 

History

History
162 lines (100 loc) · 5.62 KB

README.md

File metadata and controls

162 lines (100 loc) · 5.62 KB

Passivbot

Trading bot running on Bybit, OKX, Bitget, GateIO and Hyperliquid

⚠️ Used at one's own risk ⚠️

v7.0.6

Overview

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 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 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.

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:

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:

python3 -m venv venv

Activate the virtual environment:

source venv/bin/activate

Step 4: Install Python Dependencies

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

pip install -r requirements.txt

Step 5: Build Rust Extensions

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

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:

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:

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:

python3 -m jupyter lab

Requirements

Pre-optimized configurations

Coming soon...

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

Documentation:

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

Support

Discord

Telegram

Third Party Links, Referrals and Tip Jar

Passivbot Manager Service:
There is a paid manager service to run Passivbot on the user's behalf:
www.passivbotmanager.com

Referrals:
Signing up using these referrals is appreciated:
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

BuyMeACoffee:
https://www.buymeacoffee.com/enarjord

Donations:
If the robot is profitable, consider donating as showing gratitude for its development:

  • USDT or USDC Binance Smart Chain BEP20:
    0x4b7b5bf6bea228052b775c052843fde1c63ec530
  • USDT or USDC Arbitrum One:
    0x4b7b5bf6bea228052b775c052843fde1c63ec530

Bitcoin (BTC) via Strike:
[email protected]

License

Released freely without conditions. Anybody may copy, distribute, modify, use or misuse for commercial, non-commercial, educational or non-educational purposes, censor, claim as one's own or otherwise do whatever without permission from anybody.