Skip to content

"Vibe-Trading: Your Personal Trading Agent"

feat(trading): add a read-only Scalable Capital MCP connector

cgycoreydf164d3a6170
diff --git a/README.md b/README.md
index a1087c2a0..b6104714a 100644
--- a/README.md
+++ b/README.md
@@ -588,14 +588,15 @@ run from a clone (`pip install -e .`).
</details>
<details>
-<summary><b>Broker Connectors</b> <sub>14 brokers — read + paper, bounded-live where supported</sub></summary>
+<summary><b>Broker Connectors</b> <sub>15 brokers — read + paper, bounded-live where supported</sub></summary>
-Connector-first profiles. Most do read + paper-account order placement — IBKR is read-only, Robinhood is live-only (no paper account), and Trading 212 refuses order placement entirely, paper included; live order placement is bounded by a user-defined mandate (symbol allowlist, order-size / exposure caps, daily trade cap, instant kill switch) and never holds funds — the broker executes. Order-placing tools stay off MCP (agent + CLI only). Research / backtest paths are structurally barred from any live endpoint.
+Connector-first profiles. Most do read + paper-account order placement — IBKR is read-only, Robinhood is live-only (no paper account), Scalable Capital is read-only (no paper account exists at all), and Trading 212 refuses order placement entirely, paper included; live order placement is bounded by a user-defined mandate (symbol allowlist, order-size / exposure caps, daily trade cap, instant kill switch) and never holds funds — the broker executes. Order-placing tools stay off MCP (agent + CLI only). Research / backtest paths are structurally barred from any live endpoint.
| Broker | Markets | Capabilities |
|--------|---------|--------------|
| **IBKR** | global | local TWS / Gateway, read-only |
| **Robinhood** | US | Agentic MCP (desktop OAuth) — read + bounded live |
+| **Scalable Capital** | DE / EU | Agentic MCP (desktop OAuth) — fully read-only; no paper account exists |
| **Tiger** | US / HK / A | read + paper + bounded live |
| **Alpaca** | US | read + paper + bounded live (+ TAP credential-isolation mode) |
| **OKX** · **Binance** | crypto | read + paper + bounded live |
diff --git a/README_ar.md b/README_ar.md
index 815b975c2..3661d23bf 100644
--- a/README_ar.md
+++ b/README_ar.md
@@ -549,14 +549,15 @@ LONGBRIDGE_ACCESS_TOKEN=...
</details>
<details>
-<summary><b>موصّلات الوسطاء</b> <sub>14 وسيطاً — قراءة + حساب ورقي، وتداول حي محدود حيثما يُدعم</sub></summary>
+<summary><b>موصّلات الوسطاء</b> <sub>15 وسيطاً — قراءة + حساب ورقي، وتداول حي محدود حيثما يُدعم</sub></summary>
-ملفات تعريف قائمة على الموصّل. يوفّر معظم الموصّلات قراءةً وتنفيذ أوامر على حساب ورقي (paper) — أما IBKR فللقراءة فقط، وRobinhood حيّ فقط (بلا حساب ورقي)، وTrading 212 يرفض تنفيذ الأوامر كلياً بما فيها الورقية؛ أما تنفيذ الأوامر الحية فمحدود بتفويض يحدّده المستخدم (قائمة رموز مسموح بها، وحدود لحجم الأمر / الانكشاف، وحد يومي للصفقات، ومفتاح إيقاف فوري) ولا يحتفظ الموصّل بأي أموال — الوسيط هو من ينفّذ. تبقى أدوات تنفيذ الأوامر خارج MCP (عبر agent + CLI فقط). ومسارات البحث / الاختبار الرجعي محظورة بنيوياً من أي نقطة نهاية حية.
+ملفات تعريف قائمة على الموصّل. يوفّر معظم الموصّلات قراءةً وتنفيذ أوامر على حساب ورقي (paper) — أما IBKR فللقراءة فقط، وRobinhood حيّ فقط (بلا حساب ورقي)، وScalable Capital للقراءة فقط (لا يوجد حساب ورقي إطلاقاً)، وTrading 212 يرفض تنفيذ الأوامر كلياً بما فيها الورقية؛ أما تنفيذ الأوامر الحية فمحدود بتفويض يحدّده المستخدم (قائمة رموز مسموح بها، وحدود لحجم الأمر / الانكشاف، وحد يومي للصفقات، ومفتاح إيقاف فوري) ولا يحتفظ الموصّل بأي أموال — الوسيط هو من ينفّذ. تبقى أدوات تنفيذ الأوامر خارج MCP (عبر agent + CLI فقط). ومسارات البحث / الاختبار الرجعي محظورة بنيوياً من أي نقطة نهاية حية.
| الوسيط | الأسواق | القدرات |
|--------|---------|---------|
| **IBKR** | عالمي | TWS / Gateway محلي، قراءة فقط |
| **Robinhood** | US | Agentic MCP (OAuth عبر سطح المكتب) — قراءة + تداول حي محدود |
+| **Scalable Capital** | DE / EU | Agentic MCP (OAuth عبر سطح المكتب) — قراءة فقط بالكامل؛ لا يوجد حساب ورقي |
| **Tiger** | US / HK / A | قراءة + ورقي + تداول حي محدود |
| **Alpaca** | US | قراءة + ورقي + تداول حي محدود (+ وضع عزل الاعتماد TAP) |
| **OKX** · **Binance** | crypto | قراءة + ورقي + تداول حي محدود |
diff --git a/README_es.md b/README_es.md
index efe2dc6f4..493b09c3f 100644
--- a/README_es.md
+++ b/README_es.md
@@ -553,14 +553,15 @@ clon (`pip install -e .`).
</details>
<details>
-<summary><b>Conectores de Broker</b> <sub>14 brokers — lectura + paper, live acotado donde esté soportado</sub></summary>
+<summary><b>Conectores de Broker</b> <sub>15 brokers — lectura + paper, live acotado donde esté soportado</sub></summary>
-Perfiles centrados en el conector. La mayoría hace lectura + colocación de órdenes en cuenta paper — IBKR es de solo lectura, Robinhood es solo live (sin cuenta paper), y Trading 212 rechaza la colocación de órdenes por completo, incluido el paper; la colocación de órdenes live está acotada por un mandato definido por el usuario (lista blanca de símbolos, límites de tamaño de orden / exposición, límite diario de operaciones, interruptor de apagado instantáneo) y nunca retiene fondos — el broker ejecuta. Las herramientas de colocación de órdenes se mantienen fuera de MCP (solo agente + CLI). Las rutas de investigación / backtest están estructuralmente vetadas de cualquier endpoint live.
+Perfiles centrados en el conector. La mayoría hace lectura + colocación de órdenes en cuenta paper — IBKR es de solo lectura, Robinhood es solo live (sin cuenta paper), Scalable Capital es de solo lectura (no existe cuenta paper), y Trading 212 rechaza la colocación de órdenes por completo, incluido el paper; la colocación de órdenes live está acotada por un mandato definido por el usuario (lista blanca de símbolos, límites de tamaño de orden / exposición, límite diario de operaciones, interruptor de apagado instantáneo) y nunca retiene fondos — el broker ejecuta. Las herramientas de colocación de órdenes se mantienen fuera de MCP (solo agente + CLI). Las rutas de investigación / backtest están estructuralmente vetadas de cualquier endpoint live.
| Broker | Mercados | Capacidades |
|--------|---------|--------------|
| **IBKR** | global | TWS / Gateway local, solo lectura |
| **Robinhood** | EE. UU. | MCP agéntico (OAuth de escritorio) — lectura + live acotado |
+| **Scalable Capital** | DE / UE | MCP agéntico (OAuth de escritorio) — totalmente de solo lectura; no existe cuenta paper |
| **Tiger** | EE. UU. / HK / A | lectura + paper + live acotado |
| **Alpaca** | EE. UU. | lectura + paper + live acotado (+ modo TAP de aislamiento de credenciales) |
| **OKX** · **Binance** | cripto | lectura + paper + live acotado |
diff --git a/README_ja.md b/README_ja.md
index db593be2f..418a5dbb0 100644
--- a/README_ja.md
+++ b/README_ja.md
@@ -549,14 +549,15 @@ clone から実行してください(`pip install -e .`)。
</details>
<details>
-<summary><b>ブローカー connectors</b> <sub>14 ブローカー — read + paper、対応先では bounded-live</sub></summary>
+<summary><b>ブローカー connectors</b> <sub>15 ブローカー — read + paper、対応先では bounded-live</sub></summary>
-connector-first のプロファイル。多くは read + ペーパー口座での発注に対応します —— IBKR は読み取り専用、Robinhood はライブのみ(ペーパー口座なし)、Trading 212 はペーパーを含め発注を一切拒否します。ライブ発注はユーザーが定義した mandate(銘柄許可リスト、発注サイズ / エクスポージャー上限、1 日の取引回数上限、即時 kill switch)で制限され、資金を預かることは一切ありません —— 執行するのはブローカーです。発注系ツールは MCP に公開されません(agent + CLI のみ)。リサーチ / バックテスト経路は構造的にあらゆるライブ endpoint から遮断されています。
+connector-first のプロファイル。多くは read + ペーパー口座での発注に対応します —— IBKR は読み取り専用、Robinhood はライブのみ(ペーパー口座なし)、Scalable Capital は読み取り専用(ペーパー口座が存在しません)、Trading 212 はペーパーを含め発注を一切拒否します。ライブ発注はユーザーが定義した mandate(銘柄許可リスト、発注サイズ / エクスポージャー上限、1 日の取引回数上限、即時 kill switch)で制限され、資金を預かることは一切ありません —— 執行するのはブローカーです。発注系ツールは MCP に公開されません(agent + CLI のみ)。リサーチ / バックテスト経路は構造的にあらゆるライブ endpoint から遮断されています。
| Broker | Markets | Capabilities |
|--------|---------|--------------|
| **IBKR** | global | local TWS / Gateway, read-only |
| **Robinhood** | US | Agentic MCP (desktop OAuth) — read + bounded live |
+| **Scalable Capital** | DE / EU | Agentic MCP (desktop OAuth) — 完全読み取り専用、ペーパー口座なし |
| **Tiger** | US / HK / A | read + paper + bounded live |
| **Alpaca** | US | read + paper + bounded live (+ TAP credential-isolation mode) |
| **OKX** · **Binance** | crypto | read + paper + bounded live |
diff --git a/README_ko.md b/README_ko.md
index a96f72d77..56d8f4141 100644
--- a/README_ko.md
+++ b/README_ko.md
@@ -549,14 +549,15 @@ clone에서 실행하세요(`pip install -e .`).
</details>
<details>
-<summary><b>브로커 커넥터</b> <sub>14개 브로커 — read + paper, 지원 시 bounded-live</sub></summary>
+<summary><b>브로커 커넥터</b> <sub>15개 브로커 — read + paper, 지원 시 bounded-live</sub></summary>
-connector-first 프로필. 대부분의 브로커가 read + 페이퍼 계정 주문 실행을 지원하지만 IBKR은 읽기 전용이고, Robinhood는 페이퍼 계정 없이 실거래 전용이며, Trading 212는 페이퍼를 포함해 주문 실행을 모두 거부하고, 실거래 주문 실행은 사용자 정의 mandate(심볼 허용목록, 주문 크기 / 익스포저 상한, 일일 거래 한도, 즉시 kill switch)로 제한되고 자금을 보관하지 않습니다 — 실행은 브로커가 합니다. 주문 실행 도구는 MCP에 노출되지 않습니다(agent + CLI 전용). 리서치 / 백테스트 경로는 구조적으로 모든 실거래 엔드포인트에서 차단됩니다.
+connector-first 프로필. 대부분의 브로커가 read + 페이퍼 계정 주문 실행을 지원하지만 IBKR은 읽기 전용이고, Robinhood는 페이퍼 계정 없이 실거래 전용이며, Scalable Capital은 읽기 전용이고(페이퍼 계정이 아예 없습니다), Trading 212는 페이퍼를 포함해 주문 실행을 모두 거부하고, 실거래 주문 실행은 사용자 정의 mandate(심볼 허용목록, 주문 크기 / 익스포저 상한, 일일 거래 한도, 즉시 kill switch)로 제한되고 자금을 보관하지 않습니다 — 실행은 브로커가 합니다. 주문 실행 도구는 MCP에 노출되지 않습니다(agent + CLI 전용). 리서치 / 백테스트 경로는 구조적으로 모든 실거래 엔드포인트에서 차단됩니다.
| Broker | Markets | Capabilities |
|--------|---------|--------------|
| **IBKR** | global | local TWS / Gateway, read-only |
| **Robinhood** | US | Agentic MCP (desktop OAuth) — read + bounded live |
+| **Scalable Capital** | DE / EU | Agentic MCP (desktop OAuth) — 완전 읽기 전용, 페이퍼 계정 없음 |
| **Tiger** | US / HK / A | read + paper + bounded live |
| **Alpaca** | US | read + paper + bounded live (+ TAP credential-isolation mode) |
| **OKX** · **Binance** | crypto | read + paper + bounded live |
diff --git a/README_zh.md b/README_zh.md
index cbc34ee13..4774e1ec7 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -562,14 +562,15 @@ LONGBRIDGE_ACCESS_TOKEN=...
</details>
<details>
-<summary><b>Broker Connectors</b> <sub>14 家券商——读取 + 模拟盘,支持的券商可受约束实盘</sub></summary>
+<summary><b>Broker Connectors</b> <sub>15 家券商——读取 + 模拟盘,支持的券商可受约束实盘</sub></summary>
-连接器优先(connector-first)的配置档。多数连接器支持读取 + 模拟盘下单 —— IBKR 只读,Robinhood 只有实盘(没有模拟盘),Trading 212 连模拟盘下单也一律拒绝;实盘下单受用户定义的 mandate 约束(标的白名单、下单规模 / 敞口上限、每日交易次数上限、即时 kill switch),且从不托管资金——由券商执行。下单类工具不经 MCP 暴露(仅 agent + CLI)。研究 / 回测路径在结构上被隔离,无法触达任何实盘端点。
+连接器优先(connector-first)的配置档。多数连接器支持读取 + 模拟盘下单 —— IBKR 只读,Robinhood 只有实盘(没有模拟盘),Scalable Capital 只读(完全没有模拟盘账户),Trading 212 连模拟盘下单也一律拒绝;实盘下单受用户定义的 mandate 约束(标的白名单、下单规模 / 敞口上限、每日交易次数上限、即时 kill switch),且从不托管资金——由券商执行。下单类工具不经 MCP 暴露(仅 agent + CLI)。研究 / 回测路径在结构上被隔离,无法触达任何实盘端点。
| Broker | 市场 | 能力 |
|--------|------|------|
| **IBKR** | global | 本地 TWS / Gateway,只读 |
| **Robinhood** | US | Agentic MCP(桌面 OAuth)——读取 + 受约束实盘 |
+| **Scalable Capital** | DE / EU | Agentic MCP(桌面 OAuth)——完全只读;没有模拟盘账户 |
| **Tiger** | US / HK / A | 读取 + 模拟盘 + 受约束实盘 |
| **Alpaca** | US | 读取 + 模拟盘 + 受约束实盘(+ TAP 密钥隔离模式) |
| **OKX** · **Binance** | crypto | 读取 + 模拟盘 + 受约束实盘 |
diff --git a/agent/src/config/schema.py b/agent/src/config/schema.py
index c5df50aba..79e7a58b5 100644
--- a/agent/src/config/schema.py
+++ b/agent/src/config/schema.py
@@ -12,13 +12,14 @@ from pydantic import BaseModel, ConfigDict, Field, model_validator
# wildcard ``enabled_tools`` (which would re-admit every WRITE/UNKNOWN tool) is
# rejected at config-load time unless a broker-specific read-only OAuth probe is
# explicitly documented below.
-LIVE_BROKER_SERVER_KEYS: frozenset[str] = frozenset({"robinhood", "ibkr"})
+LIVE_BROKER_SERVER_KEYS: frozenset[str] = frozenset({"robinhood", "ibkr", "scalable"})
# URL host suffix -> canonical live-broker key. Detection by host prevents an
# aliased config key from bypassing the wildcard rejection / classification gate.
LIVE_BROKER_URL_HOST_SUFFIX_TO_KEY: dict[str, str] = {
"robinhood.com": "robinhood",
"ibkr.com": "ibkr",
+ "scalable.capital": "scalable",
}
# Live-broker URL host suffixes. Detecting a live broker by config key alone is
@@ -236,6 +237,51 @@ IBKR_MCP_SERVER_SEED: dict[str, object] = {
"enabled_tools": ["*"],
}
+# Canonical seed for Scalable Capital's Agentic Investing MCP server, shipped
+# OFF-by-default read-only: an explicit READ allowlist (never ``["*"]``), OAuth
+# auth, and the streamableHttp transport. Scalable has no paper environment, so
+# there is nothing to discriminate: order-path tools are pinned WRITE in
+# ``src/trading/connectors/scalable/classification.py``, are NOT seeded
+# here, and the profile that carries this server exposes no order capability.
+#
+# ``scopes`` is intentionally omitted: Scalable does not publish its OAuth scope
+# names, and an invented scope would fail authorization rather than a read. The
+# allowlist below MUST stay equal to the curated READ entries — a name here that
+# the curated map does not classify READ resolves UNKNOWN -> gated -> refused,
+# silently hiding a real read tool.
+SCALABLE_MCP_SERVER_SEED: dict[str, object] = {
+ "type": "streamableHttp",
+ "url": "https://mcp.scalable.capital/mcp",
+ "auth": {
+ "type": "oauth",
+ "client_name": "Vibe-Trading",
+ "cache_dir": "~/.vibe-trading/live/scalable/oauth",
+ },
+ "enabled_tools": [
+ # account & portfolio
+ "get_account_profile",
+ "list_accessible_portfolios",
+ "get_portfolio_overview",
+ "get_portfolio_holdings",
+ "get_portfolio_cash_breakdown",
+ "get_portfolio_performance",
+ "list_portfolio_transactions",
+ "get_transaction_details",
+ "get_overnight_summary",
+ # market data
+ "search_securities",
+ "search_derivatives",
+ "get_security_quote",
+ "get_security_chart",
+ "get_security_news",
+ # watchlist / alerts / savings-plan state
+ "list_watchlist_items",
+ "list_price_alerts",
+ "list_savings_plans",
+ "get_savings_plan_config",
+ ],
+}
+
def _to_camel(name: str) -> str:
"""Convert snake_case names to camelCase aliases.
diff --git a/agent/src/live/registry.py b/agent/src/live/registry.py
index d6ca9fd21..6ef7bec96 100644
--- a/agent/src/live/registry.py
+++ b/agent/src/live/registry.py
@@ -32,6 +32,7 @@ from src.trading.connectors.longbridge.classification import LONGBRIDGE_TOOL_CLA
from src.trading.connectors.mt5.classification import MT5_TOOL_CLASS
from src.trading.connectors.okx.classification import OKX_TOOL_CLASS
from src.trading.connectors.robinhood.classification import ROBINHOOD_TOOL_CLASS
+from src.trading.connectors.scalable.classification import SCALABLE_TOOL_CLASS
from src.trading.connectors.shoonya.classification import SHOONYA_TOOL_CLASS
from src.trading.connectors.tiger.classification import TIGER_TOOL_CLASS
from src.trading.connectors.etoro.classification import ETORO_TOOL_CLASS
@@ -59,6 +60,7 @@ _BROKER_CURATED_MAPS = {
"mt5": MT5_TOOL_CLASS,
"etoro": ETORO_TOOL_CLASS,
"zerodha": ZERODHA_TOOL_CLASS,
+ "scalable": SCALABLE_TOOL_CLASS,
}
diff --git a/agent/src/portfolio/compatibility.py b/agent/src/portfolio/compatibility.py
index 534bdd5d9..c29de3ce4 100644
--- a/agent/src/portfolio/compatibility.py
+++ b/agent/src/portfolio/compatibility.py
@@ -98,6 +98,11 @@ _CONNECTOR_COMPATIBILITY: dict[str, PortfolioCompatibility] = {
"open_positions",
"Account totals and instrument quote resolution require verification.",
),
+ # No "scalable" entry: its profile does not declare account.read /
+ # positions.read, so it is not a portfolio-eligible connection. The
+ # holdings reply shape is unverified (no published tool argument schemas),
+ # so a portfolio read could not be mapped; add the entry with the
+ # normalisation once a live tools/list settles the shape (#1367).
}
_EXPERIMENTAL_DEFAULT = PortfolioCompatibility(
diff --git a/agent/src/trading/connectors/scalable/__init__.py b/agent/src/trading/connectors/scalable/__init__.py
new file mode 100644
index 000000000..341feae25
--- /dev/null
+++ b/agent/src/trading/connectors/scalable/__init__.py
@@ -0,0 +1 @@
+"""Scalable Capital connector package."""
diff --git a/agent/src/trading/connectors/scalable/classification.py b/agent/src/trading/connectors/scalable/classification.py
new file mode 100644
index 000000000..c747d47b7
--- /dev/null
+++ b/agent/src/trading/connectors/scalable/classification.py
@@ -0,0 +1,66 @@
+"""Curated read/write classification map for Scalable Capital's Agentic MCP.
+
+Tier 2 of the classification ladder (:mod:`src.live.classification`): an
+explicit, version-controlled map keyed by the broker's remote tool name. Map
+entries are authoritative and override Tier-1 ``annotations`` when they
+disagree (a deceptive ``readOnlyHint=True`` on ``submit_buy_order`` cannot
+demote a curated WRITE). A tool absent from this map and not annotated
+read-only is UNKNOWN and treated as WRITE (fail-closed).
+
+Provenance: Scalable publishes the tool *names* and one-line descriptions in
+their own help docs, indexed in issue #1367. The tracker post headlined "26
+tools across 6 categories" and then enumerated 29 names; this map pins the
+NAMES AS LISTED, because a name is what the classification ladder keys on.
+Their argument schemas are not published — see :mod:`mcp` for the (small,
+flagged) wire assumptions that follow from that.
+
+READ is pinned for the 18 published read tools. WRITE is pinned for the 11
+order-path ones — including ``preview_buy_order`` / ``preview_sell_order``:
+a preview mutates nothing, but it sits on the order path and its confirmation
+feeds ``submit_*``, so treating it as READ would hand out an order-path tool
+on the plain read path. Any tool Scalable adds later that is not in this map
+and not annotated read-only resolves UNKNOWN → WRITE (fail-closed).
+"""
+
+from __future__ import annotations
+
+from src.live.classification import ToolClass
+
+#: Frozen canonical Scalable Capital read/write catalog.
+SCALABLE_TOOL_CLASS: dict[str, ToolClass] = {
+ # READ — account & portfolio (9)
+ "get_account_profile": ToolClass.READ,
+ "list_accessible_portfolios": ToolClass.READ,
+ "get_portfolio_overview": ToolClass.READ,
+ "get_portfolio_holdings": ToolClass.READ,
+ "get_portfolio_cash_breakdown": ToolClass.READ,
+ "get_portfolio_performance": ToolClass.READ,
+ "list_portfolio_transactions": ToolClass.READ,
+ "get_transaction_details": ToolClass.READ,
+ "get_overnight_summary": ToolClass.READ,
+ # READ — market data (5)
+ "search_securities": ToolClass.READ,
+ "search_derivatives": ToolClass.READ,
+ "get_security_quote": ToolClass.READ,
+ "get_security_chart": ToolClass.READ,
+ "get_security_news": ToolClass.READ,
+ # READ — watchlist / alerts / savings-plan state (4)
+ "list_watchlist_items": ToolClass.READ,
+ "list_price_alerts": ToolClass.READ,
+ "list_savings_plans": ToolClass.READ,
+ "get_savings_plan_config": ToolClass.READ,
+ # WRITE — watchlist / alerts / savings plans (6)
+ "add_watchlist_item": ToolClass.WRITE,
+ "remove_watchlist_item": ToolClass.WRITE,
+ "create_price_alert": ToolClass.WRITE,
+ "remove_price_alert": ToolClass.WRITE,
+ "upsert_savings_plan": ToolClass.WRITE,
+ "remove_savings_plan": ToolClass.WRITE,
+ # WRITE — order path (5). preview_* is pinned WRITE on purpose: see module
+ # docstring. No built-in profile enables any of these.
+ "preview_buy_order": ToolClass.WRITE,
+ "submit_buy_order": ToolClass.WRITE,
+ "preview_sell_order": ToolClass.WRITE,
+ "submit_sell_order": ToolClass.WRITE,
+ "cancel_order": ToolClass.WRITE,
+}
diff --git a/agent/src/trading/connectors/scalable/mcp.py b/agent/src/trading/connectors/scalable/mcp.py
new file mode 100644
index 000000000..c9d317492
--- /dev/null
+++ b/agent/src/trading/connectors/scalable/mcp.py
@@ -0,0 +1,61 @@
+"""Scalable Capital Agentic MCP mapping for generic read-only operations.
+
+What is verified: the read tool NAMES, from the tool list Scalable publishes in
+their own help docs (indexed in issue #1367). What is not: the argument
+schemas, which need a live ``tools/list`` against an authenticated MCP session.
+So the mapping is deliberately the smallest one that can work, and each wire
+key it emits is an assumption flagged below — the upgrade path is one live
+``tools/list`` replacing the two constants, not a rewrite.
+
+* ``account`` / ``positions`` take one portfolio selector. Their holdings and
+ overview tools are scoped to a portfolio the caller picked from
+ ``list_accessible_portfolios``; the generic layer hands that over as
+ ``account_number`` (or ``account``), and the wire key is ASSUMED to be
+ ``portfolio_id``. When the caller named no portfolio, nothing is sent, so a
+ wrong guess fails on the broker side instead of silently reading the wrong
+ portfolio.
+* ``quote`` is ASSUMED to take ``symbols`` (the Robinhood shape), because
+ ``get_security_quote`` is the only published quote tool and the generic layer
+ already passes ``symbols``.
+* ``orders`` is intentionally unmapped: Scalable publishes no open-order read
+ tool for it to point at.
+
+None of these three assumptions is load-bearing for safety. They only decide
+whether a read succeeds; a wrong key surfaces as a broker-side error.
+"""
+
+from __future__ import annotations
+
+from typing import Any
+
+_REMOTE_TOOL_NAMES = {
+ "account": "get_portfolio_overview",
+ "positions": "get_portfolio_holdings",
+ "quote": "get_security_quote",
+}
+
+#: Generic keys that name the portfolio a read is scoped to. ASSUMED to be sent
+#: on the wire as ``portfolio_id`` (see module docstring).
+_PORTFOLIO_KEYS = ("portfolio_id", "account_number", "account")
+
+
+def remote_tool_name(operation: str) -> str | None:
+ """Return the Scalable remote tool name for a generic read operation."""
+ return _REMOTE_TOOL_NAMES.get(operation)
+
+
+def remote_arguments(operation: str, arguments: dict[str, Any]) -> dict[str, Any]:
+ """Normalize generic arguments for a Scalable remote MCP operation."""
+ if operation in ("account", "positions"):
+ for key in _PORTFOLIO_KEYS:
+ value = arguments.get(key)
+ if isinstance(value, str) and value.strip():
+ return {"portfolio_id": value.strip()}
+ return {}
+ if operation == "quote":
+ symbols = arguments.get("symbols")
+ if isinstance(symbols, list) and symbols:
+ return {"symbols": symbols}
+ symbol = arguments.get("symbol")
+ return {"symbols": [symbol]} if symbol else {}
+ return {}
diff --git a/agent/src/trading/connectors/scalable/profiles.py b/agent/src/trading/connectors/scalable/profiles.py
new file mode 100644
index 000000000..49372fe7e
--- /dev/null
+++ b/agent/src/trading/connectors/scalable/profiles.py
@@ -0,0 +1,49 @@
+"""Built-in Scalable Capital connector profiles.
+
+Scalable Capital's Agentic Investing MCP endpoint is registered here as
+read-only. The broker has no paper environment at all (their own help docs say
+so), so there is no paper/live discriminator to verify and no paper order
+placement to expose; the tier that follows is bounded-live, and the read-only
+profile below is the first cut of it pending the argument schemas a live
+``tools/list`` would settle (see :mod:`mcp`). No built-in profile in this
+connector places orders.
+"""
+
+from __future__ import annotations
+
+from src.trading.types import TradingProfile
+
+#: Read capabilities a Scalable Agentic MCP profile exposes. Deliberately no
+#: ``orders.read``: the published catalog has no open-order read tool, only
+#: ``list_portfolio_transactions`` (history) and the order path itself.
+#:
+#: Also deliberately no ``account.read`` / ``positions.read``, for now. Those two
+#: are exactly what :func:`src.trading.connections.is_portfolio_connection_profile`
+#: requires, so declaring them makes this profile back a portfolio connection —
+#: and nothing maps Scalable's holdings reply into the shared ``positions``
+#: shape (``_normalize_remote_result`` has no Scalable branch), so a refresh
+#: stores a *complete* snapshot holding zero positions. Scalable publishes no
+#: tool argument schemas yet, so there is nothing to map against; a source that
+#: can only error is no better. Add the pair back together with the
+#: normalisation once a live ``tools/list`` settles the reply shape (#1367).
+SCALABLE_READ_CAPABILITIES = ("quotes.read",)
+
+SCALABLE_PROFILES: tuple[TradingProfile, ...] = (
+ TradingProfile(
+ id="scalable-live-mcp-readonly",
+ connector="scalable",
+ label="Scalable Capital Live · Agentic MCP Read-Only",
+ environment="live",
+ transport="remote_mcp",
+ capabilities=SCALABLE_READ_CAPABILITIES,
+ readonly=True,
+ config={"server": "scalable"},
+ notes=(
+ "Reads a Scalable Capital account through their Agentic Investing MCP "
+ "(desktop OAuth, enabled under Profile > Security). Scalable has no "
+ "paper account, so this connector ships read-only: no built-in profile "
+ "places orders, and the order-path tools (preview_* / submit_* / "
+ "cancel_order) are pinned WRITE and stay out of the enabled allowlist."
+ ),
+ ),
+)
diff --git a/agent/src/trading/profiles.py b/agent/src/trading/profiles.py
index e01ecdc30..f38003455 100644
--- a/agent/src/trading/profiles.py
+++ b/agent/src/trading/profiles.py
@@ -15,6 +15,7 @@ from src.trading.connectors.longbridge.profiles import LONGBRIDGE_PROFILES
from src.trading.connectors.mt5.profiles import MT5_PROFILES
from src.trading.connectors.okx.profiles import OKX_PROFILES
from src.trading.connectors.robinhood.profiles import ROBINHOOD_PROFILES
+from src.trading.connectors.scalable.profiles import SCALABLE_PROFILES
from src.trading.connectors.shoonya.profiles import SHOONYA_PROFILES
from src.trading.connectors.tiger.profiles import TIGER_PROFILES
from src.trading.connectors.etoro.profiles import ETORO_PROFILES
@@ -40,6 +41,7 @@ BUILTIN_PROFILES: tuple[TradingProfile, ...] = (
*MT5_PROFILES,
*ETORO_PROFILES,
*ZERODHA_PROFILES,
+ *SCALABLE_PROFILES,
)
diff --git a/agent/src/trading/service.py b/agent/src/trading/service.py
index 2d8693cc8..be4f562c1 100644
--- a/agent/src/trading/service.py
+++ b/agent/src/trading/service.py
@@ -1445,6 +1445,10 @@ def _remote_tool_name(connector: str, operation: str) -> str | None:
if connector == "robinhood":
from src.trading.connectors.robinhood.mcp import remote_tool_name
+ return remote_tool_name(operation)
+ if connector == "scalable":
+ from src.trading.connectors.scalable.mcp import remote_tool_name
+
return remote_tool_name(operation)
return None
@@ -1458,6 +1462,10 @@ def _remote_arguments(connector: str, operation: str, arguments: dict[str, Any])
if connector == "robinhood":
from src.trading.connectors.robinhood.mcp import remote_arguments
+ return remote_arguments(operation, arguments)
+ if connector == "scalable":
+ from src.trading.connectors.scalable.mcp import remote_arguments
+
return remote_arguments(operation, arguments)
return {}
diff --git a/agent/tests/test_paper_capped_connectors_refuse_live.py b/agent/tests/test_paper_capped_connectors_refuse_live.py
index 4b2e1d52b..a8c56f42a 100644
--- a/agent/tests/test_paper_capped_connectors_refuse_live.py
+++ b/agent/tests/test_paper_capped_connectors_refuse_live.py
@@ -45,6 +45,11 @@ _LIVE_CAPABLE = frozenset(
"robinhood",
"ibkr",
"mt5",
+ # Scalable Capital publishes no paper environment at all — the same shape
+ # as Robinhood — so there is no ambiguity a discriminator would protect
+ # against. Tier settled as bounded live in #1367; the profile that ships
+ # today is read-only and exposes no order capability.
+ "scalable",
}
)
diff --git a/agent/tests/test_readme_counts.py b/agent/tests/test_readme_counts.py
index 277392d07..51182f3cf 100644
--- a/agent/tests/test_readme_counts.py
+++ b/agent/tests/test_readme_counts.py
@@ -69,8 +69,9 @@ BADGE_ORDER = ("skills", "brokers", "presets", "alphas", "engines", "quantlib")
# must equal the number of distinct connectors the profile registry exposes.
# Without that guard the count tests only prove the five READMEs agree with
# each other, which they did while all five were uniformly wrong — eToro
-# shipped as the 13th connector and the pin stayed at 12.
-EXPECTED_BROKERS = 14
+# shipped as the 13th connector and the pin stayed at 12. Same again for
+# Scalable Capital, which landed as the 15th.
+EXPECTED_BROKERS = 15
def _read(name: str) -> str:
diff --git a/agent/tests/test_scalable_connector.py b/agent/tests/test_scalable_connector.py
new file mode 100644
index 000000000..b298656b8
--- /dev/null
+++ b/agent/tests/test_scalable_connector.py
@@ -0,0 +1,383 @@
+"""Tests for the read-only Scalable Capital connector (#1367).
+
+The connector has no Scalable account behind it — nobody maintaining the repo
+has one — so these tests pin exactly what can be verified without one: the
+frozen tool catalog, the profile shape, the gate wiring, and the seeded
+allowlist matching the curated READ names. Nothing here asserts that a read
+returns the right numbers; that needs a live ``tools/list`` plus an account.
+"""
+
+from __future__ import annotations
+
+import json
+from datetime import datetime, timedelta, timezone
+from pathlib import Path
+
+import pytest
+from mcp import types as mcp_types
+
+import src.live.paths as paths
+from src.live.extractors import get_extractor
+from src.live.mandate.model import MANDATE_SCHEMA_VERSION
+from src.live.order_guard import LiveOrderGuardTool
+from src.live.registry import is_live_broker, wrap_live_broker_tools
+from src.tools.mcp import MCPRemoteTool, build_mcp_tool_wrappers
+
+from src.config.schema import (
+ LIVE_BROKER_SERVER_KEYS,
+ LIVE_BROKER_URL_HOST_SUFFIX_TO_KEY,
+ SCALABLE_MCP_SERVER_SEED,
+ AgentConfig,
+ MCPServerConfig,
+ is_live_broker_url,
+)
+from src.live import registry
+from src.live.classification import ToolClass, classify_tool
+from src.trading import profiles, service
+from src.trading.connections import is_portfolio_connection_profile
+from src.trading.connectors.scalable.classification import SCALABLE_TOOL_CLASS
+from src.trading.connectors.scalable.mcp import remote_arguments, remote_tool_name
+
+pytestmark = pytest.mark.unit
+
+#: The READ and WRITE names, pinned **literally** rather than derived from
+#: ``SCALABLE_TOOL_CLASS``. Deriving them made these tests compare the map with
+#: itself: flipping a WRITE name to READ and seeding it kept the suite green,
+#: and the seeded name then assembled as a plain read-only ``MCPRemoteTool``
+#: rather than being wrapped by ``LiveOrderGuardTool`` and refused. With literal
+#: sets, moving a tool between the two classes cannot pass without a test diff
+#: that names the tool.
+_CURATED_READS = frozenset(
+ {
+ # account & portfolio
+ "get_account_profile",
+ "list_accessible_portfolios",
+ "get_portfolio_overview",
+ "get_portfolio_holdings",
+ "get_portfolio_cash_breakdown",
+ "get_portfolio_performance",
+ "list_portfolio_transactions",
+ "get_transaction_details",
+ "get_overnight_summary",
+ # market data
+ "search_securities",
+ "search_derivatives",
+ "get_security_quote",
+ "get_security_chart",
+ "get_security_news",
+ # watchlist / alerts / savings-plan state
+ "list_watchlist_items",
+ "list_price_alerts",
+ "list_savings_plans",
+ "get_savings_plan_config",
+ }
+)
+
+_CURATED_WRITES = frozenset(
+ {
+ # watchlist / alerts / savings plans
+ "add_watchlist_item",
+ "remove_watchlist_item",
+ "create_price_alert",
+ "remove_price_alert",
+ "upsert_savings_plan",
+ "remove_savings_plan",
+ # order path (preview_* included: see classification.py)
+ "preview_buy_order",
+ "submit_buy_order",
+ "preview_sell_order",
+ "submit_sell_order",
+ "cancel_order",
+ }
+)
+
+
+def test_profile_is_registered_readonly_remote_mcp() -> None:
+ profile = profiles.profile_by_id("scalable-live-mcp-readonly")
+
+ assert profile.connector == "scalable"
+ assert profile.environment == "live"
+ assert profile.transport == "remote_mcp"
+ assert profile.readonly is True
+ assert profile.config == {"server": "scalable"}
+ # quotes.read only: account.read + positions.read are what make a profile a
+ # portfolio connection, and Scalable's holdings reply has no mapper yet.
+ assert set(profile.capabilities) == {"quotes.read"}
+ assert not is_portfolio_connection_profile(profile), (
+ "a profile with no holdings mapper must not back a portfolio connection: "
+ "the refresh would store a complete snapshot with zero positions"
+ )
+ # A read-only connector must not advertise an order capability in any form.
+ assert not [c for c in profile.capabilities if c.startswith("orders.place")]
+
+
+def test_curated_name_sets_match_the_map_exactly() -> None:
+ """Pin the map to the literal sets, in both directions and in size.
+
+ Without this the sets merely restate the map, so a name silently moved
+ between READ and WRITE is invisible to the suite.
+ """
+ mapped_reads = {name for name, cls in SCALABLE_TOOL_CLASS.items() if cls is ToolClass.READ}
+ mapped_writes = {name for name, cls in SCALABLE_TOOL_CLASS.items() if cls is ToolClass.WRITE}
+
+ assert mapped_reads == set(_CURATED_READS)
+ assert mapped_writes == set(_CURATED_WRITES)
+ assert len(_CURATED_READS) == 18, "the published read catalog is 18 names"
+ assert len(_CURATED_WRITES) == 11, "the order/write catalog is 11 names"
+ assert len(SCALABLE_TOOL_CLASS) == 29
+
+
+def test_no_builtin_scalable_profile_can_place_orders() -> None:
+ scalable = [p for p in profiles.list_profiles() if p.connector == "scalable"]
+
+ assert scalable, "scalable profiles missing from the registry"
+ assert all(p.readonly for p in scalable)
+ assert not any(c.startswith("orders.place") for p in scalable for c in p.capabilities)
+
+
+def test_curated_catalog_pins_reads_and_writes() -> None:
+ curated = registry._BROKER_CURATED_MAPS["scalable"]
+
+ assert curated is SCALABLE_TOOL_CLASS
+ for name in ("get_account_profile", "get_portfolio_holdings", "list_accessible_portfolios"):
+ assert curated[name] is ToolClass.READ
+ assert classify_tool(name, None, curated) is ToolClass.READ
+
+ for name in ("submit_buy_order", "cancel_order", "upsert_savings_plan"):
+ assert curated[name] is ToolClass.WRITE
+ assert classify_tool(name, None, curated) is ToolClass.WRITE
+
+ # An unrecognized Scalable tool fails closed.
+ assert classify_tool("scalable_new_operation", None, curated) is ToolClass.UNKNOWN
+
+
+def test_a_deceptive_readonly_annotation_cannot_demote_a_curated_write() -> None:
+ from mcp.types import ToolAnnotations
+
+ curated = registry._BROKER_CURATED_MAPS["scalable"]
+ lying = ToolAnnotations(readOnlyHint=True, destructiveHint=False)
+
+ for name in _CURATED_WRITES:
+ assert classify_tool(name, lying, curated) is ToolClass.WRITE
+
+
+def test_order_path_previews_are_pinned_write() -> None:
+ """A preview mutates nothing, but it is on the order path — not a read."""
+ for name in ("preview_buy_order", "preview_sell_order"):
+ assert SCALABLE_TOOL_CLASS[name] is ToolClass.WRITE
+
+
+def test_seed_allowlist_is_exactly_the_curated_read_names() -> None:
+ seed = list(SCALABLE_MCP_SERVER_SEED["enabled_tools"])
+
+ assert "*" not in seed
+ assert set(seed) == _CURATED_READS, (
+ "the seeded enabled_tools must equal the curated READ names; a seeded "
+ "name the map does not classify READ would be gated and refused"
+ )
+ assert len(seed) == len(set(seed))
+
+
+def test_seed_never_enables_an_order_path_tool() -> None:
+ seed = set(SCALABLE_MCP_SERVER_SEED["enabled_tools"])
+
+ assert not (seed & _CURATED_WRITES), "an order-path tool is seeded as enabled"
+
+
+def test_seed_is_a_live_broker_channel_with_no_wildcard() -> None:
+ cfg = AgentConfig.model_validate({"mcpServers": {"scalable": SCALABLE_MCP_SERVER_SEED}})
+ server = cfg.mcp_servers["scalable"]
+
+ assert server.resolved_transport() == "streamableHttp"
+ assert server.url == "https://mcp.scalable.capital/mcp"
+ assert server.auth is not None and server.auth.type == "oauth"
+ assert server.auth.cache_dir == "~/.vibe-trading/live/scalable/oauth"
+ assert server.auth.scopes == []
+ assert "*" not in server.enabled_tools
+ assert "scalable" in LIVE_BROKER_SERVER_KEYS
+
+
+def test_wildcard_is_rejected_for_scalable() -> None:
+ with pytest.raises(ValueError, match="wildcard"):
+ AgentConfig.model_validate(
+ {
+ "mcpServers": {
+ "scalable": {
+ "type": "streamableHttp",
+ "url": "https://mcp.scalable.capital/mcp",
+ "auth": {"type": "oauth"},
+ "enabledTools": ["*"],
+ }
+ }
+ }
+ )
+
+
+def test_aliased_key_with_scalable_url_is_still_a_live_broker() -> None:
+ assert LIVE_BROKER_URL_HOST_SUFFIX_TO_KEY["scalable.capital"] == "scalable"
+ assert is_live_broker_url("https://mcp.scalable.capital/mcp") is True
+ assert is_live_broker_url("https://mcp.scalable.capital.evil.test/mcp") is False
+
+ with pytest.raises(ValueError, match="wildcard"):
+ AgentConfig.model_validate(
+ {
+ "mcpServers": {
+ "sc": {
+ "type": "streamableHttp",
+ "url": "https://mcp.scalable.capital/mcp",
+ "auth": {"type": "oauth"},
+ "enabledTools": ["*"],
+ }
+ }
+ }
+ )
+
+
+def test_generic_operations_map_to_read_tools() -> None:
+ assert remote_tool_name("account") == "get_portfolio_overview"
+ assert remote_tool_name("positions") == "get_portfolio_holdings"
+ assert remote_tool_name("quote") == "get_security_quote"
+ # No open-order read tool exists in the published catalog.
+ assert remote_tool_name("orders") is None
+
+
+def test_service_dispatch_reaches_the_scalable_mapping() -> None:
+ assert service._remote_tool_name("scalable", "positions") == "get_portfolio_holdings"
+ assert service._remote_arguments("scalable", "positions", {"account_number": "P-1"}) == {"portfolio_id": "P-1"}
+ assert service._remote_tool_name("scalable", "orders") is None
+
+
+def test_remote_arguments_never_invents_a_portfolio() -> None:
+ assert remote_arguments("positions", {}) == {}
+ assert remote_arguments("account", {"account_number": " "}) == {}
+ assert remote_arguments("quote", {"symbol": "IE00B4L5Y983"}) == {"symbols": ["IE00B4L5Y983"]}
+ assert remote_arguments("quote", {"symbols": ["IE00B4L5Y983", "IE00B5BMR087"]}) == {
+ "symbols": ["IE00B4L5Y983", "IE00B5BMR087"]
+ }
+ assert remote_arguments("quote", {}) == {}
+
+
+# ── Adversarial pass: what an operator could still do, and where it lands ─────
+#
+# The seed is OFF-by-default, but nothing stops an operator hand-editing
+# `enabledTools` — that is the documented path for the Robinhood write tools.
+# These four tests take that path for Scalable and pin where it ends.
+
+_SCALABLE_CATALOG = tuple(str(t) for t in SCALABLE_MCP_SERVER_SEED["enabled_tools"]) + ("submit_buy_order",)
+
+
+class _RefusingClient:
+ """Mock MCP client that fails the test if a remote call is ever attempted."""
+
+ async def __aenter__(self) -> "_RefusingClient":
+ return self
+
+ async def __aexit__(self, exc_type, exc, tb) -> None:
+ return None
+
+ async def list_tools(self) -> list[mcp_types.Tool]:
+ return [
+ mcp_types.Tool(name=name, description=f"remote {name}", inputSchema={"type": "object"})
+ for name in _SCALABLE_CATALOG
+ ]
+
+ async def call_tool(self, name, arguments=None, *, timeout=None, raise_on_error=False):
+ raise AssertionError(f"the gate must refuse before any remote call (tried {name})")
+
+
+def _assemble(enabled_tools: list[str]) -> list[MCPRemoteTool]:
+ """Discover + live-wrap the scalable channel for a given allowlist."""
+ cfg = MCPServerConfig.model_validate(dict(SCALABLE_MCP_SERVER_SEED) | {"enabled_tools": enabled_tools})
+ wrappers = build_mcp_tool_wrappers("scalable", cfg, client_factory=lambda: _RefusingClient())
+ assert is_live_broker("scalable", cfg.url)
+ return wrap_live_broker_tools("scalable", wrappers, url=cfg.url)
+
+
+def test_seeded_read_tools_are_plain_readonly_and_ungated() -> None:
+ tools = _assemble(list(SCALABLE_MCP_SERVER_SEED["enabled_tools"]))
+
+ assert {t._spec.remote_name for t in tools} == set(SCALABLE_MCP_SERVER_SEED["enabled_tools"])
+ assert all(type(t) is MCPRemoteTool and t.is_readonly for t in tools)
+ assert not any(isinstance(t, LiveOrderGuardTool) for t in tools)
+
+
+def test_a_hand_enabled_order_tool_is_gate_wrapped_not_exposed() -> None:
+ """An operator adding a WRITE name by hand gets a gated tool, never a plain one."""
+ tools = _assemble(list(SCALABLE_MCP_SERVER_SEED["enabled_tools"]) + ["submit_buy_order"])
+ by_name = {t._spec.remote_name: t for t in tools}
+
+ assert type(by_name["submit_buy_order"]) is LiveOrderGuardTool
+ assert by_name["submit_buy_order"].broker == "scalable"
+ assert type(by_name["get_portfolio_holdings"]) is MCPRemoteTool
+
+
+def test_scalable_has_no_order_intent_extractor() -> None:
+ """No extractor is registered for Scalable — the gate can only fail closed."""
+ assert get_extractor("scalable") is None
+
+
+def test_order_path_fails_closed_at_the_intent_step(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
+ """A hand-enabled Scalable order is refused before any remote call.
+
+ This exercises the gate's no-extractor branch, which had no test before this
+ connector: Scalable is the first live-capable connector that ships without an
+ order-intent extractor, so nothing else could reach
+ "order intent could not be parsed". A committed mandate is deliberately
+ present, so the refusal cannot be explained by a missing mandate.
+ """
+ monkeypatch.setattr(paths, "get_runtime_root", lambda: tmp_path)
+ _commit_scalable_mandate(tmp_path)
+
+ guard = {
+ t._spec.remote_name: t
+ for t in _assemble(list(SCALABLE_MCP_SERVER_SEED["enabled_tools"]) + ["submit_buy_order"])
+ }["submit_buy_order"]
+ # The fake client raises if this reaches the broker; a refusal payload is the
+ # only way this line returns.
+ payload = json.loads(guard.execute(symbol="VWCE", side="buy", quantity=1, instrument_type="etf"))
+
+ assert payload["status"] == "blocked"
+ assert payload["reason"] == "order intent could not be parsed"
+ decision = payload["live_action"]["gate_decision"]
+ assert decision["allowed"] is False
+ assert decision["decision"] == "deny"
+ assert decision["checked_limits"] == ["mandate", "expiry", "halt_flag", "intent"]
+ # Nothing was sized and nothing reached the broker: the refusal is structural,
+ # not a mandate-cap rejection.
+ assert payload["live_action"]["intent_normalized"] is None
+ assert payload["live_action"]["broker_request"] is None
+
+
+def _commit_scalable_mandate(runtime_root: Path) -> None:
+ """Write a valid committed mandate for Scalable, so a denial is not 'no mandate'."""
+ broker = runtime_root / "live" / "scalable"
+ broker.mkdir(parents=True, exist_ok=True)
+ created = datetime.now(timezone.utc)
+ payload = {
+ "schema_version": MANDATE_SCHEMA_VERSION,
+ "hard_caps": {
+ "account_funding_usd": 5000.0,
+ "max_order_notional_usd": 750.0,
+ "max_total_exposure_usd": 5000.0,
+ "max_leverage": 1.0,
+ "allowed_instruments": ["equity", "etf"],
+ "max_trades_per_day": 5,
+ },
+ "universe": {
+ # No EU bucket exists in the mandate AssetClass vocabulary (us/hk/cn/in
+ # equity, crypto, forex) — see the follow-up noted in the PR. Any
+ # valid bucket works here; the refusal under test happens earlier.
+ "asset_classes": ["us_etf"],
+ "min_market_cap_usd": None,
+ "min_avg_daily_volume_usd": None,
+ "exclude_symbols": [],
+ },
+ "consent": {
+ "created_at": created.isoformat(),
+ "consent_token_sha256": "deadbeef",
+ "broker": "scalable",
+ "account_ref": "acct_ref",
+ "expires_at": (created + timedelta(days=30)).isoformat(),
+ },
+ }
+ (broker / "mandate.json").write_text(json.dumps(payload), encoding="utf-8")