Bot Configuration
The primary trading settings for the ByNinja bot are managed in the config_trading file. Here you can define the trading pairs, strategy parameters, and risk management rules.
File path:
byninja-trading-bot/config/config_trading.json1. Trading Pairs & Parameters
Your bot needs to know which markets to conquer. You must specify at least one active trading pair in the TRADING_PAIRS list to begin your automated trading journey.
## List of cryptocurrency trading pairs in format BASEQUOTE (e.g., AVAXUSDT)
## Bot will monitor and trade these pairs according to configured parameters
TRADING_PAIRS = [
"AVAXUSDT",
"LINKUSDT",
"ATOMUSDT"
]Precision is key. For every pair defined in your list, you must provide its specific TRADING_PARAMETERS. This ensures the bot executes highly optimized strategies tailored precisely to each asset's unique volatility and trend behavior.
## Trading parameters per symbol
##
## Dictionary mapping trading pairs to their individual strategy parameters.
## Each pair can have unique settings for position sizing, profit targets, and technical indicators.
TRADING_PARAMETERS = {
"AVAXUSDT": {
## Minimum order quantity (lot size) for this trading pair
"lot_size": 0.5,
## Maximum position size in USDT for a single entry
"position_size": 18.0,
## Take profit target as percentage of entry price (e.g., 2.81%)
"take_profit_percent": 2.81,
## Stop loss level as percentage below entry price (e.g., 1.41%)
"stop_loss_percent": 1.41,
## Price movement percentage to activate trailing stop (e.g., 1.3% profit triggers trail)
"trail_activation_percent": 1.3,
## Trailing stop distance from highest price as percentage (e.g., 0.8%)
"trail_distance_percent": 0.8,
## Tight trailing stop distance when price approaches resistance
"trail_tight_distance_percent": 0.5,
## Minimum 3-minute EMA200 slope to consider market trending downward (filter condition)
"min_ema200_3m_slope": -0.008,
## Minimum 1-minute EMA20 slope for entry signal (upward trend)
"min_ema20_1m_slope": 0.01,
## Minimum 1-minute EMA50 slope to confirm uptrend
"min_ema50_1m_slope": 0.005,
## Volume spike coefficient - requires volume exceeding average × coefficient
"volume_spike_coeff": 1.2,
## Maximum candle size as percentage - filters out overly large candles
"max_candle_size": 0.8,
## Minimum distance between EMA50 and EMA200 (percentage) for trend confirmation
"min_ema50_ema200_distance": 0.06,
## Minimum distance between EMA20 and EMA50 (percentage) for entry confirmation
"min_ema20_ema50_distance": 0.10,
},
...
}2. Risk Management & Capital
Before setting risk rules, you define the INITIAL_CAPITAL. This is the exact amount of funds the bot is authorized to operate with on your account, ensuring it strictly stays within your allocated budget.
## Initial trading capital in USDT for the bot
INITIAL_CAPITAL = 1000.0Capital preservation is our highest priority. The RISK_PARAMETERS structure is your ultimate safety net. Crucially, it manages the emergency stop mechanisms, instantly halting the bot during unforeseen market anomalies to protect against unexpected accidental losses.
## Risk management parameters
##
## Portfolio-level and symbol-level risk limits to protect capital and prevent excessive losses.
RISK_PARAMETERS = {
## Maximum percentage of capital that can be exposed across all open positions (e.g., 90%)
"max_portfolio_exposure": 90.0,
## Maximum number of consecutive losing trades before trading pauses for the symbol
"max_consecutive_losses": 10,
## Maximum daily loss percentage per individual symbol before halting trades on that pair
"max_daily_drawdown_per_symbol": 3.0,
## Maximum total loss percentage per symbol across all time (cumulative drawdown limit)
"max_total_drawdown_per_symbol": 6.0,
## Maximum daily portfolio loss percentage before pausing all trading
"max_daily_drawdown": 5.0,
## Maximum total portfolio loss percentage across all trading sessions (cumulative limit)
"max_total_drawdown": 10.0
}Pro Tip: Use a Code Editor
For a much better experience editing configuration files, we recommend using a professional code editor like Visual Studio Code.
Download VS Code ↗