Skip to content
enarjord edited this page Jun 22, 2021 · 8 revisions

passivbot v3

Configuration (live config)

Included live configs are found in configs/live/name.json

config_name

arbitrary name given to config

logging_level

set to 0, no logging. set to 1, logs positions, open orders, order creations, order cancellations to logs/{exchange}/{config_name}.log

min_span/max_span/n_spans

Bot uses exponential moving averages EMAs to limit entries and stop losses.

EMAs are not based on OHLCVs, but on raw trades, or "ticks"

EMA is defined as

ema = prev_ema * (1 - alpha) + tick_price * alpha

where

alpha = 2 / (span + 1)

Fastest EMA is given by min_span, slowest EMA is given by max_span, and n_spans gives how many EMAs.

long/shrt

Config parameters for long and short are separated.

enabled

Set to false to disable long/shrt

all MAr_coeffs

Selected parameters may be modified by ratios between EMAs of different spans.

More details may come later.

iqty_const

Initial quantity percentage of balance.

Initial entry quantity is defined as balance_ito_contracts * iqty_const

E.g. if balance is $200 and iqty_const = 0.03, cost of initial entry will be at least 200 * 0.03 == $6

iprc_const

An upper and a lower band of EMAs are made by taking min(EMAs) and max(EMAs), respectively.

Initial long entry price is lower_EMA_band * iprc_const and initial shrt entry price is upper_EMA_band * iprc_const

For example, if EMAs = [33.4, 32.1, 32.9], upper band is 33.4 and lower band is 32.1.

If shrt_iprc_const = 1.005, shrt_entry_price = 33.4 * 1.005 == 33.567

rqty_const

Reentry quantity is initial entry quantity plus position size times rqty_const

rprc_const

Long reentry price is min(initial_long_entry_price, long_position_price * long_rprc_const)

Short reentry price is max(initial_shrt_entry_price, shrt_position_price * shrt_rprc_const)

markup_const

Bot closes entire position at static position_price * markup_const

pbr_limit

pbr is position_cost / balance, where position_cost is position_size / position_price if inverse, otherwise position_size * position_price

A position's cost may not be greater than pbr_limit + pbr_stop_loss.

pbr_stop_loss

Specifies how much a position's cost may overstep its pbr_limit.

Bot will partially close position at a loss if position_cost / balance is greater than pbr_limit.

Configuration (configs/backtest/default.hjson)

exchange

binance or bybit

user

set your account name here, needed to fetch ticks

symbol

symbol to backtest. note differences between USDT margined symbols (ends with USDT) and inverse symbols (ends with USD). also note difference between binance inverse perpetual and inverse futures (e.g. ETHUSD_PERP or ETHUSD_210625)

latency_simulation_ms

simulate latency between bot and exchange

starting_balance

starting balance in margin token (USDT in linear markets, coin in inverse markets)

start_date/end_date

timeframe to backtest

Configuration (configs/optimize/default.hjson)

pso options

particle swarm optimization options

iters: n backtests

num_cpus: max n cpus for parallel testing

options: c1, c2, w. pso specific options, see for example https://pymoo.org/algorithms/pso.html for more info

n_particles: n particles, see above link for more info

minimum_bankruptcy_distance

optimizer will penalize configs whose bankruptcy in backtests came closer than given threshold

minimum_equity_balance_ratio

optimizer will penalize configs whose equity / balance ratio in backtests came closer than given threshold

minimum_slice_adg

more info may be added

max_n_hours_between_fills

optimizer will penalize configs whose max duration between consecutive fills in backtest was higher than given threshold

ranges

search space for each tunable parameter. if min and max are equal, parameter is fixed and not tuned.

Clone this wiki locally