Configuration
Configure Kronos for your exchange, assets, and trading parameters.
Configuration Structure
Kronos uses two types of configuration:
- Project-level config (
config.yamlin project root) - Exchanges, logging, risk settings - 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: "kronos.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" # How often GetSignals() is called
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
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 minute5m- Every 5 minutes15m- Every 15 minutes30m- Every 30 minutes1h- Every hour (default)4h- Every 4 hours1d- 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: "kronos.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:
kronos live --config config.prod.yaml
Next Steps
- Writing Strategies - Build your strategy
- Examples - See complete implementations
- Installation - Deploy to production