Configuration Reference
Full Config Field Explanation
The ByNinja Trading Bot uses multiple configuration modules to separate responsibilities between trading execution, exchange connectivity, and Telegram communication.
The configuration system is intentionally lightweight and file-based, allowing easy deployment, quick editing, and predictable startup behavior.
Telegram Configuration
The Telegram configuration module contains all parameters required for Telegram Bot API communication and TCP integration.
TELEGRAM_BOT_TOKEN
TELEGRAM_BOT_TOKEN = "...your_telegram_bot_token..."The Telegram bot token used for authentication with the Telegram Bot API.
This token is generated through BotFather inside Telegram and uniquely identifies the bot instance.
Responsibilities:
- •Authenticates API requests
- •Enables sending notifications
- •Enables receiving user commands
- •Grants access to Telegram bot features
Important:
- •Never expose the token publicly
- •Never commit it into public repositories
- •Treat it as a private credential
TELEGRAM_CHAT_ID
TELEGRAM_CHAT_ID = "...your_private_telegram_chat_id..."The private Telegram chat ID where notifications and trading alerts are delivered.
The bot uses this ID to restrict communication only to the authorized owner.
Responsibilities:
- •Routes alerts and notifications
- •Restricts unauthorized access
- •Enables private command execution
Typical usage:
- •Personal trading notifications
- •Remote bot management
- •Trade execution monitoring
TCP_SERVER_PORT
TCP_SERVER_PORT = 55110Defines the TCP port used for communication between the Telegram server and the trading bot.
Both applications must use the same port value.
Responsibilities:
- •TCP message transport
- •Remote command routing
- •Real-time log forwarding
Important:
- •The port must be available on the system
- •Firewall rules may need adjustment
- •Both processes must share identical configuration
Binance Configuration
The Binance configuration module contains exchange authentication credentials and trading communication settings.
BINANCE_API_KEY
BINANCE_API_KEY = "...your_binance_api_key..."Public API key generated from the Binance account.
Used to authenticate requests to Binance services.
Responsibilities:
- •Market data access
- •Order placement permissions
- •Account information access
Security recommendations:
- •Enable IP restrictions if possible
- •Use trading-only permissions
- •Avoid enabling withdrawal permissions
BINANCE_API_SECRET
BINANCE_API_SECRET = "...your_binance_api_secret..."Private API secret paired with the Binance API key.
Used for request signing and authentication verification.
Important:
- •Must remain strictly private
- •Never expose publicly
- •Never send through logs or screenshots
TCP_SERVER_PORT
TCP_SERVER_PORT = 55110Defines the TCP communication port used by the trading bot TCP client.
This value must match the Telegram server configuration.
Trading Configuration
The trading configuration module defines capital allocation, trading pairs, strategy behavior, and portfolio risk management.
INITIAL_CAPITAL
INITIAL_CAPITAL = 1000.0Defines the virtual or tracked starting capital for the trading system.
Used for:
- •Performance calculations
- •Drawdown calculations
- •Portfolio exposure tracking
- •Risk management statistics
The value is expressed in USDT.
TRADING_PAIRS
TRADING_PAIRS = [
"AVAXUSDT",
"LINKUSDT",
"DOTUSDT",
"XRPUSDT",
"ATOMUSDT"
]List of cryptocurrency symbols monitored and traded by the system.
Each symbol must also exist inside the TRADING_PARAMETERS dictionary.
Responsibilities:
- •Defines active trading markets
- •Controls symbol subscriptions
- •Enables per-symbol strategy execution
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 ↗Trading Parameters Reference
Each trading pair contains an independent strategy configuration profile.
This design allows every market to use custom volatility, trend, and risk parameters.
lot_size
"lot_size": 0.5Minimum order quantity for the trading pair.
The value must comply with Binance exchange lot size requirements.
Purpose:
- •Prevents invalid order sizes
- •Ensures exchange compatibility
- •Controls minimum trade precision
position_size
"position_size": 18.0Maximum capital allocation in USDT for a single trade entry.
Purpose:
- •Controls position exposure
- •Limits risk per trade
- •Prevents over-allocation
Higher values increase:
- •Potential profit
- •Potential loss
- •Portfolio exposure
take_profit_percent
"take_profit_percent": 2.81Target profit percentage relative to the entry price.
When the market reaches this level, the bot closes the position in profit.
Purpose:
- •Locks in gains
- •Defines reward target
- •Standardizes exits
Example:
- •Entry at 100 USDT
- •Take profit at 2.81%
- •Exit target = 102.81 USDT
stop_loss_percent
"stop_loss_percent": 1.41Maximum allowed loss percentage below the entry price.
The position is automatically closed if the market moves against the trade.
Purpose:
- •Limits downside risk
- •Protects trading capital
- •Prevents large drawdowns
Example:
- •Entry at 100 USDT
- •Stop loss at 1.41%
- •Exit at 98.59 USDT
trail_activation_percent
"trail_activation_percent": 1.3Profit threshold required before activating the trailing stop system.
Before activation:
- •Standard stop loss is used
After activation:
- •Dynamic trailing protection begins
Purpose:
- •Protects profitable trades
- •Allows profits to run
- •Reduces premature exits
trail_distance_percent
"trail_distance_percent": 0.8Distance between the current market high and the trailing stop level.
Purpose:
- •Protects unrealized profits
- •Allows natural market movement
- •Creates dynamic exits
Smaller values:
- •Tighter protection
- •Faster exits
- •More sensitive behavior
Larger values:
- •More flexibility
- •Longer trade duration
- •Increased pullback tolerance
trail_tight_distance_percent
"trail_tight_distance_percent": 0.5A tighter trailing stop distance used in stronger resistance or reversal conditions.
Purpose:
- •Aggressive profit protection
- •Faster trade exits near resistance
- •Reduced profit giveback
min_ema200_3m_slope
"min_ema200_3m_slope": -0.008Minimum allowed slope of the 3-minute EMA200 indicator.
Used as a higher timeframe trend filter.
Purpose:
- •Avoids trading during strong downtrends
- •Filters weak market structure
- •Improves trend alignment
min_ema20_1m_slope
"min_ema20_1m_slope": 0.01Minimum slope required for the 1-minute EMA20 indicator.
Used for short-term momentum confirmation.
Purpose:
- •Detects upward acceleration
- •Confirms bullish momentum
- •Filters flat market conditions
min_ema50_1m_slope
"min_ema50_1m_slope": 0.005Minimum slope required for the 1-minute EMA50 indicator.
Acts as additional trend confirmation.
Purpose:
- •Confirms medium-term direction
- •Reduces false signals
- •Improves entry quality
volume_spike_coeff
"volume_spike_coeff": 1.2Required volume multiplier relative to average volume.
The bot only enters trades if current volume exceeds the configured threshold.
Purpose:
- •Detects strong market participation
- •Avoids low-liquidity entries
- •Confirms breakout strength
Example:
- •Average volume = 1000
- •Coefficient = 1.2
- •Required volume = 1200+
max_candle_size
"max_candle_size": 0.8Maximum allowed candle size percentage before blocking entry.
Purpose:
- •Avoids entering after oversized candles
- •Prevents chasing overextended moves
- •Reduces FOMO entries
min_ema50_ema200_distance
"min_ema50_ema200_distance": 0.06Minimum percentage distance required between EMA50 and EMA200.
Purpose:
- •Confirms market trend separation
- •Filters weak trends
- •Validates trend structure
Higher distance values generally indicate stronger trends.
min_ema20_ema50_distance
"min_ema20_ema50_distance": 0.10Minimum distance required between EMA20 and EMA50 indicators.
Purpose:
- •Confirms short-term momentum strength
- •Filters weak entries
- •Improves signal quality
Risk Parameters Reference
The risk management system protects both individual symbols and the entire portfolio.
max_portfolio_exposure
"max_portfolio_exposure": 90.0Maximum percentage of portfolio capital that can be simultaneously allocated to open positions.
Purpose:
- •Prevents overexposure
- •Maintains reserve liquidity
- •Reduces systemic risk
max_consecutive_losses
"max_consecutive_losses": 10Maximum number of consecutive losing trades allowed before trading pauses for the symbol.
Purpose:
- •Detects unstable market conditions
- •Prevents emotional overtrading logic
- •Limits strategy degradation periods
max_daily_drawdown_per_symbol
"max_daily_drawdown_per_symbol": 3.0Maximum daily loss percentage allowed for an individual trading pair.
If exceeded:
- •Trading for the symbol is temporarily halted
Purpose:
- •Limits symbol-specific damage
- •Prevents repeated losses in unstable markets
max_total_drawdown_per_symbol
"max_total_drawdown_per_symbol": 6.0Maximum cumulative loss percentage allowed for a trading pair across all sessions.
Purpose:
- •Detects consistently underperforming symbols
- •Prevents long-term capital erosion
max_daily_drawdown
"max_daily_drawdown": 5.0Maximum allowed daily portfolio loss percentage.
If exceeded:
- •All trading activity pauses
Purpose:
- •Protects the portfolio during extreme market conditions
- •Limits catastrophic daily losses
max_total_drawdown
"max_total_drawdown": 10.0Maximum cumulative portfolio drawdown across the entire trading lifecycle.
Purpose:
- •Acts as a final capital protection mechanism
- •Prevents complete strategy failure
- •Enforces long-term risk discipline
Once reached:
- •Trading operations should remain disabled until manual review is performed.