You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements `specs/v3.md` phases 1–6. Users can now define a complete trading strategy in a single YAML file without writing Python. Test suite: **305 → 344** passing.
-`src/strategies/loader.py` — `load_strategy(path)`: loads YAML, validates schema, and checks all prompt files exist on disk; prompt paths are resolved relative to project root
10
+
-`src/strategies/context.py` — `render_context_block(ctx)`: renders the full `MarketContext` as a structured text block (PRICE / INDICATORS / NEWS / SENTIMENT / ON-CHAIN / MACRO / PORTFOLIO sections); single shared input for all agents in a generic run
11
+
-`src/strategies/runner.py` — `run_strategy_council(ctx, config, client)`: config-driven generic runner; runs all agents in parallel; short-circuits to HOLD on veto; calls `compute_generic_score`; optionally runs deliberation; computes SL/TP via `compute_sl_tp`; returns `GenericCouncilResult`
12
+
-`src/strategies/scoring.py` — `compute_generic_score(outputs, config)`: config-driven confidence-weighted signed-score; weights normalised at call time; confidence_floor and trade_threshold sourced from `ScoringConfig`; `score_to_position_size_pct(score, config)` scales size from |score|
-`strategies/default.yaml` — current v2 council expressed as a strategy file (technical 0.40 / sentiment 0.25 / fundamental 0.35 / risk veto; deliberation enabled; scoring thresholds and validation thresholds matching current hardcoded constants)
15
+
-`strategies/example.yaml` — fully-commented example strategy (`momentum` + `macro` + `risk_guard` veto); shows every config option
16
+
-`prompts/deliberation_generic_v1.txt` — built-in deliberation prompt for generic runs; requests a 2–4 sentence narrative synthesis
17
+
-`prompts/agent_template.txt` — starting-point prompt for directional agents with annotated output schema and confidence calibration guide
18
+
-`prompts/veto_agent_template.txt` — starting-point prompt for veto agents with `VetoAgentOutput` schema guidance
19
+
-`prompts/risk_manager_veto_v1.txt` — purpose-built veto prompt for `default.yaml`'s risk agent (cleaner than repurposing `risk_manager_v2.txt`)
-`tests/test_strategy_scoring.py` (16 tests) — all directions, confidence floor exclusion, threshold gating, weighted score formula, SL/TP for all three rule types
-`src/validation.py` — `check_drawdown_halt` and `check_volatility_halt` now accept `max_drawdown_pct` and `atr_spike_multiplier` params (backward-compatible defaults match previous constants); `validate_context` accepts both params and passes them through
28
+
-`src/data/assembler.py` — `assemble_context` accepts `max_drawdown_pct` and `atr_spike_multiplier` params and passes them to `validate_context`
29
+
-`src/main.py` — added `--strategy PATH` CLI argument; when provided, calls `run_strategy_council` instead of legacy `run_council`; validation params derived from strategy config
30
+
-`src/backtest/signals.py` — `generate_signals` accepts `strategy_config` param; routes to generic runner when provided; agent logs written per-agent-name for generic runs
Copy file name to clipboardExpand all lines: README.md
+72-48Lines changed: 72 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,38 @@
1
1
# Council — BTC LLM Trading Bot
2
2
3
-
A Bitcoin swing trading bot that uses a council of specialised LLM agents to generate daily BUY/SELL/HOLD signalsand execute them against Binance testnet (paper) or mainnet (live).
3
+
A Bitcoin swing trading framework built around a **council of LLM agents** that vote on daily BUY/SELL/HOLD signals. Fully configurable — define your own agents, weights, and risk rules in a single YAML file without writing code.
4
4
5
5
## Architecture
6
6
7
7
```
8
-
Data Pipeline (CCXT/Kraken, CryptoPanic, Alternative.me, Glassnode)
The default strategy (`strategies/default.yaml`) reproduces the original v2 council: Technical (40%) + Sentiment (25%) + Fundamental (35%) + Risk veto.
35
+
30
36
## Setup
31
37
32
38
```bash
@@ -35,14 +41,56 @@ pip install -e ".[dev]"
35
41
cp .env.example .env # fill in ANTHROPIC_API_KEY at minimum
36
42
```
37
43
44
+
## Custom Strategies (v3)
45
+
46
+
Define a strategy as a YAML file — no Python required.
-**Phase 1** ✅ Historical news via GDELT DOC 2.0 (`src/data/news_historical.py`) — replaces NEUTRAL_NEWS_STUB with real dated headlines filtered to an allowlist (Reuters / Bloomberg / CoinDesk / WSJ / FT / CoinTelegraph / etc.), 24h publish-lag cutoff, disk-cached under `tmp/cache/gdelt/`
132
-
-**Phase 2** ✅ Historical on-chain via CoinMetrics Community (`src/data/onchain_historical.py`) — replaces NEUTRAL_ONCHAIN_STUB with MVRV (as SOPR proxy), transfer-volume trend (as net-flow proxy), and activity-intensity (as whale proxy)
133
-
-**Phase 2.5** ✅ Decision-logic rework (`src/agents/scoring.py`) — replaces v1's hard 60/70 thresholds with a confidence-weighted signed-score; deliberation LLM writes narrative, Python computes the final signal deterministically; risk-veto still overrides
134
-
-**Phase 3** ✅ Macro context via yfinance (`src/data/macro.py`) — DXY / VIX / SPX / ^TNX bundle with derived risk-on / risk-off / neutral classifier, wired through the fundamental agent
135
-
-**Phase 4** ✅ v2 prompts (`prompts/*_v2.txt`) — directional agents retuned to use the full 0–100 confidence range and be more assertive in clear regimes; deliberation refocused on narrative; v1 prompts kept in-tree for reproducibility
You are a [DESCRIBE YOUR AGENT ROLE] for a Bitcoin swing trading system.
2
+
3
+
[DESCRIBE WHAT YOUR AGENT FOCUSES ON — e.g., technical price action, news sentiment, on-chain activity, macro conditions, or a combination. Be specific about which sections of the market context are most relevant to your analysis.]
4
+
5
+
Your output must be a JSON object with exactly these fields:
6
+
7
+
direction — "BUY", "SELL", or "HOLD"
8
+
BUY = you believe price is likely to rise over the next 1–3 days
9
+
SELL = you believe price is likely to fall, or the position should be closed
10
+
HOLD = insufficient conviction, conflicting signals, or no clear edge
11
+
12
+
confidence — integer 0 to 100
13
+
Calibration guide:
14
+
80–100: very strong signal, clear and aligned evidence
15
+
60–79: solid signal, most evidence points one way
16
+
40–59: moderate signal, some evidence but notable uncertainty
17
+
20–39: weak signal, mixed or thin evidence
18
+
0–19: near-neutral, use HOLD direction at this range
19
+
20
+
Avoid defaulting to 50. Use the full scale. Low confidence should
21
+
be reflected in HOLD direction, not in a 50-confidence BUY/SELL.
22
+
23
+
reasoning — string (2–4 sentences)
24
+
Explain WHY you chose this direction and confidence. Cite the
25
+
specific data from the context that drove your conclusion.
26
+
Mention what would change your view (invalidation conditions).
27
+
28
+
Available context sections (from the market context block):
29
+
PRICE — current price, 24h change, volume
30
+
TECHNICAL INDICATORS — RSI, MACD, Bollinger Bands, EMAs, ATR, regime
31
+
NEWS — recent headlines with source and timestamp
32
+
SENTIMENT — Fear/Greed index, Reddit sentiment, social volume
0 commit comments