Article
Using Codex or Claude Code With Alpaca Chart Data
Alpaca users usually already have code. The missing input is chart context: the levels, notes and drawings that live in your head instead of your repo. This guide shows how to hand that context to Codex or Claude Code.
Most guides about AI and broker data assume you are starting from nothing. Alpaca users rarely are. If you chose Alpaca you probably already have a repo, a paper account, and an agent you talk to every day. What your agent does not have is the part of your analysis that never made it into code: the level you keep redrawing, the note explaining why you skipped a setup, the zone you drew three months ago that price just came back to. This guide shows how to get that context out of the chart and into Codex or Claude Code without turning it into a screenshot.
Alpaca Codex Workflow: Quick Start
The workflow is the same shape as any good handoff to an agent: one structured export, one narrow request, one human review before anything runs. What changes for Alpaca is where you start. Usually you are asking the agent to reconcile code you already wrote against analysis you never wrote down.
Export the chart context, state the environment and feed, give the agent one job, then check the output before it touches an account.
| Step | What to Provide | Human Control |
|---|---|---|
| Export | Structured Alpaca chart context from MyLinedChart | Confirm the bars match what you were looking at |
| Declare | Paper or live, and IEX or SIP | Catch the mismatch before the agent explains it away |
| Prompt | One task for Codex or Claude Code | Reject output that assumes data you did not supply |
| Review | Parser, backtest scaffold, journal schema, or QA checklist | Keep entry and exit decisions outside the AI output |
Why Alpaca Users Start From a Different Place
Ask an Alpaca user what they need and they rarely say they want an AI to read a chart. They say their backtest disagrees with what they remember seeing, or that they cannot explain to themselves why a rule that looked obvious in June stopped working in August.
The gap between the backtest and your memory is almost never a code problem. The code is the part that got written down. The reasoning never got written down. A trend line you drew and a comment that says the same thing are not equivalent, because the trend line has dates and prices attached to it and the comment does not.
So the useful handoff for an Alpaca user is chart to context, then context alongside the code you already have.
- You have a strategy in a repo and levels in your head, and only one of them is reviewable.
- Your backtest uses adjusted bars and your chart does not, or the reverse, and nothing in either file says so.
- You changed a rule after a bad week and the reason exists only in your memory.
Prompt for Codex With Alpaca Chart Data
Use Codex when you want implementation help around records you can show it. Name the source, describe the fields, ask for one output, and tell it what it may not assume.
Example prompt: Here is a sanitized MyLinedChart export from my Alpaca chart, paper account, IEX feed, 15 minute bars. Here is the strategy file it is supposed to correspond to. Identify every level in the export that has no equivalent in the code, and every constant in the code that has no equivalent on the chart. Do not tell me which is correct. List the discrepancies and what you would need to resolve each one.
| Prompt Part | Codex Instruction |
|---|---|
| Context | This is an Alpaca chart export from MyLinedChart, plus the strategy file it relates to |
| Environment | Paper or live, IEX or SIP, bar size, and whether bars are adjusted |
| Task | Reconcile, parse, scaffold a test, or draft a schema |
| Constraint | No trade recommendations, no invented fields, no assuming a feed I did not name |
| Review Output | Discrepancies, assumptions, and the tests a human should run |
Prompt for Claude Code With Alpaca Chart Data
Use Claude Code when the job is a review or a documentation pass rather than a single artifact. Claude Code is good at reading an export and a repo together and telling you what the repo assumes that the export does not support.
Example prompt: Review this MyLinedChart export from my Alpaca chart against the attached strategy. Summarize what the drawings say the setup requires. Then list every requirement the code enforces that the drawings do not mention, and every requirement the drawings imply that the code does not enforce. Flag anything ambiguous instead of resolving it. Do not judge whether the strategy is good.
| Prompt Part | Claude Code Instruction |
|---|---|
| Context | Chart export plus the strategy it is meant to describe |
| Task | Read both, report where they disagree |
| Boundary | Flag ambiguity rather than resolving it |
| Constraint | No verdict on whether the strategy is sound |
| Review Output | A written diff between what you drew and what you coded |
Alpaca Chart Data Fields AI Needs
An agent cannot infer any of this from the bars. Every field below changes how the same numbers should be read, and leaving one out is how you get an answer that is confidently wrong.
| Field | Why the Agent Needs It |
|---|---|
| Symbol and asset class | Alpaca serves equities and crypto, and they do not share a session calendar |
| Environment | Paper and live can return different fills and different account state |
| Data feed | IEX is a single venue, SIP is consolidated, and their bars will not match |
| Bar size and session | Whether extended hours are included changes highs, lows and volume |
| Adjusted or raw | A split makes a level from last year meaningless if the two sides disagree |
| Drawing timestamps | A level is only checkable if it carries the date and price you set it at |
| Note text | The reason you drew it, which is the part no other field encodes |
Paper, Live, and Which Feed You Are On
The feed you are on is the trap specific to Alpaca, and it is worth its own section because the failure is silent. Alpaca's free market data is IEX, a single venue with partial volume. The consolidated SIP feed is a paid subscription. Both return bars. Neither labels itself in a way an agent will notice.
So a level that looks respected on IEX bars may sit in the middle of nothing on SIP bars, and an agent handed both without being told will explain the difference as market behaviour rather than as two different datasets. The explanation will sound reasonable, and it will be wrong.
Say which feed produced the export, every time. The same applies to paper versus live: paper is excellent for wiring up a workflow, and it is not a source of truth about fills.
- IEX volume is a fraction of consolidated volume, so volume-based rules do not transfer between feeds.
- A backtest on one feed and a chart on the other will disagree, and the disagreement is not a bug.
- Paper fills are simulated, so anything an agent concludes about slippage from paper data is fiction.
Human Review Checklist
Run this before any agent output influences a live decision.
Where MyLinedChart Fits
MyLinedChart is the part that turns the chart into something an agent can read. Connect your Alpaca account with your own keys, draw the way you already draw, and export the whole chart as XLSX, CSV or JSON with drawings, notes, indicator values and bars carried out together with the numbers attached.
Alpaca connects natively, with no separate bridge process running beside the app, which is one fewer moving part than a broker that requires a local gateway. Your keys are stored on your device and are sent only to Alpaca.
You can also hand the live chart to an agent directly. See Using Codex or Claude Code With IBKR Chart Data for the IBKR equivalent of this workflow, and Using Codex or Claude Code With IBKR Chart Data if you are deciding between the two tools.
What Not to Ask
The failure mode is an agent that answers anyway, fluently, from data that cannot support the answer.
| Do Not Ask | Why It Fails |
|---|---|
| Should I take this trade | Nothing in a chart export encodes your risk, your size, or your account |
| Build me a profitable strategy | The export records what you drew and says nothing about what worked |
| Why did this level hold | The agent will produce a narrative, and a narrative proves nothing |
| Optimize these parameters | On one symbol and one export this is curve fitting with extra steps |
| Does my edge hold up | Proving edge needs many samples and an out-of-sample test, far more than one chart |
Next Step
Export one chart from your Alpaca account with the levels you actually trade on it, and hand it to your agent alongside the strategy file it is supposed to match. Ask only for the diff. Most people find at least one rule they enforce in code that they stopped believing on the chart months ago.
Connect your AI at MCP toolkit, or start a trial at Pricing.
FAQ
Do I need to run anything locally to use Alpaca with MyLinedChart?
No. Alpaca connects natively over its API with your own keys, so there is no separate bridge or gateway process to keep running beside the app. Interactive Brokers works differently: reading from TWS or IB Gateway requires the local Connector.
Does it matter whether I am on Alpaca's IEX or SIP feed?
Yes, more than most people expect. IEX is a single venue with partial volume and SIP is consolidated, so the same symbol and timeframe will produce different bars, different highs and lows, and very different volume. Always tell the AI which feed the export came from, because it cannot tell from the numbers and will explain the gap as market behaviour instead.
Can I use a paper account for this?
Yes, and it is a good way to wire up the workflow. Just do not let an agent draw conclusions about fills or slippage from paper data, because those fills are simulated.
What should I actually ask Codex or Claude Code for?
The request that pays off most often is a reconciliation: give it the chart export and the strategy file, and ask which levels exist on the chart but not in the code, and which constants exist in the code but not on the chart. A reconciliation is a narrow, checkable job, and the answer is usually more interesting than people expect.
Will the AI place trades on my Alpaca account?
MyLinedChart cannot place trades. The app is read only: it reads chart data and marks it up, and never places, modifies or cancels an order. Anything an agent produces here is analysis and code for you to review.
Sample Structured Chart-Data Exports
Review how chart drawings, annotations, OHLC, volume, and execution context become reusable structured data.

