AgentSkillsCN

alpaca-paper

在Alpaca平台上执行纸面交易与实盘交易时,严格把控风险,适时停止自动化操作,并采用兼顾摩擦成本的精细化规划策略。

SKILL.md
--- frontmatter
name: alpaca-paper
description: Execute paper/live trades on Alpaca with strict risk controls, stop automation, and friction-aware planning.
metadata: {"openclaw":{"emoji":"🏦","requires":{"env":["APCA_API_KEY_ID","APCA_API_SECRET_KEY","APCA_API_BASE_URL"],"bins":["python3"]}}}

Alpaca Trading + Stop Management

Order Execution

bash
${OPENCLAW_HOME:-$HOME/.openclaw}/tools/alpaca/execute_or_queue.sh \
  --symbol NVDA --side buy --qty 10 --type market

Market Data

bash
python3 ${OPENCLAW_HOME:-$HOME/.openclaw}/tools/alpaca/market_data.py snapshot --symbol NVDA
python3 ${OPENCLAW_HOME:-$HOME/.openclaw}/tools/alpaca/market_data.py movers --top 20
python3 ${OPENCLAW_HOME:-$HOME/.openclaw}/tools/alpaca/market_data.py actives --by volume --top 20

Stop Automation (mandatory after fill)

Move stop to breakeven:

bash
${OPENCLAW_HOME:-$HOME/.openclaw}/tools/alpaca/stop_manager.sh \
  move-stop-entry --symbol NVDA --offset-bps 5 --replace

Protect % of profits:

bash
${OPENCLAW_HOME:-$HOME/.openclaw}/tools/alpaca/stop_manager.sh \
  protect-profit --symbol NVDA --protect-pct 50 --min-gain-pct 0.30 --replace

Dry-run safety check:

bash
${OPENCLAW_HOME:-$HOME/.openclaw}/tools/alpaca/stop_manager.sh \
  protect-profit --symbol NVDA --protect-pct 60 --dry-run

Rules

  • Never hold a position without a stop.
  • After first favorable move, move stop to entry + small buffer.
  • As unrealized gain increases, trail by locking 40-70% of gains.
  • For long positions use sell-stops; for short positions use buy-stops.
  • Always --replace old open stops when upgrading protection.
  • Default TIF: gtc for persistent protection.

Allowed Structures

  • Long equity
  • Short equity
  • Long calls / long puts
  • Defined-risk option spreads

Friction and Edge Gate

Before order send, estimate spread + slippage + fees. Trade only if net expected edge remains positive after friction.