HALFSPREAD
loading Alpaca paper equity github

The exit is where the money dies.

Every premium-selling agent opens a position and later closes it. That second trade is where the money goes, and almost nobody prices it. This agent measures what execution costs before every order, then declines to pay it twice.

liveOne contract, quoted twice

Waiting for quotes.

Price a trade yourself

This is the desk's own engine, not a description of it. Pick any name it watches, then a strike and a width against the live chain, and it runs the same arithmetic and the same gates the agent applied to its own orders, in your browser. It will tell you what a trade really costs to enter, what leaving it would cost right now, and which gate rejects it. Most combinations are rejected. That is the point of it.

The first three names are what this desk trades. The rest are watched and published so the same measurement can be run on tickers people actually hold. Nothing outside the traded three can be ordered by the agent.

The ledger

Every figure is derived from the append-only journal committed in this repository. The page computes nothing of its own, so it cannot drift from the record.

How one decision is made

The same ten steps run every cycle, and every one of them is journalled, including the ones that end without an order.

Where the model sits

A language model occupies exactly one node of this system, and its authority runs one way. It can make a position smaller. It cannot make one, enlarge one, choose a strike, or overrule a gate, and the clamp is enforced in code rather than requested in a prompt. If it is unreachable the deterministic decision stands.

We do not trust a language model with money. We give it the one job humans are worst at automating: reading unstructured event risk off the wire.

Against the usual shape

Most agents in this field optimise the signal. This one optimises what the trade actually costs.

Relative cost rises as strikes move out of the money

Half the bid-ask, as a share of the option's mid price. The strike a delta screen reaches for is the expensive one. Log scale, because the cost spans nearly two decades.

live

The claim is about time

Entry and exit spreads are identical at any single instant, so the cost of leaving is a statement about when you leave. These are the same strikes re-quoted through the session.

live

What it costs to cross, right now, by name

Every name this desk watches, measured at the same moment and sorted by cost. The hours column is the whole explanation: this is not a story about index options being worse than single names, it is a story about proximity to expiry.

live

Breach probability, counted rather than assumed

Black-Scholes assumes lognormal returns. Measured sessions are not: the downside tail runs well past what the deviation implies, and the move still left in a session collapses through the day. Sizing takes the worse of the two.

Check it without asking us

Every claim on this page is re-derived from the committed journal by python -m agent.verify. No API key, no account, no network. It runs in continuous integration on each push and fails the build if a number stops reproducing.

What this is built on

Four results shape the design. Two of them argue against trading at all, which is why this desk is sized to survive rather than to produce a headline.

    The stack

    Standard library Python, no dependencies, and nothing running on a server. The Alpaca CLI is the agent's hands: every order is a recorded, replayable invocation.

    Point it at your own account

    The desk speaks MCP, so you can ask it questions in plain English from Claude Desktop, Claude Code or Cursor, against your own Alpaca paper account. Your keys stay on your machine and never touch anything of ours. Read-only is enforced by a proxy, not promised: eleven of the thirty-five tools the upstream server exposes are stripped before your client ever sees them.

    1

    Get the code

    git clone https://github.com/ahammadshawki8/halfspread
    2

    Export your Alpaca paper keys

    export ALPACA_COMP_API_KEY=... ALPACA_COMP_SECRET_KEY=...

    Paper keys, from the Alpaca dashboard. Nothing is sent anywhere except Alpaca.

    3

    Add the server to your client

    claude mcp add halfspread -- python -m agent.mcp_readonly

    Cursor and Claude Desktop read the same shape from .mcp.json, which ships in the repository.

    4

    Ask it something

    "What is open on my paper account, and what would it cost me to close it right now?" Then check what it refused to do:

    python -m agent.mcp_readonly --audit

    Prefer not to connect anything? Everything above is also available without an account: python -m agent.scan --curve prices the whole chain read-only, and python -m agent.verify re-derives every number on this page from the committed journal with no keys at all.

    Decisions

    Fills, refusals, risk reviews and corrections in one stream. A decision not to trade is logged with the same weight as a trade.

    TimeType WhatDetail