[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-81046":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":42,"readmeContent":43,"aiSummary":44,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":45,"discoverSource":46},81046,"OptionsCanvas","calesthio\u002FOptionsCanvas","calesthio","Stop getting your stops hunted. SL\u002FTP never touch your broker - only fires when the underlying actually breaches your level. And skip the options chain: drag your levels on the chart, we auto-pick the strike + DTE + contracts. The first open-source platform that does both.","https:\u002F\u002Fgithub.com\u002Fcalesthio\u002FOptionsCanvas",null,"Python",32,5,1,0,2,3,4,6,2.33,"Other",false,"main",true,[26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41],"0dte","algorithmic-trading","alpaca","charting","day-trading","fintech","flask","lightweight-charts","local-first","open-source","options","options-trading","python","self-hosted","trading-platform","vanilla-js","2026-06-12 02:04:10","# OptionsCanvas\n\n[![License: AGPL v3](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-AGPL_v3-blue.svg)](.\u002FLICENSE)\n\n\n## Stop getting your stops hunted.\n\nYou see the setup forming on the SPY chart. You know exactly where you want to enter, exactly where you're wrong, exactly where you'll take profit — **all in SPY dollars, the chart you actually understand.**\n\nThen you tab over to your broker. Pick an expiration. Scroll the strike ladder. Compute how many contracts $1,000 buys. Set the stop in *option premium* dollars (not the SPY level you actually understand). Submit. Watch a market-maker tap your stop on a wick fifteen seconds after the open.\n\n**OptionsCanvas fixes both halves of that.**\n\n- **Your stops live locally.** Not on the broker order book. Not visible to the HFTs that profit from hunting them. We only send a market order at the moment the underlying actually breaches your level.\n- **You never touch the options chain.** You drag your entry, SL, and TP directly on the underlying's chart — we pick the strike, the DTE, the contract count, and project the option premium and P&L in real time as you drag.\n\nTwo-keystroke execution. Runs 100% on your machine. **The first open-source options platform that does this.**\n\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Febae0480-6214-45ae-9435-1231a1a855fb\n\n![Overview](docs\u002Fscreenshots\u002F01-overview.png)\n\n---\n\n## Built for the active options trader who…\n\n- Trades **short-dated options** — whether that's **0 DTE on SPY** or **a month out on AAPL** — directly off the underlying chart\n- Wants to think in **underlying price** (the chart you actually read), not in option premium\n- Has been **stop-hunted** one too many times and never wants a resting stop in the broker's book again\n- Refuses to **click 7 times** to get a trade on\n- Needs **hotkeys, flatten-all, and one-gesture brackets** — not modal dialogs\n\nWorks on any optionable US equity or ETF your broker supports — index ETFs, single names, leveraged ETFs, whatever. Configure your watchlist and the platform pulls expirations + strike increments straight from the broker.\n\nIf that's you, keep reading.\n\n---\n\n## What makes it different\n\n### 🎯 Your chart is your order ticket\nDrag the **Buy**, **SL**, and **TP** pills directly on the underlying chart. No ticket window. No popups. The price line *is* the control.\n- Drag **Buy** away from live price → flips into a limit-trigger with an anchored `ENTRY` line\n- Drag **TP** or **SL** up or down → level updates live, projected premium and P&L update with it\n\n\u003Ctable align=\"center\" border=\"0\">\n  \u003Ctr>\n    \u003Ctd width=\"50%\">\u003Cimg src=\"docs\u002Fscreenshots\u002F02-drag-tp-sl.png\" alt=\"Drag SL\u002FTP pills on the underlying chart\">\u003C\u002Ftd>\n    \u003Ctd width=\"50%\">\u003Cimg src=\"docs\u002Fscreenshots\u002F03-buy-limit-trigger.png\" alt=\"Drag Buy off live price — limit-trigger with anchored ENTRY line\">\u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\">\u003Ci>Drag SL\u002FTP on the underlying — premium + P&amp;L recompute as you drag.\u003C\u002Fi>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ci>Drag Buy off live price — becomes a limit-trigger with an anchored ENTRY line.\u003C\u002Fi>\u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n\n### 🛡️ Stops your broker can't see — and can't hunt\nStops and targets do **not** sit in your broker's order book. They live in your local machine and only become a real market order at the instant the underlying actually breaches your level.\n- No resting stop for HFTs to sweep\n- No \"stop tag + reverse\" 15 seconds after the open\n- The broker sees a market order *after* the breach, never before\n- You stop providing free liquidity to the venue\n\n```\n   You set SL @ 449.50\n            │\n            ▼\n  ┌───────────────────────┐\n  │    trading_engine     │   ← stop lives here, in memory + SQLite\n  │   holds SL locally    │     (broker never sees it)\n  └───────────┬───────────┘\n              │\n              │  polls underlying quote\n              ▼\n      underlying ≤ 449.50 ?\n              │\n              │  yes\n              ▼\n  ┌───────────────────────┐\n  │   market SELL fires   │   → broker (first time the\n  │       to broker       │     order book sees anything)\n  └───────────────────────┘\n```\n\n### 🧠 Think in the underlying. Trade in options.\nYou set levels on the **underlying chart** (e.g. your ticker at 449.50). OptionsCanvas does the contract math.\n- **Auto-picks the contract** — DTE from your configured presets (0 DTE, weeklies, monthlies — whatever you list), ATM strike from the live chain, both pulled fresh from the broker\n- **Black-Scholes overlay** projects the option premium and your P&L *while you drag*, so you see \"if the underlying hits 451, this call is worth $2.40 and you make $640\"\n- Strike increments and expirations come from the **broker as source of truth** — no manual contract config, no stale chains\n\n\u003Cp align=\"center\">\u003Cimg src=\"docs\u002Fscreenshots\u002F04-side-panel-lower.png\" alt=\"Side panel: underlying-priced SL\u002FTP, Smart auto-SL button, auto-picked contract and quantity\" width=\"380\">\u003C\u002Fp>\n\n*One screenshot, the whole pitch: SL and TP labeled in **underlying dollars** (not option premium). One-tap **Smart** button auto-sets stops from ATR. The contract `SPY260526C00746000`, the **3-contract** size, and the **$823.50** cost — all computed for you. Hit the big green button, you're in. Hit \"Close All Positions\", you're flat.*\n\n### ⚡ Speed of execution\nBuilt so a trade is **two keystrokes**, not seven clicks.\n- `B` → Buy CALL at market (ATM, auto-sized)\n- `S` → Buy PUT at market\n- `F` → Flatten **all** positions, instantly\n- `Shift+B` → Bracket draw mode: click entry, drag to TP, release — done\n- `C` → Toggle CALL\u002FPUT  •  `↑`\u002F`↓` → strike up\u002Fdown\n- `1`–`5` → preset position sizes ($500 \u002F $1k \u002F $2k \u002F $5k \u002F $10k)\n- `Alt + 1..6` → 1m \u002F 5m \u002F 15m \u002F 30m \u002F 1h \u002F 1d timeframe\n- `Alt + ←\u002F→` → previous\u002Fnext symbol  •  `?` → cheatsheet\n\n### 🎨 One-gesture bracket orders\nHit `Shift+B`, click entry, drag to where you want profit. Direction of drag picks CALL vs PUT. Default **2:1 R:R** is auto-applied. Release to send. That's the whole interaction.\n\n### 🤖 Smart defaults that aren't dumb\n- **ATR-based SL** (1.5× ATR-14) reconciled against **swing high\u002Flow** lookback — picks the more conservative\n- **2:1 R:R TP** by default, override per trade\n- **Smart sizing presets** so you stop fat-fingering 100 contracts at 3:59pm\n\n### 📊 The chart you'd actually use\nTradingView Lightweight Charts under the hood. Multi-symbol, multi-timeframe.\n- **Indicators**: VWAP, SMA, EMA, RSI, Volume — toggle per chart\n- **Drawing tools**: trend lines, rectangles, horizontals\n- Dark theme, 60fps, no garbage\n- **Right-click context menu** with everything one click away\n\n*(The hero image at the top of this page is exactly this — chart, indicators, draggable Buy\u002FSL\u002FTP pills, side panel, broker pill, Day P&L — all rendered live.)*\n\n### 🔒 Local. Private. Yours.\n- Runs 100% on your machine — Flask on `127.0.0.1:5001`\n- Your keys live in `config\u002Fconfig.json`, your state in `assisted_trading\u002Fstate\u002Ftrading.db`\n- **Zero telemetry.** The only outbound traffic is to your broker.\n- No SaaS, no login, no \"free tier\", no one watching your levels\n\n### 🧱 Risk controls that actually fire\n- **Per-symbol position caps** and **max simultaneous positions**\n- Configurable **trading hours** (auto-blocks orders outside the window)\n- **Auto-sell on SL breach** (toggle off if you prefer manual)\n- **Daily trade limits** and accept-partial-fill behavior, all in JSON config\n\n### 📓 Every trade journaled — automatically\nStop maintaining your trading journal in a spreadsheet. OptionsCanvas writes every fill, every close, every realized P&L to your local SQLite DB as it happens.\n- **Per-trade row** — option symbol, contracts closed, exit price, exit time, realized P&L\n- **Daily aggregate** — total trades, win\u002Floss count, gross profit\u002Floss, net P&L, largest win\u002Floss\n- **Plain SQLite** at `assisted_trading\u002Fstate\u002Ftrading.db` — query with `pandas.read_sql`, DuckDB, Datasette, Jupyter, whatever you already use for analysis\n- **JSON snapshots** under `assisted_trading\u002Fjournal\u002F\u003Cdate>\u002Ftrades.json` for human-readable review\n- **REST endpoint** `GET \u002Fapi\u002Fjournal?start_date=...&end_date=...` for building your own dashboards\n- It's your data, on your disk — nothing leaves the machine\n\n### 🔌 Broker-agnostic by design\nCurrently two brokers ship out of the box:\n- **Alpaca** — production-tested. The reference implementation used during development.\n- **Tradier** — *implementation complete but not yet validated end-to-end against a live Tradier sandbox account. Working through that now — see [Broker support status](#broker-support-status) below.*\n\nThe broker layer is an abstract interface (`broker_interface.py`) with a declarative registry (`broker_registry.py`) — adding IBKR, Tastytrade etc. is one new file in `backend\u002F` and one entry in the registry. The wizard UI renders dynamically from the registry, so a new broker shows up without any frontend edits.\n\n---\n\n## Setup\n\n**Prereqs:** Python 3.10+ (or Docker) and a free paper-trading account from a supported broker — [Alpaca](https:\u002F\u002Falpaca.markets) (recommended) or [Tradier](https:\u002F\u002Ftradier.com) (experimental — see [Broker support status](#broker-support-status)). Both take ~2 minutes to create and don't risk real money.\n\n### The whole thing, in 3 steps:\n\n1. **Download** — [grab the latest ZIP](https:\u002F\u002Fgithub.com\u002Fcalesthio\u002FOptionsCanvas\u002Farchive\u002Frefs\u002Fheads\u002Fmain.zip) (or `git clone`) and unzip it.\n2. **Launch** — pick whichever is easiest:\n   - **Windows**: double-click `OptionsCanvas.bat`\n   - **macOS \u002F Linux**: `.\u002Foptionscanvas.sh` *(first time: `chmod +x optionscanvas.sh`)*\n   - **Docker (any OS)**: `docker compose up -d` — see [Docker](#docker) below\n\n   On the first native run it creates a Python venv and installs deps (~2 min). Subsequent launches are instant.\n3. **Follow the wizard** — your browser opens to the setup wizard:\n   - Pick a broker (Alpaca recommended; Tradier supported but [not yet end-to-end tested](#broker-support-status)) → paste keys → \"Test connection\"\n   - Pick a trading universe: **Recommended 30** (default), **Full 110**, or your own custom watchlist\n   - Click **\"Start trading\"**\n\nThat's it. The trading UI takes over and you're live on paper money.\n\nThe wizard also runs idempotently — you can revisit `http:\u002F\u002Flocalhost:5001\u002Fsetup` later to re-onboard symbols or rotate keys.\n\n\u003Ca id=\"docker\">\u003C\u002Fa>\n\u003Cdetails>\n\u003Csummary>\u003Cb>Docker\u003C\u002Fb>\u003C\u002Fsummary>\n\nSingle command, any OS:\n\n```bash\ndocker compose up -d        # build + start\n# open http:\u002F\u002Flocalhost:5001\u002Fsetup\ndocker compose logs -f      # tail logs\ndocker compose down         # stop\n```\n\n`config\u002F` and `assisted_trading\u002Fstate\u002F` are bind-mounted, so your broker keys and trading DB live in the repo dir and survive container rebuilds.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Power-user \u002F manual setup\u003C\u002Fb>\u003C\u002Fsummary>\n\nIf you'd rather skip the launcher and do it by hand:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fcalesthio\u002FOptionsCanvas.git\ncd OptionsCanvas\npython -m venv .venv && source .venv\u002Fbin\u002Factivate   # Windows: .venv\\Scripts\\activate\npip install -r requirements.txt\npython assisted_trading\u002Frun_platform.py             # opens browser to \u002Fsetup wizard\n```\n\nOr skip the wizard entirely (Alpaca-only path — Tradier users should use the wizard):\n\n```bash\ncp config\u002Fconfig.example.json config\u002Fconfig.json    # then paste your Alpaca keys\npython scripts\u002Fonboard_symbol.py                    # default: 30 Tier-1 names\npython scripts\u002Fonboard_symbol.py --all              # full 110-name universe\npython scripts\u002Fonboard_symbol.py AAPL MSFT NVDA     # custom tickers\npython assisted_trading\u002Frun_platform.py\n```\n\nThe Tier-1 default covers SPY, QQQ, NVDA, TSLA, IWM, the Mag-7, top semis (AMD, MU, INTC, AVGO, SOXL\u002FSOXS), high-flow retail names (PLTR, HOOD, MSTR, COIN, F, AAL), sector ETFs (XLE, XLF), and leveraged QQQ (TQQQ\u002FSQQQ). `--all` adds 80 more across financials, pharma, energy, consumer, China, vol, and bonds.\n\n**Optional — browser tests (Playwright):**\n```bash\nnpm install && npx playwright install chromium\n```\n\n\u003C\u002Fdetails>\n\n---\n\n## Hotkeys cheatsheet\n\n| Key | Action |\n|---|---|\n| `B` \u002F `S` | Buy CALL \u002F Buy PUT at market |\n| `F` | **Flatten all positions** |\n| `Shift+B` | Bracket-draw mode (click entry, drag to TP) |\n| `C` | Toggle CALL ↔ PUT |\n| `↑` \u002F `↓` | Strike up \u002F down |\n| `1`–`5` | Position size: $500 \u002F $1k \u002F $2k \u002F $5k \u002F $10k |\n| `Alt + 1..6` | 1m \u002F 5m \u002F 15m \u002F 30m \u002F 1h \u002F 1d |\n| `Alt + ← \u002F →` | Previous \u002F next symbol |\n| `D` \u002F `T` | Draw horizontal \u002F trend line |\n| `Esc` | Cancel drawing \u002F bracket mode |\n| `?` | Show full shortcuts modal |\n\n---\n\n## Broker support status\n\n| Broker | Status | Notes |\n|---|---|---|\n| **Alpaca** | ✅ Production-tested | The reference broker used during development. All flows (validate, chart data, option chains, place\u002Fcancel orders, positions, server-side stops) exercised continuously against a paper account. |\n| **Tradier** | 🧪 Implementation complete, end-to-end testing in progress | All `BrokerInterface` methods implemented against Tradier's documented REST API. Verified against the sandbox endpoint at a unit level (auth, error handling, response parsing) but not yet validated through a full sandbox trading session. Use at your own risk until this row turns green; please file issues if you see anything off. |\n\nAdding a new broker requires one file in `assisted_trading\u002Fbackend\u002F\u003Cname>_broker.py` (implementing `BrokerInterface`) and one entry in `broker_registry.py` — no frontend or trading-engine edits. Contributions welcome.\n\n---\n\n## Configuration\n\n- **`config\u002Fconfig.json`** — broker credentials + paper\u002Flive mode + global defaults (gitignored, never commit). Written by the setup wizard; you almost never need to edit it by hand.\n- **`assisted_trading\u002Fconfig\u002Fassisted_trading_config.json`** — enabled symbols, DTE presets, position-size presets, max positions, trading hours, auto-sell, entry-order type\n- **Broker accounts** — free paper accounts at [Alpaca](https:\u002F\u002Falpaca.markets) or [Tradier](https:\u002F\u002Ftradier.com). Paper and live use separate API keys on both brokers — generate the right pair from each broker's API settings page.\n\n---\n\n## Architecture\n\n- **Frontend (vanilla JS)** — `ChartManager` owns Lightweight Charts. `OrderPanelOnChart` renders draggable pills. `ChartTradingController` bridges chart ↔ side panel. `BlackScholesCalculator` projects premium + P&L. `BracketOrderDrawer` handles one-gesture brackets. `KeyboardShortcutManager` for hotkeys. `SmartDefaults` for ATR-based SL\u002FTP. The setup wizard (`setup.html`) renders dynamically from `\u002Fapi\u002Fsetup\u002Fbrokers`.\n- **Backend (Flask + SocketIO)** — `chart_api_server.py` exposes REST + WS. `trading_engine.py` runs the loop: entries, fill monitoring, SL\u002FTP breach checks, with a TTL cache + graceful fallback on transient broker errors. `order_manager.py` + `position_manager_v2.py` persist to SQLite. `state_machine.py` enforces invariants. `setup_routes.py` powers the first-run wizard.\n- **Broker layer** — `broker_interface.py` (abstract base) + `broker_registry.py` (declarative metadata, drives wizard UI) + `broker_factory.py` (builds instances) + `alpaca_broker.py` and `tradier_broker.py` (concrete impls). Add a broker: drop one file in `backend\u002F`, add one entry in the registry.\n- **State** — SQLite at `assisted_trading\u002Fstate\u002Ftrading.db`, auto-migrates on boot.\n\nMore: [`docs\u002FARCHITECTURE.md`](docs\u002FARCHITECTURE.md).\n\n---\n\n## Testing\n\n```bash\npip install -r requirements-test.txt                 # one-time\npytest -q                                            # ~190 unit + property + integration tests\npython assisted_trading\u002Frun_platform.py &            # then, in another shell:\nnpx playwright test tests\u002Fbrowser\u002Fchart_trading.spec.js\n```\n\nScreenshots in this README are captured by `tests\u002Fbrowser\u002F_screenshots.spec.js` against the live app.\n\n---\n\n## Contributing\n\nPRs welcome — see [`CONTRIBUTING.md`](CONTRIBUTING.md). Keep changes focused, run the suites, respect the broker abstraction and state machine.\n\n---\n\n## If this is useful to you\n\nA star on the repo genuinely helps — it's how other options traders find it. Solo dev project with no marketing budget, so word-of-mouth is all there is. If you end up using OptionsCanvas day-to-day, opening an issue with what's working \u002F not working is even more valuable than a star.\n\n---\n\n## License\n\nAGPL-3.0-or-later. © 2026 calesthio. See [`LICENSE`](LICENSE).\n**Plain English**: run a modified version as a network service → you must share the modified source. Fork it privately for your own trading → you're fine.\n\nThird-party components and their licenses (TradingView Lightweight Charts™, Alpaca-py, Flask, Socket.IO, etc.) are catalogued in [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md).\n\n---\n\n## Disclaimer\n\n- **Paper trading is the default** — the setup wizard's mode selector defaults to \"Paper\" on every supported broker. Live trading is supported (switch the toggle to \"Live\" in the wizard, or edit `config\u002Fconfig.json`'s `broker.mode`), but the launcher, server, and trading UI all surface loud warnings (terminal banner, server log, red broker pill, app-wide red border, `[LIVE]` browser-tab prefix) so you can't end up there by accident.\n- **Options trading involves substantial risk of loss.** You can lose 100% of premium; in some configurations more.\n- **Not financial advice.** A tool, not a recommendation. Indicators, projected P&L, defaults — none of it is advice.\n- **No warranty.** Authors and contributors are not liable for losses, missed fills, slippage, broker outages, software bugs, or stops that fail to trigger — paper or live.\n- **If you don't understand exactly what an order will do before you place it — don't place it.**\n","OptionsCanvas 是一个专为活跃期权交易者设计的开源交易平台，旨在避免止损被猎杀，并简化交易流程。其核心功能包括本地化止损设置，只有当标的资产实际突破预设水平时才会触发市场订单；用户可以直接在标的资产图表上拖拽设定买入、止损和止盈点位，系统自动选择合适的行权价、到期日和合约数量，并实时计算期权溢价和盈亏。该平台适合那些希望通过直观的图表操作进行短线期权交易（如0DTE或更长期限），并希望以标的资产价格而非期权溢价来思考的交易者使用。基于Python开发，支持自托管运行，提供热键等高效交易工具。","2026-06-11 04:03:19","CREATED_QUERY"]