146 lines
4.0 KiB
YAML
146 lines
4.0 KiB
YAML
# AI Trading Application Configuration
|
|
# This file can be placed at:
|
|
# - ./config.yaml (current directory)
|
|
# - ~/.config/aitrade/config.yaml
|
|
# - /etc/aitrade/config.yaml
|
|
# Or specify with: CONFIG_FILE=/path/to/config.yaml ./aitrade
|
|
|
|
# Interactive Brokers Gateway
|
|
ib_gateway:
|
|
host: 127.0.0.1
|
|
port: 4002 # 4002 for paper trading, 4001 for live
|
|
client_id: 777 # Use unique client ID (avoid 1, which may be used by other sessions)
|
|
market_data_type: 3 # 1=Live, 2=Frozen, 3=Delayed(15min), 4=Delayed-Frozen
|
|
|
|
# Trading Configuration
|
|
trading:
|
|
# Strategy: defensive, normal, aggressive
|
|
strategy: normal
|
|
|
|
# Stop Loss
|
|
stop_loss_enabled: true
|
|
stop_loss_percent: 3.0
|
|
|
|
# Rate Limiting
|
|
max_trades_per_hour: 6
|
|
max_parallel_trades: 5
|
|
pending_time: 300s # Seconds or Go duration (300, "5m", "1h30m")
|
|
|
|
# Dry Run Mode (Paper Trading)
|
|
dry_run: false # Using IB Paper Trading account instead
|
|
dry_run_balance: 100000.0
|
|
|
|
# Auto Trading
|
|
trading_enabled: true
|
|
trading_interval: 60 # Seconds or Go duration (60, "1m", "5m")
|
|
watch_symbols:
|
|
- AAPL
|
|
- MSFT
|
|
- GOOGL
|
|
- TSLA
|
|
- AMZN
|
|
|
|
# SELL Triggers
|
|
take_profit_percent: 5.0
|
|
hold_time_minutes: 30
|
|
sell_on_negative_sentiment: true
|
|
|
|
# Trade Limits
|
|
max_trade_value: 2000.0 # 0 = unlimited
|
|
|
|
# Database
|
|
database:
|
|
path: ./data/aitrade.db
|
|
|
|
# Web Server
|
|
web:
|
|
host: 0.0.0.0
|
|
port: "8080"
|
|
|
|
# OpenID Connect (Optional)
|
|
oidc:
|
|
enabled: false
|
|
issuer: https://auth.example.com
|
|
client_id: aitrade
|
|
client_secret: your-secret-here
|
|
redirect_url: http://localhost:8080/callback
|
|
scopes:
|
|
- openid
|
|
- profile
|
|
- email
|
|
|
|
# News Aggregation
|
|
news:
|
|
poll_interval: 300s # Seconds or Go duration (300s = 5 minutes)
|
|
|
|
# Default rate limits for all sources (can be overridden per source)
|
|
default_rate_limit:
|
|
max_per_hour: 100 # Poll every 5min = 12/hour, 100 gives plenty of buffer
|
|
max_per_day: 1000
|
|
|
|
# News Feed Sources
|
|
sources:
|
|
- name: "CNBC Top News"
|
|
url: "https://www.cnbc.com/id/100003114/device/rss/rss.html"
|
|
type: rss
|
|
enabled: true
|
|
|
|
- name: "MarketWatch"
|
|
url: "https://feeds.marketwatch.com/marketwatch/realtimeheadlines"
|
|
type: rss
|
|
enabled: true
|
|
|
|
- name: "Alpha Vantage News"
|
|
url: "https://www.alphavantage.co/query?function=NEWS_SENTIMENT&apikey=R8JA9C1DIEKM4SZM"
|
|
type: alphavantage
|
|
enabled: true
|
|
rate_limit:
|
|
max_per_hour: 5 # API key limit: 500/day
|
|
max_per_day: 500
|
|
|
|
- name: "Finnhub News"
|
|
url: "https://finnhub.io/api/v1/news?category=general&token=ca9mjbiad3ibg816q5b0"
|
|
type: finnhub
|
|
enabled: true
|
|
rate_limit:
|
|
max_per_hour: 60 # API key limit: 60/minute
|
|
max_per_day: 0
|
|
|
|
# Example: Feed with Basic Auth and Rate Limiting
|
|
# - name: "Reuters Business"
|
|
# url: "https://www.reuters.com/business/finance/rss"
|
|
# type: rss
|
|
# enabled: false
|
|
# auth:
|
|
# type: basic
|
|
# username: "your-username"
|
|
# password: "your-password"
|
|
# rate_limit:
|
|
# max_per_hour: 10
|
|
# max_per_day: 100
|
|
|
|
# Example: Feed with custom headers (e.g., API key)
|
|
# - name: "Custom Feed"
|
|
# url: "https://example.com/feed"
|
|
# type: rss
|
|
# enabled: true
|
|
# headers:
|
|
# Authorization: "Bearer your-token"
|
|
# X-API-Key: "your-api-key"
|
|
# rate_limit:
|
|
# max_per_hour: 0 # Unlimited per hour
|
|
# max_per_day: 1000 # But limited to 1000/day
|
|
|
|
# LLM Sentiment Scorer (Optional - requires Ollama)
|
|
llm_scorer:
|
|
enabled: true # Set to true to enable LLM-based sentiment
|
|
endpoint: http://192.168.40.133:11434
|
|
model_name: mistral # "mistral", "llama2", "llama2:70b"
|
|
timeout: 120s # Seconds or Go duration (increased for CPU-only inference)
|
|
temperature: 0.3 # 0.0-1.0, lower = more deterministic
|
|
max_retries: 2
|
|
ensemble_weight: 0.7 # 0.0-1.0 (1.0 = LLM only, 0.7 = 70% LLM + 30% keyword)
|
|
|
|
# Logging
|
|
log_level: debug # debug, info, warn, error
|