Skip to content
SlashClone
Made by@qtrader

Alpaca connector

@qtrader/alpaca-connector

Talk to Alpaca from Claude Code: account, positions, orders (list, place, cancel), latest quote, and historical bars to CSV, using Node's built-in fetch. Paper trading by default. Live orders need ALPACA_LIVE=1 plus your yes in chat for each order. Not financial advice.

SkillTradingv1.0.0 (latest)Tested
Activity
New: be the first to try it
  1. 1{
  2. 2 "name": "alpaca-connector",
  3. 3 "owner": "qtrader",
  4. 4 "version": "1.0.0",
  5. 5 "type": "skill",
  6. 6 "description": "Talk to Alpaca from Claude Code: account, positions, orders (list, place, cancel), latest quote, and historical bars to CSV, using Node's built-in fetch. Paper trading by default. Live orders need ALPACA_LIVE=1 plus your yes in chat for each order. Not financial advice.",
  7. 7 "category": "trading",
  8. 8 "license": "MIT",
  9. 9 "compat": ["claude-code"],
  10. 10 "permissions": {
  11. 11 "shell": ["node scripts/alpaca.mjs", "node scripts/selftest.mjs"],
  12. 12 "network": ["paper-api.alpaca.markets", "api.alpaca.markets", "data.alpaca.markets"],
  13. 13 "files": { "read": ["./data/**"], "write": ["./data/**", "./out/**"] },
  14. 14 "env": ["ALPACA_API_KEY_ID", "ALPACA_API_SECRET_KEY", "ALPACA_LIVE"]
  15. 15 },
  16. 16 "tests": {
  17. 17 "cases": [
  18. 18 {
  19. 19 "name": "parsing, request building, live gating, and bars paging work offline",
  20. 20 "inputs": {},
  21. 21 "checks": [{ "type": "command_exits_zero", "command": "node scripts/selftest.mjs" }]
  22. 22 },
  23. 23 {
  24. 24 "name": "dry run prints a paper order without any secret",
  25. 25 "inputs": {},
  26. 26 "checks": [
  27. 27 {
  28. 28 "type": "command_exits_zero",
  29. 29 "command": "node scripts/alpaca.mjs place --symbol aapl --side buy --qty 5 --type limit --limit-price 190.25 --dry-run --out out/request.json"
  30. 30 },
  31. 31 {
  32. 32 "type": "output_matches_schema",
  33. 33 "path": "out/request.json",
  34. 34 "schema": {
  35. 35 "type": "object",
  36. 36 "required": ["dry_run", "mode", "method", "url", "headers", "body"],
  37. 37 "properties": {
  38. 38 "dry_run": { "const": true },
  39. 39 "mode": { "const": "paper" },
  40. 40 "method": { "const": "POST" },
  41. 41 "url": { "const": "https://paper-api.alpaca.markets/v2/orders" },
  42. 42 "body": {
  43. 43 "type": "object",
  44. 44 "required": ["symbol", "side", "type", "time_in_force", "qty", "limit_price"],
  45. 45 "properties": { "symbol": { "const": "AAPL" }, "qty": { "const": "5" }, "limit_price": { "const": "190.25" } }
  46. 46 }
  47. 47 }
  48. 48 }
  49. 49 },
  50. 50 { "type": "file_contains", "path": "out/request.json", "text": "<missing ALPACA_API_SECRET_KEY>" }
  51. 51 ]
  52. 52 },
  53. 53 {
  54. 54 "name": "dry run builds a paged daily bars request on the data host",
  55. 55 "inputs": {},
  56. 56 "checks": [
  57. 57 {
  58. 58 "type": "command_exits_zero",
  59. 59 "command": "node scripts/alpaca.mjs bars --symbol SPY --timeframe 1Day --start 2025-01-01 --end 2025-12-31 --dry-run --out out/bars-request.json"
  60. 60 },
  61. 61 {
  62. 62 "type": "file_contains",
  63. 63 "path": "out/bars-request.json",
  64. 64 "text": "https://data.alpaca.markets/v2/stocks/SPY/bars?timeframe=1Day&start=2025-01-01&end=2025-12-31&adjustment=all&feed=iex&limit=10000&sort=asc"
  65. 65 }
  66. 66 ]
  67. 67 }
  68. 68 ]
  69. 69 }