-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.yaml
More file actions
178 lines (162 loc) · 5.6 KB
/
config.yaml
File metadata and controls
178 lines (162 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# General Configuration
universe:
source: ./universe/sp500.csv
auto_update: true
min_market_cap: 1000000000 # $1B
state_recovery:
# Safety default: do not auto-seed positions unless explicitly enabled.
enabled: false
seed_file: ./state/positions_seed.json
allow_core_seed: false
allow_ai_seed: false
purge_seeded_open_positions: true
output:
results_dir: "./results"
log_trades: true
daily_summary: true
schedule: # Please specify a valid schedule value here, e.g., "daily", "weekly", or a cron string.
# The value '1000000000 # $1B' from the instruction seems to be a misplaced value from 'universe.min_market_cap'.
data:
sources:
# prices:
# - stooq: free, no API key (slower for large universes)
# - twelvedata: supports rotating multiple free-tier keys via TWELVEDATA_API_KEYS
# - auto: use twelvedata if keys are present, otherwise fallback to stooq
prices: "auto"
news: "gdelt"
cache_path: "./data/trading_bot.db"
providers:
twelvedata:
base_url: "https://api.twelvedata.com"
api_key_env: "TWELVEDATA_API_KEYS"
# Optional repo-stored fallback keys (comma strings or list items).
# Use only for temporary verification; prefer env/secrets in production.
api_keys:
- "021e027d064b41cd872b79bad752b3b6"
- "ed2f87b77cce4d84901d4feeb5ff7136"
- "55f7cd89c9ee431da4429cc7e20db498"
- "41b31951f98b44e4b72a7a7795be338c"
- "e01dcfce3386428eafa524f9c7449f8f"
- "555564717f6d45888c13220c0e0070d8"
- "238dfc1df34e4150b580057a5ed8c2c9"
- "6bb7c6e672a24353bd63ca8223d0390f"
- "ef4e515d53ad4f8c9379fcacba77ce65"
- "224d71185cd7456996fe97cd05ef2836"
# Only pull a limited window to reduce storage.
# ~1200 daily bars ~= ~4.5 years trading days. Stays within 50-90MB for S&P 500.
outputsize: 1200
timeout_seconds: 20
# Conservative throughput for free-tier limits (computed dynamically if possible).
assumed_requests_per_minute_per_key: 5
alphavantage:
base_url: "https://www.alphavantage.co"
api_key_env: "ALPHAVANTAGE_API_KEYS"
api_keys: []
# Alpha Vantage free tier is slow; only used as fallback for symbols TwelveData blocks.
outputsize: "full"
timeout_seconds: 25
storage:
# Keep only a rolling window in SQLite to minimize disk usage.
prices_retention_days: 1200
news_retention_days: 45
# Stop writing per-symbol feature CSVs (feature_store is the biggest disk user).
store_feature_files: false
# Clean up old models and shrink DB periodically.
prune_models_keep_latest_only: true
vacuum_sqlite: true
vacuum_frequency_days: 7
# Keep at most N archived DBs (trading_bot_archive_*.db) in ./data
keep_db_archives: 0
news:
enabled: true
llm:
enabled: false
provider: "local_news_sentiment"
timeout_seconds: 20
max_retries: 2
backoff_seconds: 1.0
temperature: 0.1
top_p: 0.9
max_tokens: 4096
news_sentiment:
enabled: true
local_fallback_enabled: true
batch_size: 8
max_articles_per_symbol: 30
min_confidence: 0.15
confidence_weighted: false
signals:
enabled: true
top_n: 15
buy_threshold: 0.55
lookback_days: 120
momentum_lookback: 20
mean_reversion_window: 20
expected_holding_period: "1d"
ml:
retrain_frequency: "weekly"
target_horizon: 1 # 1-day forward return
test_size: 0.2
model_type: "xgboost"
meta_learning:
cooldown_days_after_exit: 5
cooldown_penalty: 0.0
# How far back to look when computing per-symbol win rates/penalties.
lookback_days: 30
min_trades_for_penalty: 3
win_rate_threshold: 0.40
ai_trading:
enabled: true
initial_capital: 100000
max_positions: 10
allow_shorts: true
max_shorts: 5
# Prevent Core + AI from holding the same symbols (keeps the strategies clearly distinct).
disallow_core_overlap: true
# AI selection uses raw prices plus deterministic feature snapshots as model inputs.
price_lookback_days: 30
feature_lookback_days: 80
news_window_days: 7
prompt_candidates_limit: 1000
# Keep idle cash low without hard-clipping exact cash usage.
min_total_weight: 0.96
# When the model labels a symbol as neutral, allow a directional tie-break
# if class probabilities still show a close directional edge.
neutral_breakout_enabled: true
neutral_breakout_min_prob: 0.22
neutral_breakout_max_gap: 0.10
decision_engine: "trained_model"
trained_model:
backend: "http"
inference_url: ""
inference_url_env: "TRAINED_MODEL_INFERENCE_URL"
api_key_env: "TRAINED_MODEL_API_KEY"
# The endpoint is expected to be a remote CPU inference service (for example Lightning AI).
timeout_seconds: 1200
batch_size: 8
max_retries: 0
backoff_seconds: 2
model_name: "quant-trained-trading-model"
trading:
order_types_allowed: ["limit", "market"]
max_positions: 10
equal_weight: false
enable_shorts: true
max_shorts: 5
# Skip token-sized orders; effective minimum is max(min_order_dollars, current_equity * min_order_equity_pct).
min_order_dollars: 500
min_order_equity_pct: 0.005
# adjusted_score <= short_threshold becomes a short candidate (more negative = stronger short)
short_threshold: -0.002
take_profit_pct: 0.03
stop_loss_pct: null # Bot-determined risk
# Force at least 95% of available capital to be deployed (prevents excessive cash drag)
min_total_weight: 0.95
# Soft cap on idle cash. If cash exceeds this fraction, the bot relaxes signal filters.
max_cash_pct: 0.20
risk:
max_position_equity_pct: 0.10
max_gross_exposure: 1.0
max_daily_loss_pct: 0.02
monitoring:
notifications: ["console", "email"] # email requires extra config in .env