Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c212708
feat: add unified trading types — Contract, ITradingAccount, AccountM…
luokerenx4 Mar 4, 2026
1617663
feat: add unified guard pipeline — merge crypto + securities guards
luokerenx4 Mar 4, 2026
9dc0c18
feat: unified trading architecture — provider adapters, tool factory,…
luokerenx4 Mar 4, 2026
0dd198b
feat: add test coverage, fix CCXT bug, merge frontend trading UI
luokerenx4 Mar 4, 2026
3711012
feat: unified multi-account tool routing with source parameter
luokerenx4 Mar 4, 2026
28b28e9
refactor: rename wallet* to trading*, make commit/push/sync source op…
luokerenx4 Mar 4, 2026
631c69a
feat: aggregate getQuote across all accounts
luokerenx4 Mar 4, 2026
63c4edb
feat: add read-only mode to CcxtAccount for keyless market data access
luokerenx4 Mar 4, 2026
035a2f8
refactor: provider tool injection + slim AccountCapabilities
luokerenx4 Mar 4, 2026
d0cce9a
refactor: remove adjustLeverage and leverage from OrderRequest
luokerenx4 Mar 4, 2026
9efb81d
refactor: IBKR-aligned OrderRequest + modifyOrder + dead code cleanup
luokerenx4 Mar 4, 2026
d2aa4af
refactor: split resolveContract into searchContracts + getContractDet…
luokerenx4 Mar 5, 2026
0b9889a
chore: remove trading-archived, fix stale MaxLeverageGuard export, re…
luokerenx4 Mar 5, 2026
a97d30d
fix: clarify searchContracts/getContractDetails tool descriptions
luokerenx4 Mar 5, 2026
120a499
refactor: unify equitySearch + cryptoSearch + currencySearch into mar…
luokerenx4 Mar 5, 2026
69f1913
fix: update stale equitySearch/cryptoSearch references in tool descri…
luokerenx4 Mar 5, 2026
dd470f2
fix: soften marketSearchForResearch description to avoid mandatory pr…
luokerenx4 Mar 5, 2026
564643a
merge: unified trading architecture + AGPL-3.0 relicense
luokerenx4 Mar 5, 2026
a3f82f1
chore: bump hono 4.12.5, @hono/node-server 1.19.11 (security fixes)
luokerenx4 Mar 5, 2026
7138b7c
docs: update README for unified trading architecture and AGPL-3.0
luokerenx4 Mar 5, 2026
4dee6a7
feat: introduce Platform layer for multi-account trading
luokerenx4 Mar 5, 2026
d7b20f1
fix: seed platforms.json + accounts.json to disk on legacy migration
luokerenx4 Mar 5, 2026
884fed9
chore: change default CCXT exchange from bybit to binance
luokerenx4 Mar 5, 2026
b4013df
chore: mark migration code for removal before v1.0
luokerenx4 Mar 5, 2026
552aa45
feat: trading config CRUD API + table/panel UI redesign
luokerenx4 Mar 5, 2026
b77489e
refactor: merge platform into account flow in TradingPage
luokerenx4 Mar 5, 2026
bf943db
refactor: replace slide panel with centered modal dialogs
luokerenx4 Mar 5, 2026
5ef997c
feat: Alpaca realized PnL via FILL activities + Portfolio page redesign
luokerenx4 Mar 5, 2026
e5efb77
fix: sequential loadMarkets with per-type retries for CCXT
luokerenx4 Mar 5, 2026
9475fd9
feat: add React Router for URL-based navigation
luokerenx4 Mar 5, 2026
6ef1c36
refactor: split CcxtAccount into smaller modules
luokerenx4 Mar 5, 2026
1a13c0f
refactor: split AlpacaAccount into smaller modules
luokerenx4 Mar 5, 2026
88d8bb0
fix: add init retry with exponential backoff for AlpacaAccount
luokerenx4 Mar 5, 2026
baf5e76
fix: enforce aliceId as required contract identifier for trading tools
luokerenx4 Mar 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
682 changes: 661 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

45 changes: 18 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ Your one-person Wall Street. Alice is an AI trading agent that gives you your ow
## Features

- **Dual AI provider** — switch between Claude Code CLI and Vercel AI SDK at runtime, no restart needed
- **Crypto trading** — CCXT-based execution (Bybit, OKX, Binance, etc.) with a git-like wallet (stage, commit, push)
- **Securities trading** — Alpaca integration for US equities with the same wallet workflow
- **Guard pipeline** — extensible pre-execution safety checks for both crypto and securities (max position size, max leverage, cooldown between trades)
- **Market data** — OpenBB-powered equity, crypto, commodity, and currency data layers with symbol search and technical indicator calculator
- **Unified trading** — multi-account architecture supporting CCXT (Bybit, OKX, Binance, etc.) and Alpaca (US equities) with a git-like workflow (stage, commit, push)
- **Guard pipeline** — extensible pre-execution safety checks (max position size, cooldown between trades, symbol whitelist)
- **Market data** — OpenBB-powered equity, crypto, commodity, and currency data layers with unified symbol search (`marketSearchForResearch`) and technical indicator calculator
- **Equity research** — company profiles, financial statements, ratios, analyst estimates, earnings calendar, insider trading, and market movers (top gainers, losers, most active)
- **News collector** — background RSS collection from configurable feeds with archive search tools (`globNews`/`grepNews`/`readNews`). Also captures OpenBB news API results via piggyback
- **Cognitive state** — persistent "brain" with frontal lobe memory, emotion tracking, and commit history
Expand All @@ -34,11 +33,11 @@ Your one-person Wall Street. Alice is an AI trading agent that gives you your ow

**Provider** — The AI backend that powers Alice. Claude Code (subprocess) or Vercel AI SDK (in-process). Switchable at runtime via `ai-provider.json`.

**Extension** — A self-contained tool package registered in ToolCenter. Each extension owns its tools, state, and persistence. Examples: crypto-trading, brain, analysis-kit.
**Extension** — A self-contained tool package registered in ToolCenter. Each extension owns its tools, state, and persistence. Examples: trading, brain, analysis-kit.

**Wallet** — A git-like workflow for trading operations. You stage orders, commit with a message, then push to execute. Every commit gets an 8-char hash. Full history is reviewable via `walletLog` / `walletShow`.
**Trading** — A git-like workflow for trading operations. You stage orders, commit with a message, then push to execute. Every commit gets an 8-char hash. Full history is reviewable via `tradingLog` / `tradingShow`.

**Guard** — A pre-execution check that runs before every trading operation reaches the exchange. Guards enforce limits (max position size, max leverage, cooldown between trades) and can be configured per-asset.
**Guard** — A pre-execution check that runs before every trading operation reaches the exchange. Guards enforce limits (max position size, cooldown between trades, symbol whitelist) and can be configured per-asset.

**Connector** — An external interface through which users interact with Alice. Built-in: Web UI, Telegram, MCP Ask. Connectors register with the ConnectorRegistry; delivery always goes to the channel of last interaction.

Expand Down Expand Up @@ -72,8 +71,7 @@ graph LR
subgraph Extensions
OBB[OpenBB Data]
AK[Analysis Kit]
CT[Crypto Trading]
ST[Securities Trading]
TR[Trading]
GD[Guards]
NC[News Collector]
BR[Brain]
Expand Down Expand Up @@ -102,10 +100,8 @@ graph LR
OBB --> AK
OBB --> NC
AK --> TC
CT --> TC
ST --> TC
GD --> CT
GD --> ST
TR --> TC
GD --> TR
NC --> TC
BR --> TC
BW --> TC
Expand All @@ -124,7 +120,7 @@ graph LR

**Core** — `Engine` is a thin facade that delegates to `AgentCenter`, which routes all calls (both stateless and session-aware) through `ProviderRouter`. `ToolCenter` is a centralized tool registry — extensions register tools there, and it exports them in Vercel AI SDK and MCP formats. `EventLog` provides persistent append-only event storage (JSONL) with real-time subscriptions and crash recovery. `ConnectorRegistry` tracks which channel the user last spoke through.

**Extensions** — domain-specific tool sets registered in `ToolCenter`. Each extension owns its tools, state, and persistence. `Guards` enforce pre-execution safety checks (position size limits, leverage caps, trade cooldowns) on both crypto and securities operations. `NewsCollector` runs background RSS fetches and piggybacks OpenBB news calls into a persistent archive searchable by the agent.
**Extensions** — domain-specific tool sets registered in `ToolCenter`. Each extension owns its tools, state, and persistence. `Guards` enforce pre-execution safety checks (position size limits, trade cooldowns, symbol whitelist) on all trading operations. `NewsCollector` runs background RSS fetches and piggybacks OpenBB news calls into a persistent archive searchable by the agent.

**Tasks** — scheduled background work. `CronEngine` manages jobs and fires `cron.fire` events into the EventLog on schedule; a listener picks them up, runs them through the AI engine, and delivers replies via the ConnectorRegistry. `Heartbeat` is a periodic health-check that uses a structured response protocol (HEARTBEAT_OK / CHAT_NO / CHAT_YES).

Expand Down Expand Up @@ -158,9 +154,7 @@ All config lives in `data/config/` as JSON files with Zod validation. Missing fi

**AI Provider** — The default provider is Claude Code (`claude -p` subprocess). To use the [Vercel AI SDK](https://sdk.vercel.ai/docs) instead (Anthropic, OpenAI, Google, etc.), switch `ai-provider.json` to `vercel-ai-sdk` and add your API key to `api-keys.json`.

**Crypto Trading** — Powered by [CCXT](https://docs.ccxt.com/). Configure exchange and API keys in `crypto.json`. Any CCXT-supported exchange works (Bybit, OKX, Binance, etc.).

**Securities Trading** — Powered by [Alpaca](https://alpaca.markets/). Configure broker and API keys in `securities.json`. Supports paper and live trading.
**Trading** — Multi-account architecture. Crypto via [CCXT](https://docs.ccxt.com/) (Bybit, OKX, Binance, etc.) configured in `crypto.json`. US equities via [Alpaca](https://alpaca.markets/) configured in `securities.json`. Both use the same git-like trading workflow.

| File | Purpose |
|------|---------|
Expand All @@ -169,8 +163,8 @@ All config lives in `data/config/` as JSON files with Zod validation. Missing fi
| `agent.json` | Max agent steps, evolution mode toggle, Claude Code tool permissions |
| `ai-provider.json` | Active AI provider (`vercel-ai-sdk` or `claude-code`), switchable at runtime |
| `api-keys.json` | AI provider API keys (Anthropic, OpenAI, Google) — only needed for Vercel AI SDK mode |
| `crypto.json` | Allowed symbols, CCXT exchange config + API keys, demo trading flag, guards |
| `securities.json` | Allowed symbols, Alpaca broker config + API keys, paper trading flag, guards |
| `crypto.json` | CCXT exchange config + API keys, allowed symbols, guards |
| `securities.json` | Alpaca broker config + API keys, allowed symbols, guards |
| `connectors.json` | Web/MCP server ports, Telegram bot credentials + enable, MCP Ask enable |
| `openbb.json` | OpenBB API URL, per-asset-class data providers, provider API keys |
| `news-collector.json` | RSS feeds, fetch interval, retention period, OpenBB piggyback toggle |
Expand Down Expand Up @@ -209,13 +203,11 @@ src/
vercel-ai-sdk/ # Vercel AI SDK ToolLoopAgent wrapper
extension/
analysis-kit/ # Indicator calculator and market data tools
equity/ # Equity search, fundamentals, and data adapter
crypto/ # Crypto search and data adapter
currency/ # Currency search and data adapter
equity/ # Equity fundamentals and data adapter
market/ # Unified symbol search across equity, crypto, currency
news/ # OpenBB news tools (world + company headlines)
news-collector/ # RSS collector, piggyback wrapper, archive search tools
crypto-trading/ # CCXT integration, wallet, guard pipeline, tools
securities-trading/ # Alpaca integration, wallet, guard pipeline, tools
trading/ # Unified multi-account trading (CCXT + Alpaca), guard pipeline, git-like commit history
thinking-kit/ # Reasoning and calculation tools
brain/ # Cognitive state (memory, emotion)
browser/ # Browser automation bridge (via OpenClaw)
Expand Down Expand Up @@ -244,8 +236,7 @@ data/
sessions/ # JSONL conversation histories
brain/ # Agent memory and emotion logs
cache/ # API response caches
crypto-trading/ # Crypto wallet commit history
securities-trading/ # Securities wallet commit history
trading/ # Trading commit history (per-account)
news-collector/ # Persistent news archive (JSONL)
cron/ # Cron job definitions (jobs.json)
event-log/ # Persistent event log (events.jsonl)
Expand All @@ -258,4 +249,4 @@ docs/ # Architecture documentation

## License

[MIT](LICENSE)
[AGPL-3.0](LICENSE)
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"file-driven"
],
"author": "Open Alice Contributors",
"license": "MIT",
"license": "AGPL-3.0-only",
"repository": {
"type": "git",
"url": "git+https://github.com/TraderAlice/OpenAlice.git"
Expand All @@ -33,7 +33,7 @@
"@ai-sdk/openai": "^3.0.30",
"@alpacahq/alpaca-trade-api": "^3.1.3",
"@grammyjs/auto-retry": "^2.0.2",
"@hono/node-server": "^1.19.9",
"@hono/node-server": "^1.19.11",
"@modelcontextprotocol/sdk": "^1.26.0",
"@sinclair/typebox": "0.34.48",
"ai": "^6.0.86",
Expand All @@ -44,7 +44,7 @@
"express": "^5.2.1",
"file-type": "^21.3.0",
"grammy": "^1.40.0",
"hono": "^4.11.9",
"hono": "^4.12.5",
"json5": "^2.2.3",
"pino": "^10.3.1",
"playwright-core": "1.58.2",
Expand Down
26 changes: 13 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 0 additions & 77 deletions src/connectors/web/routes/crypto.ts

This file was deleted.

Loading