Connect Alpaca
For agents
- Lets you: Explain how stock legs reach the user's Alpaca account.
- Tools:
pods_fund - Limit: No tool connects or disconnects Alpaca.
- Limit: Live stock legs are long only.
Connect
- Start the connection for
paperorlive. - Alpaca asks you to approve Lyra (scopes: trading, data).
- Alpaca sends you back to Lyra, which finishes the connection.
- One connection per mode. Disconnect drops the token.
API:
POST /api/v2/alpaca/connect {"env": "paper"}
POST /api/v2/alpaca/finish {"code": "...", "state": "..."}
DELETE /api/v2/alpaca/connections/paper
Rules
- Paper connects to Alpaca paper; Live to your Alpaca live account.
- Shorts: paper only; refused on live.
- Shorts need Alpaca to mark the name shortable and easy to borrow; whole shares.
- Fractional shares for longs.
- Outside market hours, orders stay queued until they fill.
Revoked or expired
- If Alpaca rejects the token, the connection is marked revoked once.
- You get one notice from the Risk Agent.
- Positions stay where they are. Nothing is sold for you.
Reconcile
- On connect and once a day, Lyra reads your Alpaca account.
- It books fills Alpaca made that its ledger missed.
- It reports shares it does not hold.
- It never places an order while reconciling.