Skip to content
enarjord edited this page May 3, 2021 · 8 revisions

passivbot v3

Configuration (live config)

Note that the live_settings configuration file is a JSON file, while the backtest_configs configuration file is an HJSON.

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

ddown_factor

reentry_qty = psize * ddown_factor

e.g. if pos size is 0.4 and ddown factor is 0.5, reentry qty is 0.2

qty_pct

initial_entry_qty = max(min_qty, balance_in_terms_of_contracts * leverage * qty_pct * (1 + volatility * volatility_qty_coeff))

leverage

max_pos_size = balance_in_terms_of_contracts * leverage

grid_spacing

reentry_price = pprice * (1 +- grid_spacing * grid_spacing_modifier)

pos_margin_grid_coeff and volatility_grid_coeff

grid_spacing_modifier = (1 + (pos_margin / wallet_balance) * pos_margin_grid_coeff) * (1 + volatility * volatility_grid_coeff)

where volatility = std(last_n_ticks) / ema(last_n_ticks)

where last_n_ticks = ema_span

a tick is defined as a tick whose price is different from previous tick's price

volatility_qty_coeff

used in initial_entry_qty calc, see qty_pct above

min_markup

positions are closed at min markup: `first_close_price = pprice * (1 +- min_markup)

markup_range

if markup_range > 0, splits closing orders into multiple closing orders from min_markup to (min_markup + markup_range)

do_long

if true, allows initial long entries

do_shrt

if true, allows initial short entries

ema_span

span used to calc ema: next_ema = prev_ema * (1 - alpha) + price * alpha

where alpha = 2 / (ema_span + 1)

ema_spread

initial_{long or shrt}_entry_price = min({highest_bid or lowest_ask}, ema * (1 {+ or -} ema_spread))

stop_loss_liq_diff

if diff(liq_price, last_market_price) < stop_loss_liq_diff:
    if hedge mode and available margin:
        create opposite side entry
    else:
        create same side close

stop_loss_pos_pct

stop_loss_qty = psize * stop_loss_pos_pct

Configuration (backtest config)

session_name

arbitrary name

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)

do_long/do_shrt

allow long/short positions

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_liquidation_distance

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

max_n_hours_between_fills

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

start_date/end_date

timeframe to backtest

ranges

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

Clone this wiki locally