What is application.yaml in MagicTradeBot?

What is application.yaml?

application.yaml is the primary configuration file that controls how MagicTradeBot starts, connects to exchanges, identifies itself, and operates at a system level.

Think of it as the boot configuration of MagicTradeBot — before any strategy, market watch, or decision engine logic runs, the bot reads this file to understand:

  • Which exchange to connect to
  • How to authenticate securely
  • Whether it should run in demo or live mode
  • Which license to use
  • Basic runtime behavior (debugging, naming, environment)

Without a valid application.yaml, MagicTradeBot cannot initialize or operate correctly.


What Does application.yaml Control?

The application.yaml file is responsible for global, non-strategy settings, including:

  • Exchange selection and compatibility rules
  • API authentication (or environment variable mapping)
  • License validation
  • Bot identity and runtime flags
  • Security and deployment behavior

It Does NOT Define:

  • Trading strategies
  • Stop-loss / take-profit rules
  • Market Watch logic
  • DCA or Brain decision rules

Those are handled in separate, feature-specific configuration files, keeping responsibilities clean and modular.


Key Sections Explained

1. Exchange Configuration

This section tells MagicTradeBot which exchange to connect to and how.

Key Responsibilities:

  • Selects the exchange (binance, bybit, okx, bitget, hyperliquid)
  • Enforces exchange-specific position mode compatibility
  • Loads API credentials securely

MagicTradeBot performs strict validation here to prevent:

  • Incorrect position modes (e.g., Hedge vs One-Way)
  • Failed order execution
  • Incorrect PnL calculations
  • Risk management mismatches

If an unsupported exchange is configured, the bot will refuse to operate.


2. API Credentials & Security

application.yaml supports two secure methods for credentials:

Option A: Direct YAML (Recommended only for demo/testing)

APIKEY: ""
APISECRET: ""
Passphrase: ""

Option B: Environment Variables (Recommended for production)

Environment variables automatically override YAML values.

This design:

  • Prevents accidental key exposure
  • Works seamlessly with Docker, VPS, and cloud deployments
  • Aligns with enterprise security best practices

MagicTradeBot never requires withdrawal permissions and explicitly warns against them.


3. Position Mode Compatibility (Critical)

Different exchanges support different position modes, and MagicTradeBot enforces this at startup.

Examples:

  • Bybit → One-Way Mode only
  • Binance / OKX / Bitget → Hedge Mode required

If your exchange account is misconfigured:

  • Orders may be rejected
  • TP/SL may fail
  • Positions may close incorrectly

This validation exists to protect capital and ensure deterministic behavior.


4. License Configuration

The License section activates your MagicTradeBot installation.

License:
  Key: ""

The license:

  • Unlocks features based on your plan
  • Controls instance authorization
  • Is validated during startup

Without a valid license key, the bot will not enter operational mode.


5. General Application Settings

This section controls how the bot behaves at runtime — not how it trades.

Key Options:

  • BotName – Helps identify this instance in logs, dashboards, and alerts
  • DemoMode – Enables simulated trading without real funds
  • DebugMode – Enables verbose logging for diagnostics

These settings are especially useful when running:

  • Multiple bot instances
  • Staging vs production environments
  • Debug or support investigations

Demo Mode vs Live Mode

One of the most important flags in application.yaml is:

DemoMode: true
  • DemoMode = true → No real orders are placed
  • DemoMode = false → Live trading is enabled

This allows users to:

  • Test configurations safely
  • Validate strategies before risking capital
  • Run the bot in simulation on real market data

Why MagicTradeBot Uses application.yaml

MagicTradeBot uses application.yaml because it provides:

  • Human-readable structure
  • Strong separation of concerns
  • Safe defaults for first-time users
  • Easy automation via environment variables
  • Compatibility with Docker, cloud, and on-prem deployments

Most importantly, it ensures predictable startup behavior, which is essential for an automated trading system.


Best Practices

  • ✔ Use environment variables for API keys in production
  • ✔ Keep DemoMode enabled during testing
  • ✔ Double-check exchange position mode before going live
  • ✔ Never enable withdrawal permissions on API keys
  • ✔ Treat application.yaml as infrastructure config, not strategy config

Summary

application.yaml is the foundation of MagicTradeBot’s runtime environment.

It defines:

  • Where the bot connects
  • How it authenticates
  • Whether it trades live or in demo
  • Which license is active
  • How securely it runs

All advanced intelligence — such as Smart SL/TP, Market Watch, DCA, and the MagicTradeBot Brain — is built on top of this file, making it one of the most important components in the entire system.

📎 Related Topics