rrobles9112 / passivbot

trading bot running on binance and bybit futures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

passivbot

passivbot Version GitHub issues

Trading bot running on Bybit and Binance Futures using hedge mode when possible

⚠️ Use at own risk ⚠️

Overview

The bot's purpose is to accumulate tokens over time

It is a market maker bot working in futures markets, making multiple post only limit orders above and below current price

It listens to websocket live stream of trades, and updates its orders continuously

If there is a long position, it creates reentry bids below pos price, and reduce-only asks above pos price:

reentry_bid_price = pos_price * (1 - grid_spacing * (1 + (position_margin / wallet_balance) * grid_coefficient))

If there is a short position, it creates reentry asks above pos price, and reduce-only closing bids below pos price:

reentry_ask_price = pos_price * (1 + grid_spacing * (1 + (position_margin / wallet_balance) * grid_coefficient))

In hedge mode, stop loss works like this:

if diff(liq_price, last_price) < stop_loss_liq_diff:
    if available margin:
        enter opposite side
    else:
        close same side at a loss

In both cases liq price will be pushed away

Requirements

Setup dependencies

    pip install -r requirements.txt

Usage:

Supports exchanges Bybit futures and Binance futures, using hedge mode when supported

  1. Add your api key and secret in file api-keys.json
  2. python3 start_bot.py {account_name} {symbol} {path/to/config.json}

Example:

python3 start_bot.py binance_01 XMRUSDT live_configs/binance_default.json

Run with docker

Modify command with exchange and user_name in docker-compose.yml and start with docker-compose up -d (-d for background run). All code and files generated are in original git folder.

Stopping bot

For graceful stopping of the bot, set do_longand do_shrt both to false, and bot will continue as normal, opening no new positions, until all existing positions are closed.

Documentation [WIP], see the wiki at:

https://github.com/enarjord/passivbot/wiki

Support

Discord

Telegram

Resources

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.

Backtester

A backtester is included

  1. go to backtest_configs/{config_name}.hjson and adjust it
  2. run with python3 backtest.py path_to_config.hjson

Will use numba's just in time compiler by default to speed up backtesting, add argument --nojit to disable numba:

python3 backtest.py backtest_configs/{config_name}.hjson --nojit

See wiki for more info on backtesting

Live settings

Support the project

Feel free to make a donation to show support of the work

  • XMR: 49gUQ1jasDK23tJTMCvP4mQUUwndeLWAwSgdCFn6ovmRKXZAjQnVp2JZ2K4UuDDdYMNam1HE8ELZoWdeJPRfYEa9QSEK6XZ

  • Nano: nano_1nf3knbhapee5ruwg7i8sqekx3zmifdeijr8495t9kgp3uyunik7b9cuyhf5

  • EOS: nbt4rhnhpjan

  • XLM: GDSTC6KQR6BCTA7BH45B3MTSY52EVZ4UZTPZEBAZHJMJHTUQQ5SM57S7

  • USDT TRC20 (Binance): TJr3KYY8Bz7wRU7QLwoYQHk88LcaBJqQN5

Referrals

About

trading bot running on binance and bybit futures

License:Other


Languages

Language:Python 99.9%Language:Dockerfile 0.1%