#20132: Add trading plugin for portfolio tracking and price quotes via Alpaca…
size: L
… Markets
Implements a channel-agnostic OpenClaw plugin with Alpaca Markets REST API provider and a mock provider for development. Registers agent tools (trading_portfolio, trading_price), auto-reply commands (/portfolio, /price), CLI subcommands, and a background service with lazy initialization.
## Summary
Describe the problem and fix in 2–5 bullets:
- Problem:
- Why it matters:
- What changed:
- What did NOT change (scope boundary):
## Change Type (select all)
- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Docs
- [ ] Security hardening
- [ ] Chore/infra
## Scope (select all touched areas)
- [ ] Gateway / orchestration
- [ ] Skills / tool execution
- [ ] Auth / tokens
- [ ] Memory / storage
- [ ] Integrations
- [ ] API / contracts
- [ ] UI / DX
- [ ] CI/CD / infra
## Linked Issue/PR
- Closes #
- Related #
## User-visible / Behavior Changes
List user-visible changes (including defaults/config).
If none, write `None`.
## Security Impact (required)
- New permissions/capabilities? (`Yes/No`)
- Secrets/tokens handling changed? (`Yes/No`)
- New/changed network calls? (`Yes/No`)
- Command/tool execution surface changed? (`Yes/No`)
- Data access scope changed? (`Yes/No`)
- If any `Yes`, explain risk + mitigation:
## Repro + Verification
### Environment
- OS:
- Runtime/container:
- Model/provider:
- Integration/channel (if any):
- Relevant config (redacted):
### Steps
1.
2.
3.
### Expected
-
### Actual
-
## Evidence
Attach at least one:
- [ ] Failing test/log before + passing after
- [ ] Trace/log snippets
- [ ] Screenshot/recording
- [ ] Perf numbers (if relevant)
## Human Verification (required)
What you personally verified (not just CI), and how:
- Verified scenarios:
- Edge cases checked:
- What you did **not** verify:
## Compatibility / Migration
- Backward compatible? (`Yes/No`)
- Config/env changes? (`Yes/No`)
- Migration needed? (`Yes/No`)
- If yes, exact upgrade steps:
## Failure Recovery (if this breaks)
- How to disable/revert this change quickly:
- Files/config to restore:
- Known bad symptoms reviewers should watch for:
## Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write `None`.
- Risk:
- Mitigation:
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds a new trading plugin (`extensions/trading/`) that provides portfolio tracking and price quotes via Alpaca Markets REST API, with a mock provider for development. Registers agent tools (`trading_portfolio`, `trading_price`), auto-reply commands (`/portfolio`, `/price`), CLI subcommands (`openclaw trading status|portfolio|price`), and a background service with lazy initialization.
- **Dead ternary in config parse**: `index.ts:27` has `enabled ? "mock" : "mock"` — both branches return the same value, so the user's provider selection may be silently overridden.
- **Version mismatch**: `package.json` uses version `0.1.0` while every other extension in the monorepo uses calver `2026.2.18`. This will break the coordinated release pipeline.
- **Crypto quotes show misleading zero change**: The Alpaca provider's `getQuote` only calculates change/changePercent for stocks (via snapshot), so crypto symbols always return `$0.00 (+0.00%)`.
- **No tests**: Most comparable extensions (bluebubbles, googlechat, line, llm-task, slack) include test files. This plugin has no tests.
- **PR template not filled out**: The description, security impact, repro steps, and verification sections are all empty.
<h3>Confidence Score: 2/5</h3>
- This PR has logic bugs and convention violations that should be fixed before merging.
- The dead ternary in the config parser is a logic bug that could cause unexpected behavior. The version mismatch breaks repo conventions. Crypto price quotes display misleading zero-change values. The empty PR template makes it hard to assess intent and testing status.
- `extensions/trading/index.ts` (dead ternary), `extensions/trading/package.json` (version mismatch), `extensions/trading/src/providers/alpaca.ts` (crypto change calculation)
<sub>Last reviewed commit: bfacf62</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
<!-- /greptile_comment -->
Most Similar PRs
#20927: feat(trading): add /buy and /sell order commands
by Sjeror11 · 2026-02-19
82.5%
#19787: feat: Antigravity Fork - Token Economy, Mem0, sqlite-vec, Auto-Arch...
by msrovani · 2026-02-18
73.0%
#19814: Codex/align delimiter parsing assertion with parser
by Johnsonbros · 2026-02-18
72.1%
#21223: elliott commit
by elliottamador · 2026-02-19
71.8%
#22260: feat(extensions/deltachat): add Delta.Chat channel extension
by alanz · 2026-02-20
71.6%
#21589: Post-Performance Roadmap: Milestones A–D (contracts, observability,...
by Doji-Hammer · 2026-02-20
70.9%
#14222: core: add needsApproval to before_tool_call; move AgentShield to ex...
by Eventedge · 2026-02-11
70.6%
#11048: fix: address repository issues (env, author, CI comments, security ...
by cavula · 2026-02-07
70.6%
#2556: fix(plugin-install): handle existing plugins and filter workspace deps
by longmaba · 2026-01-27
70.5%
#20499: test(plugins): add bundled+config duplicate discovery regression
by dcol91863 · 2026-02-19
70.3%