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 and not in your repo. This is how to hand that to Codex or Claude Code.

Lee, who builds MyLinedChart

Author: Lee H., from Little Bird Trading

Created AUGUST 5, 2026 | Last updated AUGUST 5, 2026

  • Topic: using Codex Claude Code with Alpaca chart data
  • Audience: Alpaca users, Codex users, Claude Code users, Traders who already write code
Trade AutomationAlpaca usersCodex usersClaude Code usersusing Codex Claude Code with Alpaca…

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 is 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. You are usually not asking the agent to build something from scratch. You are asking it 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.

The environment line matters more here than it does on other brokers.
StepWhat to ProvideHuman Control
ExportStructured Alpaca chart context from MyLinedChartConfirm the bars match what you were looking at
DeclarePaper or live, and IEX or SIPCatch the mismatch before the agent explains it away
PromptOne task for Codex or Claude CodeReject output that assumes data you did not supply
ReviewParser, backtest scaffold, journal schema, or QA checklistKeep 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.

That gap is almost never a code problem. The code is the part that got written down. The reasoning is the part that did not. A trend line you drew and a comment that says the same thing are not equivalent, because the trend line has real dates and prices attached to it and the comment does not.

So the useful handoff for an Alpaca user is not chart to code. It 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.

Reconciliation is the request that pays off most often here, because the two halves genuinely drifted.
Prompt PartCodex Instruction
ContextThis is an Alpaca chart export from MyLinedChart, plus the strategy file it relates to
EnvironmentPaper or live, IEX or SIP, bar size, and whether bars are adjusted
TaskReconcile, parse, scaffold a test, or draft a schema
ConstraintNo trade recommendations, no invented fields, no assuming a feed I did not name
Review OutputDiscrepancies, 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. It 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.

The output you want is a diff between your chart and your repo, not a rewrite of either.
Prompt PartClaude Code Instruction
ContextChart export plus the strategy it is meant to describe
TaskRead both, report where they disagree
BoundaryFlag ambiguity rather than resolving it
ConstraintNo verdict on whether the strategy is sound
Review OutputA 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.

Feed and adjustment are the two that quietly break comparisons across months.
FieldWhy the Agent Needs It
Symbol and asset classAlpaca serves equities and crypto, and they do not share a session calendar
EnvironmentPaper and live can return different fills and different account state
Data feedIEX is a single venue, SIP is consolidated, and their bars will not match
Bar size and sessionWhether extended hours are included changes highs, lows and volume
Adjusted or rawA split makes a level from last year meaningless if the two sides disagree
Drawing timestampsA level is only checkable if it carries the date and price you set it at
Note textThe reason you drew it, which is the part no other field encodes

Paper, Live, and Which Feed You Are On

This 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. It will sound reasonable. 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 real decision.

  • Does the export's symbol, feed, environment and bar size match what you actually had open?
  • Did the agent state its assumptions separately, or bury them in the explanation?
  • Did it invent a field, a level, or a date that is not in what you supplied?
  • Does anything it produced amount to an entry or exit call, and if so, is it discarded?
  • If it reported no discrepancies at all, did it actually read both inputs?

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 Codex vs Claude Code for IBKR Chart Data Workflows if you are deciding between the two tools.

What Not to Ask

The failure mode is not that the agent refuses. It is that it answers anyway, fluently, from data that cannot support the answer.

Every row here returns a confident answer. That is what makes them dangerous.
Do Not AskWhy It Fails
Should I take this tradeNothing in a chart export encodes your risk, your size, or your account
Build me a profitable strategyThe export describes what you drew, not what worked
Why did this level holdIt will produce a narrative, and a narrative is not evidence
Optimize these parametersOn one symbol and one export this is curve fitting with extra steps
Is my edge realThat question needs many samples and an out-of-sample test, not 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. That is a difference from Interactive Brokers, where 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. It is a narrow, checkable job, and the answer is usually more interesting than people expect.

Will the AI place trades on my Alpaca account?

Not through MyLinedChart. 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.

Related Articles

More Video Guides