Skip to main content

Configuration

Configure wisp for your exchanges, assets, and trading parameters. Configuration drives the startup sequence and strategy initialization.

How Configuration Drives Startup

When wisp starts, the configuration orchestrates initialization:

  1. Exchange configuration → Wisp initializes connectors and market data feeds
  2. Strategy configuration → Parameters are loaded, strategy is created
  3. Indicator configuration → Data sources and timeframes are set up
  4. Strategy.Start(ctx) → The strategy launches its execution goroutine
  5. Event loop → Strategy's run() method begins analyzing markets and emitting signals

Configuration controls:

  • Which exchanges to connect to
  • Which assets to monitor
  • How often the strategy analyzes markets (interval)
  • Default position sizes and risk limits
  • Logging verbosity

Configuration Structure

wisp uses two types of configuration:

  1. Project-level config (config.yaml in project root) - Exchanges, logging, risk settings
  2. Strategy-specific config (strategies/{name}/config.yaml) - Strategy settings, backtest parameters

Project Config (config.yaml)

# Exchange configuration
exchanges:
binance:
api_key: "your-api-key"
api_secret: "your-api-secret"
testnet: false

bybit:
api_key: "your-api-key"
api_secret: "your-api-secret"
testnet: false

hyperliquid:
api_key: "your-api-key"
api_secret: "your-api-secret"
testnet: false

# Logging
logging:
level: "info" # debug, info, warn, error
file: "wisp.log"

# Risk management
risk:
max_position_size: 0.2
max_total_exposure: 0.8

Strategy Config (strategies/my-strategy/config.yaml)

# Strategy configuration
strategy:
name: "my-strategy"
interval: "1h" # Strategy's run loop tick interval
default_exchange: binance
assets:
- "BTC"
- "ETH"
- "SOL"

# Backtesting configuration
backtest:
start_date: "2024-01-01"
end_date: "2024-12-31"
initial_capital: 10000
commission: 0.001 # 0.1% per trade

The interval setting is critical: it controls how often your strategy's run() loop evaluates market conditions. When Start(ctx) launches the goroutine, it respects this interval via an internal ticker.

Never commit API keys

Never commit config files with API keys to version control. Keep sensitive configuration files secure and separate from your codebase.

Exchange Configuration

Binance

exchanges:
binance:
api_key: "your-api-key"
api_secret: "your-api-secret"
testnet: false # Use Binance Testnet
futures: true # Trade futures (default: spot)
margin: false # Enable margin trading

Bybit

exchanges:
bybit:
api_key: "your-api-key"
api_secret: "your-api-secret"
testnet: false
futures: true
margin: false

Hyperliquid

exchanges:
hyperliquid:
api_key: "your-api-key"
api_secret: "your-api-secret"
testnet: false

Strategy Configuration

Strategy configuration lives in strategies/{name}/config.yaml.

Basic Settings

strategy:
name: "my-strategy"
interval: "1h" # 1m, 5m, 15m, 1h, 4h, 1d
default_exchange: binance
assets:
- "BTC"
- "ETH"

Interval Options

How often GetSignals() is called:

  • 1m - Every minute
  • 5m - Every 5 minutes
  • 15m - Every 15 minutes
  • 30m - Every 30 minutes
  • 1h - Every hour (default)
  • 4h - Every 4 hours
  • 1d - Every day

Multiple Exchanges

Trade on multiple exchanges:

strategy:
default_exchange: binance
exchanges:
- binance
- bybit
- hyperliquid

In your strategy:

// Uses default exchange
price := s.k.Market().Price(btc)

// Specify exchange
price := s.k.Market().Price(btc, market.MarketOptions{
Exchange: connector.Bybit,
})

// Get all prices
prices := s.k.Market().Prices(btc)

Logging Configuration

Log Level

logging:
level: "info" # debug, info, warn, error
file: "wisp.log"
console: true # Also log to console

Risk Management

Position Limits

risk:
max_position_size: 0.2 # Max 20% of capital per position
max_total_exposure: 0.8 # Max 80% of capital deployed
max_leverage: 3 # Max 3x leverage

Stop Loss

risk:
default_stop_loss: 0.02 # Default 2% stop loss
default_take_profit: 0.05 # Default 5% take profit
trailing_stop: true
trailing_stop_distance: 0.015 # 1.5%

Example Production Config

exchanges:
binance:
api_key: "your-api-key"
api_secret: "your-api-secret"
testnet: false
futures: true

strategy:
name: "production-strategy"
interval: "1h"
default_exchange: binance
assets:
- "BTC"
- "ETH"

risk:
max_position_size: 0.15
max_total_exposure: 0.6
default_stop_loss: 0.02
default_take_profit: 0.05
trailing_stop: true

logging:
level: "info"
file: "logs/production.log"

Multiple Environments

Create different project-level configs for different environments:

config.yaml           # Default project config
config.dev.yaml # Development
config.staging.yaml # Staging
config.prod.yaml # Production

Each strategy keeps its own config in strategies/{name}/config.yaml.

Use with:

wisp live --config config.prod.yaml

Next Steps