Hi there · Runbook · procedures
Runbook
Step-by-step procedures for operating the trading system, the server and the website. Procedures only — never secrets.
Today (15 Nov 2026)
What runs: see Strategies. Everything trades paper money; real money is off. Every strategy runs on the server, with no outside chart alerts. New this month (service name in brackets):
- Ladder Pot v.15.11.2026 —
ladderpot-v1126 - ETF Basket v.15.11.2026 —
etf-basket-v1126 - SPX Harvester Capped v.13.11.2026 —
hcap-server - SPX Quiet Condor v.12.11.2026 —
qcondor-server - M2K Morning Trend v.12.11.2026 —
vmorning-server - PreMarket Book v.14.11.2026 —
premarket-server
How-to & procedures
Step-by-step procedures for operating the SPX trading system, server, and website. Click any section to expand it.
- Prompt says victorngoma@… or your Mac's name — you are on the Mac. Paste the command as written.
- Prompt says victor@spx-server — you are already on the droplet. Drop the ssh victor@165.227.84.78 wrapper and the surrounding quotes, and run only the part inside them.
Running the wrapped version from the server asks it to log into itself. The key lives on your Mac, not on the droplet, so it fails with Permission denied (publickey). That error means wrong machine, never a broken server or a broken kill switch.
ssh victor@165.227.84.78 'touch ~/LIVE_OFF'
Already on the droplet (prompt reads victor@spx-server)? Run just touch ~/LIVE_OFF — no ssh, no quotes.
ssh victor@165.227.84.78 'rm -f ~/LIVE_OFF'
Already on the droplet (prompt reads victor@spx-server)? Run just rm -f ~/LIVE_OFF — no ssh, no quotes.
What it does and does not do.
- New live entries stop. Every refusal is written to the journal with the reason live_kill_file, so a blocked trade never looks like a signal that simply never arrived.
- Open live positions are still sold when their exit signal fires. This is deliberate — switching off must never strand real money in a position that nothing is managing any more.
- Paper keeps trading. Both books share the signal, so after a pause they will hold different things. That is expected, not a fault.
- It pauses, it does not rewind. Signals that fire while it is off are not taken live and cannot be recovered afterwards.
- The SPX Condor's live book is affected, its paper book is not. Every other option strategy is paper everywhere, so there is nothing to switch.
Confirm which state you are in without guessing: open ETFs or Stocks and read the badge beside the PAPER / LIVE TRADING pills — green LIVE ARMED or red LIVE OFF. It is read fresh on every page load.
The switch is the presence of the file, nothing else. If you are ever unsure, run ls ~/LIVE_OFF — if the file is there, live entries are off.
The two figures beside your avatar on every page are total profit/loss across all books, realised plus the unrealised on every open position that has a live mark. They replaced the old Open Dashboard button on 2026-09-03.
- PAPER = Stocks + ETFs + Leveraged 3x + Options (the five SPX rails and SPY Calls) + Night & Dip.
- LIVE = Stocks + ETFs + Leveraged 3x. Options and Night & Dip are paper everywhere, so they never appear here.
- Green is positive, red is negative. It refreshes itself every minute; hover it for the per-book breakdown and the as-of time.
- Each figure is the sum of what the individual pages show — the ETFs page's Combined P/L plus the Stocks page's Total P/L, and so on. If a page and the bar disagree, reload the page: the bar is at most a minute old.
If the bar is missing entirely: you are not signed in as a member, or the feed failed. Open victorngoma.com/api/pnl in the browser — it shows the raw numbers and an errors list naming any panel that did not answer. The Stocks panel is the aggregator; the panels reload without sudo.
Every share engine — Stocks, ETFs and the Leveraged 3x mirror — commits $500 per signal, in the paper book and the live book alike. It was $1,000 until 2026-09-04.
- Whole shares only. The engine buys floor($500 ÷ ask) shares, so cost basis is usually a little under $500 (a $175 fund buys 2 shares = $350).
- Expensive shares are bought, not skipped. A share priced above $500 (SPY, and the $700+ names) buys one share. Before this change such signals were rejected as qty_zero. The $1–$2,000 price band still applies.
- Live no longer floats with buying power. The live books used to size off a share of margin buying power; they now use the same fixed $500. The live page says sized off fixed $500 slot.
- Everything else is unchanged: concurrency caps (25 / 5 / 10), the live deployment cap, the PDT guard, the kill file.
Where it lives, and how to change it. Two keys in each engine's config file: position_value (paper) and live_position_value (live), in ~/stocks-server/stocks_config.json, ~/etf-server/etf_config.json and ~/etf3x-server/etf3x_config.json. The engines read them at startup, so a change needs (on the droplet):
sudo systemctl restart stocks-server etf-server etf3x-server
Proof it took: journalctl -u stocks-server -n 30 prints $500/position, max 25 concurrent at boot, and each live page shows the slot in its sizing note.
The 15:30 condor is the only option strategy trading real money. It runs two books at once, exactly like Stocks and ETFs: on every 14:30 CT signal the server builds the strikes once, opens the paper condor as it always has, and opens a second, real-money condor alongside it, sized off the real account. Paper never waits on anything that concerns real money.
- Reading the page. Options → SPX Condor has the same pills as Stocks: PAPER TRADING / LIVE TRADING / LIVE ARMED. Each book has its own open spreads, history, stats and chart. The header P/L bar puts the live book under LIVE and the paper book under PAPER.
- What makes it live. One line in the server's .env: LIVE_STRATEGIES=spx_1530_condor. Remove that line and restart, and the rail is paper-only again — every other strategy is untouched either way. The whole-server PAPER_MODE stays true; do not flip it.
- How a live entry works. Two limit orders at the quoted credits (put spread, call spread), sized as described under Live sizing below. The server then polls the broker for up to 90 seconds; a side that has not filled is cancelled and recorded as unfilled — it is never carried as a position. If neither side fills, the day is recorded as live_unfilled_both and only the paper condor exists.
- How a live stop works. Buy-to-close limit at the stop price; if it has not filled in 20 seconds, one retry $0.50 wider; if that fails too the side is left to cash-settle (loss capped at the width) and journalled stop_unfilled. Paper stops never touch the broker.
- Where the money settles. SPXW is cash-settled at 15:00 CT by the broker. The server books its own estimate; the brokerage statement is the truth.
The live book sizes off the real account balance, the paper book off its own $60k. The formula is the same for both: daily risk budget = daily_risk_pct_of_nlv (4.57%) × a weight that rises with the credit; contracts = budget ÷ risk per contract (width minus credit, about $2,300). On a $30k account that budget is $450–$1,100, so it rounded to zero contracts on any credit under $3.00 — which is why the first live day (2026-09-04) traded nothing, silently.
- The fix. live_min_contracts: 1 in the condor block of allocations.json, set with python3 ~/set_condor_live_size.py --min-contracts 1 and a sudo systemctl restart spx-server. The live book now trades 1 contract on every valid day and only grows to 2 when the normal formula says so (roughly $55–60k NLV). Paper sizing is untouched.
- What 1 contract means. Defined max risk $2,150–$2,400 a day (7–8% of a $30k account) — that is what the broker holds and what you lose only if a stop cannot fill. A stop that fills at its trigger costs about $780 (2.6%); a gap through the trigger, like 2025-10-14, $1,000–$1,400. One contract cannot be split, so the choice at this account size is 7–8% or nothing.
- Other knob. --daily-pct X sets live_daily_risk_pct_of_nlv for the live book only (unset = same 4.57% as paper). Both knobs need a restart to take effect.
- Every live rejection is now journalled (server_action=rejected with a reason such as live_size_zero) and logged, so a silent no-trade cannot happen again unnoticed.
The condor still opens one contract every trading day, exactly as before. On Wednesday, Thursday and Friday inside the 8th–21st of the month it opens two. Those are the days that, on four years of real quotes with winters included, read profit factor 2.01 on their own (train 1.50 / test 3.74). The book as a whole: 1,117 lots, PF 1.30, +$44.9k against +$20.8k as traded, worst day −$1,926, drawdown −$11.9k, 2024 still a losing year.
- Where it lives. allocations.json → calendar_gates → spx_1530_condor: every weekday allowed, double = Wed/Thu/Fri with day 8–21, max_lots 2, live_max_lots 2, since 2026-09-08. FOMC days come from the condor’s own skip_dates. Read at startup — any change needs a restart.
- Both books. Paper and live take the same lots; the journal, the log and the state record carry calendar_lots so a 2-lot day is visible everywhere.
- Risk together with the Harvester. A 2-lot condor reserves ~$4,500. A Wednesday in the 8th–14th can also carry two Harvester long lots and one short: $11,310 across both rails, 38% of a $29,900 account. Thursday/Friday in the 15th–21st: $9,040 (30%). The Harvester’s 35% cap is per rail; the condor has no cap of its own, by Victor’s choice on 2026-09-06.
At 14:30 the server quotes both sides and adds the two credits. If put + call credit is below 8% of the width — under $2.00 on the 25-wide — the day is skipped on both books. The credit follows the 15:30 ATM straddle: a quiet tape pays little for the same $23 of risk, and those days lose as a group. On the 871-session record (2022–26, real quotes): below 6% of width PF 0.49, 6–8% PF 0.89, 8–10% PF 1.24, 10–12% PF 1.24, above 12% PF 1.41. The gate removes 28% of days and lifts the book from PF 1.30 / +$44.9k to PF 1.50 / +$55.4k, train 1.34 / test 1.28, no losing year (2024 turns positive). It does not predict losing days; it refuses the days the market pays too little.
- Where it lives. allocations.json → spx_1530_condor → min_total_credit_pct_of_width: 8.0. The older min_credit_pct_of_width (0.5) is a per-side no-bid guard and stays. Read at startup — a change needs a restart.
- What you see. A skipped day writes one journal row, rejected / credit_gate, with both credits in the notes; nothing opens, no order is sent, and the log line reads [CONDOR] CREDIT GATE skipped.
- What it is not. Early exits were tested on the same record and every one of them loses money against holding to settlement (closing both sides at 14:55 reads PF 0.91); the gate is the lever that works.
Combined preflight. On the droplet python3 ~/condor_calendar_preflight.py prints, for the next 12 sessions, the Harvester’s long and short lots, the condor’s lots, and the worst-case reserve of all three on the real balance. Run it after any restart, calendar change or deposit.
Preflight before any live day. On the droplet: python3 ~/condor_preflight.py. It reads the real balance and prints the live contract count for credits $1.00–$3.50. If any row says ZERO, the live book will not trade that day. Run it after every restart, sizing change, or deposit.
On a live day, the quickest proof the server is doing what you think: on the droplet, grep -c '^LIVE_STRATEGIES=' ~/spx-server/.env (1 = live) and ls ~/LIVE_OFF (absent = armed). The live record's id ends in _LIVE in the journal, which is how the page tells the books apart.
The Adaptive Trend Harvester (server id spx_vidya_rsi, old chart alert “SPX 0DTE Dual Harvester — v2”; the signal runs on the server since 9/25) is the second option strategy trading real money. Like the Condor it runs two books: paper on the $60k pretend bankroll, and a real-money twin on the same signal, recorded under the same id with _LIVE appended. Options → SPX Directional has the PAPER / LIVE / LIVE ARMED pills.
- The calendar rule (the 2026-09-05 day study, real quotes 2022–26). The long leg (08:40 CT put spread) opens only Mon, Tue, Wed; the short leg (RSI-4 call spread) only Tue–Fri; neither opens on the 1st–7th of a month or on an FOMC decision day. One entry per leg per day — the alert script still fires up to three shorts, the server takes the first and journals the rest as rejected / one_per_direction_per_day.
- Lots. One contract normally; two when Victor’s stricter rule also holds: long on Mon/Tue/Wed inside the 8th–21st, short on Tue/Thu/Fri inside the 15th–21st. Backtest of this exact book: 543 lots, 78% win, profit factor 1.76, +$226 a lot, Sharpe 3.8, worst day −$4,240.
- What the live book does. Limit order at the quoted credit, fill confirmed within 90 s or cancelled and journalled unfilled. At 15:00 CT the paper spread closes as always; the live twin gets no closing order (SPXW cash-settles and tastytrade rejects orders 15:00–15:15) and is journalled settled / cash_settlement. No premium stop on this rail, by measurement. A live entry that would push the day’s live risk past live_daily_risk_cap_pct_of_nlv (35%) is rejected and journalled.
- Where it is configured. allocations.json → calendar_gates → spx_vidya_rsi (weekdays, skip days, double-lot days, max_lots, live_max_lots, the cap, skip_dates). Read at startup: every change needs sudo systemctl restart spx-server. The rail is live because .env reads LIVE_STRATEGIES=spx_1530_condor,spx_vidya_rsi; remove the name and restart to go paper-only.
- Risk in dollars on a $30k account. A 2-lot leg is $4,540 (15% of NLV); a 2-lot long plus a 1-lot short day is $6,810 (23%); Tuesdays in the 15th–21st can carry 2 + 2 = $9,080 (30%), which is why the cap is 35%. The Condor adds its own contract at 14:30 CT on the same days.
Preflight, any time: on the droplet python3 ~/harvester_preflight.py prints the next 12 sessions with the lots each leg will take, the real balance, and the dollar risk. /health echoes calendar_gates. The kill file touch ~/LIVE_OFF pauses the live twin here exactly as it does the Condor.
The first futures rail. One Micro Russell 2000 contract (M2K, $5 a point), long only. Rule: on the 4-hour chart, the VIDYA 9/9 trend with 2.0 ATR bands is green on the bar that just closed and the RSI-7 crosses below 30 on that same close → buy at the next quote; the RSI-7 crossing back above 70 → sell. No stop, no time limit. Backtest 2019–2026 on bars aligned with the old chart platform: 91 trades, 80% winners, profit factor 3.33, Sharpe 1.34, +$8,451 a contract, worst drawdown −$928, 7 of 8 years positive, about 12 trades a year held 4 days on average (research/m2k_mtf/REPORT.md and verify_tv.py).
- Where. The old chart alerts: a 4-hour chart of CME_MINI:M2K1! with the alert script m2k_vidya_rsi_v1; one alert, condition “Any alert() function call”, “Once per bar close”, webhook https://m2k-webhook.victorngoma.com/webhook?secret=… (the secret is M2K_WEBHOOK_SECRET in ~/m2k-server/.env). Turn the script’s “Send webhooks” input ON and re-create the alert after any input change.
- Server. ~/m2k-server/m2k_server.py (systemd m2k-server, port 5115). Two books: the paper book always trades (fill = quote plus two ticks, $1.30 a round trip); the live book trades only when LIVE_TRADING=true in .env and ~/LIVE_OFF is absent. Live exits always run. Every minute the server marks the open contract and, on the live book, checks the broker’s position and fills: a hand close is booked from the fill, a limit that did not fill in 3 minutes is cancelled (entry) or re-sent wider (exit).
- Which contract. The nearest expiry with more than 8 days left (December while September expires). The rail never rolls: when a held contract gets within 8 days of expiry the page shows a Roll due notice and the journal gets a ROLL_DUE row; close or roll it by hand.
- Page. retired; its history is on Retired (panel was on port 5116, ?book=live for the live book); its totals feed the header pill like every other book.
- Restart / check. sudo systemctl restart m2k-server, curl -s http://127.0.0.1:5115/health; paper self-test .venv/bin/python m2k_selftest.py ~/m2k-server /home/victor/m2k-server/.venv/bin/python; live path .venv/bin/python m2k_live_preflight.py (read-only plus one order dry-run; run it while the futures session is open, Sunday 17:00 CT to Friday 16:00 CT).
- Kill switch. touch ~/LIVE_OFF stops live entries on this rail and the equity books at once; the open live contract is still sold on its signal.
Rail spx_1530_callspread inside spx-server, cloned from the Condor. At 14:30 CT the alert script (spx_1530_callspread_v1, 1-minute SP:SPX chart, same clock as the Condor) sends CALLSPREAD_OPEN with the SPX price and one fact only the chart has: whether the IWM hourly trend is on (last completed 60-minute IWM close above its 150 DEMA). The server builds two call credit spreads on today’s expiry from the real chain: A “iwm” only when that gate is OFF, short call 15 points above the ATM strike, long 40 above, skipped below $1.25 of credit; B “all” every day, 15 above / 25 above, skipped below $0.50. One contract each, paper book, no stop, FOMC days traded. At 15:00 CT CALLSPREAD_SETTLE books the cash settlement. Record 2022–2026 on real quotes: A 130 trades 88.5% / PF 2.43 / Sharpe 1.73, B 319 trades 89% / 1.82 / 1.77; with the Condor the book is Sharpe 2.42. They have their own module, SPX Call Spreads (victorngoma.com/spx/s), with their own total and graph. Config block spx_1530_callspread in allocations.json; self-test python3 callspread_selftest.py server.py in ~/spx-server.
The second futures rail, a clone of the M2K one. One Micro EUR/USD contract (M6E, $12,500 a point, so $1.25 a pip), long only. Rule: the 4-hour VIDYA 9/9 trend with 3.0 ATR bands is green on the last completed 4-hour bar and the 6-hour RSI-7 crosses up through 35 on the last completed 6-hour bar → buy at the next quote; the 6-hour RSI-7 crossing up through 70 → sell. No stop, no time limit. On the euro it is the recovery through 35 that works, not the dip below 30 that works on the Russell. Backtest 2019–2026 exactly as the chart runs it: 73 trades, 78% winners, profit factor 3.67, Sharpe 1.33, +$3,537 a contract, worst drawdown −$314 (about −$450 marked to market), positive every year, about 10 trades a year held 7 days on average (research/micro_futures/REPORT.md). Small money on purpose: it is on the record next to M2K, not a replacement for anything.
- Where. The old chart alerts: a 1-hour chart of CME:M6E1! with the alert script m6e_vidya_rsi_v1. The 1-hour chart is only the clock: the script reads the VIDYA gate from the 4-hour bars and the RSI from the 6-hour bars through non-repainting request.security calls, and acts one hour after each 6-hour close (a 4-hour chart would see two of the four daily 6-hour closes four hours late and drop to profit factor 3.2). One alert, condition “Any alert() function call”, “Once per bar close”, webhook https://m6e-webhook.victorngoma.com/webhook?secret=… (the secret is M6E_WEBHOOK_SECRET in ~/m6e-server/.env). Turn the script’s “Send webhooks” input ON and re-create the alert after any input change.
- Server. ~/m6e-server/m6e_server.py (systemd m6e-server, port 5117), the M2K server with the product terms changed: prices to 4 decimals, $12,500 a point, fill = quote plus two ticks ($2.50), $1.30 a round trip on the paper book. Two books, live only with LIVE_TRADING=true and no ~/LIVE_OFF; live exits always run; the broker’s position and fills are checked every minute exactly as on M2K.
- Which contract. Quarterly (H, M, U, Z), expiring the second business day before the third Wednesday; the rail trades the nearest expiry with more than 8 days left (December from mid-September) and never rolls: the Roll due notice and the ROLL_DUE journal row appear 8 days out.
- Page. retired; its history is on Retired (panel was on port 5118, ?book=live for the live book); its totals feed the header pill.
- Restart / check. sudo systemctl restart m6e-server, curl -s http://127.0.0.1:5117/health; paper self-test .venv/bin/python m6e_selftest.py ~/m6e-server /home/victor/m6e-server/.venv/bin/python; live path .venv/bin/python m6e_live_preflight.py during the futures session.
- Kill switch. The same touch ~/LIVE_OFF.
A paper-only stocks rail on its own server. Rule: pre-market scan at 7:00 and 8:15 CT: price $2–50, gap 3–20%, float < 50M, market cap > $50M, pre-market volume 300k+; top 10 by pre-market dollar volume. From 8:30:15 CT a name is bought when it trades through its pre-market high. Shares, $500 a name, one-share floor, max 10 names. Stop = low of the first 5-minute bar (1% floor, 8% max), target 2R, flat at 10:30 CT, $500 daily loss cap. No backtest yet (the 8/26 momentum study says the textbook version loses); it is on paper to collect real fills, and the 5-year backtest is the next step. The Claude catalyst score is recorded, not used.
- Services. gap-server (the brain, port 5119) and gap-panel (the page, port 5120).
- Files. ~/gap-server/gap_server.py, gap_config.json (the rule’s numbers), gap_state.json (today’s names and positions), journal/gap_trades_journal.csv (every fill) and journal/scans/ (each morning’s scan as it was seen).
- Keys. The Polygon key lives in ~/gap-server/.env; the Anthropic key is read from ~/spx-server/advisory.env. Never print either.
- Page. victorngoma.com/gap (panel on port 5120).
- Check. curl -s 127.0.0.1:5119/health; today’s scan curl -s 127.0.0.1:5119/scan | head -c 600.
- Restart. sudo systemctl restart gap-server.
- Disable. Set "enabled": false in ~/gap-server/gap_config.json, then sudo systemctl restart gap-server. No live book exists on this rail.
One file, premarket_engine.py, deployed as gap_server.py in two folders; the rule is chosen by "mode" in each folder’s gap_config.json.
- Failed-Gap Short (was Pre-Market Stocks) = mode failed_gap_short, ~/gap-server, port 5119, service gap-server, page victorngoma.com/stocks/premarket. The one-day long rule of 9/18 is archived in ~/gap-server/archive_20260918_long_rule.
- Gap-Down Reversal = mode gapdown_long, ~/gapdn-server, port 5122, service gapdn-server, page victorngoma.com/stocks/gapdown. It only trades when SPY opens −0.66% or worse; the journal writes one GATE row a day.
- Health. curl -s 127.0.0.1:5119/health and curl -s 127.0.0.1:5122/health (shows mode, phase, market gap, gate).
- Self-test. cd ~/gap-server/v2 && ../.venv/bin/python engine_selftest.py (32 checks, both modes, no network).
- Pre-Market Trend (Options page, victorngoma.com/spx/pt) = the options engine gapopt_server.py in mode trend_1m, folder ~/pmtrend-server, port 5123, service pmtrend-server. 1-minute bars: history from Polygon (15 minutes delayed) stitched to bars it builds itself from 5-second quote polls; VIDYA 10/20/2 gate, Supertrend 10/3 entry and exit, first trade only, flat 2:55 PM CT. Self-test: cd ~/pmtrend-server && ~/gap-server/.venv/bin/python trend_selftest.py (14 checks). Its universe.json is a link to the options rail’s list.
- QQQ Trend Spread (Options page, victorngoma.com/spx/qt) = its own small brain qqq_server.py, folder ~/qqq-server, port 5124, service qqq-server, paper only. 3-minute QQQ bars (Polygon history stitched to bars it builds from 5-second quote polls from 8:15 CT); the first bar from 8:30 where the SMA 20 gate and Supertrend 14/3 agree gives the side; sells one same-day credit spread (short 0.25% in the money, $10 wide) at the natural price; no exit, settles on the 3:00 PM CT close (early-close days follow the exchange). If the brain was down when the signal came it skips the day rather than chase. Health: curl -s 127.0.0.1:5124/health (mode qqq_trend_spread). Self-test: cd ~/qqq-server && ~/gap-server/.venv/bin/python qqq_selftest.py (34 checks). Settings: ~/qqq-server/qqq_config.json.
- QQQ Dip Calls (Options page, victorngoma.com/spx/qc) = its own small brain qqqcalls_server.py, folder ~/qqqcalls-server, port 5125, service qqqcalls-server, paper only. 60-minute regular-hours QQQ bars built from closes only (Polygon minutes, 15 minutes late, plus the brain’s own quote for the bar that just closed); buys one at-the-money call (first Friday 30+ days out) when the RSI-4 crosses up through 35 above the Hull 20, stacks up to 3 calls $5 apart, sells all when the RSI-4 crosses down through 75. A signal on the 3:00 PM bar is queued for 8:31 CT the next session; a missed entry is never chased, a missed exit is executed when seen. Health: curl -s 127.0.0.1:5125/health (mode qqq_dip_calls). Self-test on real data: cd ~/qqqcalls-server && ~/gap-server/.venv/bin/python qqqcalls_selftest.py (17 checks). Settings: ~/qqqcalls-server/qqqcalls_config.json.
- TQQQ RSI Ladder (Stocks page, victorngoma.com/stocks/ladder) = its own small brain ladder_server.py, folder ~/ladder-server, port 5126, service ladder-server, paper only. 1-minute regular-hours TQQQ bars built from closes only (Polygon minutes, 15 minutes late, plus the brain’s own :58 quote of each minute, kept in ladder_minutes.json). RSI-14 up through 30 buys one share at the ask; RSI-14 down through 70 sells every share bought below the bid, cheapest first, never the last one. Every share is a lot in ladder_state.json. Check: curl -s 127.0.0.1:5126/health; test: ~/gap-server/.venv/bin/python ladder_selftest.py (19 checks). After a TQQQ split the lot prices must be divided by hand.
- Pre-Market VWAP and Pre-Market VWAP + Supertrend (Options page, victorngoma.com/spx/pv and /spx/pvs) = mode vwap_confirm of the same options engine gapopt_server.py, folders ~/pmvwap-server (port 5127, service pmvwap-server) and ~/pmvwapst-server (port 5128, service pmvwapst-server), paper only. Same scan and list as the other two pre-market rails; at 08:45 CT the stock must be on the gap side of the session VWAP (built from the broker’s cumulative volume, 5-second polls from 08:30) — the second rail also needs the 5-minute Supertrend (10, 3) on that side. Exits: VWAP cross-back / 5-minute Supertrend flip, +50% of premium, 14:55 CT. Test: ~/gap-server/.venv/bin/python confirm_selftest.py (19 checks). The pick-history collector records both (slugs pmvwap, pmvwapst).
- Pages. Both modules are drawn by premarket_modules.py, the same file beside spx_panel.py, stocks_panel.py and gap_panel.py.
Pre-Market Breakout specifics. The list of liquid-option names is ~/gapopt-server/universe.json (every candidate and why it was dropped: universe_all.json), rebuilt by build_universe.py every Friday 11:00 CT from cron (spreads are only measured in market hours). The page is a module of the Options page: victorngoma.com/spx/pm (Pre-Market Stocks is a module of the Stocks page: victorngoma.com/stocks/premarket). Both are drawn by premarket_modules.py, the same file beside spx_panel.py, stocks_panel.py and gap_panel.py; the gap-panel process (5120) stays up for the header P&L bar. Paper only: the file has no live order path. Rule: gap 1.5%+ (funds 0.6%+), no earnings since the close, option-flow and news vetoes; calls through the pre-market high / puts through the pre-market low 8:30:15–9:00 CT; Friday expiry with 2+ days, first ITM strike, spread within 10% of mid; stop −30%, target +50%, flat 10:30 CT.
- Process. gapopt-server on 127.0.0.1:5121, files in ~/gapopt-server (gapopt_server.py, gapopt_config.json, gapopt_state.json, journal/gapopt_trades_journal.csv, journal/scans/). It reuses gap-server’s Python environment.
- Health. curl -s 127.0.0.1:5121/health · scan view curl -s 127.0.0.1:5121/scan | head -c 600.
- Restart. sudo systemctl restart gapopt-server. To switch it off: set "enabled": false in the config and restart.
- Self-test. cd ~/gapopt-server && ~/gap-server/.venv/bin/python gapopt_selftest.py (28 checks, no network).
- Keys. Same as the Gap Scanner: Polygon key in ~/gapopt-server/.env, Anthropic key read from ~/spx-server/advisory.env.
The header pill carries a third figure, Account: the account’s net liquidating value minus the starting balance ($36.60 on 2026-08-25) minus every deposit since ($30,000 in three ACH transfers, 8/26–8/28). That is exactly what you have made or lost with real money, whoever placed the orders, and it is read from the broker every 10 minutes by the Stocks engine. Hover the pill to see the arithmetic (net liq = start + deposits + P/L).
- Live vs Account. Live is the sum of the engine books (Options twins, ETFs, Stocks, 3x). Account also contains your own hand-placed SPX orders (the Manual Trades module on the Options page) and the open P/L on anything the engines do not own, such as a short left at the broker. Live + Manual Trades should sit within a few dollars of Account; the remainder is the broker marking open shares at its own mid instead of the close.
- Exits at the broker’s price. The SPX server books a stop at its limit and a settlement at the 15:00 CT index print; tastytrade books the fill and the official settlement value the next morning. The server now reads those rows (Cash Settled Assignment, Expiration, the closing fills) and rewrites the ledger with the broker’s exit and its fees (LIVE_FILL rows, reason exit_fill or exit_settlement). Example: the 9/11 condor put side was booked at $4.51 a lot from the 15:00 print; the broker settled it at $3.02, so the loss is $405.88, not $704.60.
- Fees. Equity fills carry their clearing and regulatory fees (about a cent a trade); option fills $1.72 a contract to open, $0.72 to close, $5 for a cash settlement. All of it comes off the realised figures.
- Marks. During market hours a live share position is marked at the quote mid, the way the app marks it; after the bell and over the weekend at the broker’s close price. The paper books keep the bid.
Every real-money book — Stocks, ETFs, Leveraged 3x, and the SPX Condor and Harvester twins — now reconciles itself against the tastytrade account. The rule is simple: what the broker shows is the truth, and the site has to say the same thing. Nothing here ever sends an order; it only reads positions and fills and corrects the books.
- Hand closes. If you sell a position in the tastytrade app, the next 10-minute cycle sees the shares (or the short option leg) are gone, finds the closing fill in the account’s transactions, and books it at that price and time with reason manual_close. The SPX server has done this since 2026-09-08; the equity engines since 2026-09-12. The equity check runs every cycle day and night, so a weekend restart also catches up.
- Fill prices, not limits. An engine order is placed at a limit, and until 9/12 the book kept that limit as the price. Now every entry and exit carries its order id; the reconciler reads the broker’s fills for that id and rewrites the price, cost and realised P/L, writing a LIVE_FILL row to the journal. The SPX twins do the same for their entry credit (the 9/8 Harvester twin was quoted $3.65 and filled $3.85; the ledger now says $3.85 and +$290). Older rows without an id are matched by symbol, quantity and a 3-minute window.
- No naked sells. Before any live sell, the engine asks the broker what it actually holds. Nothing held means no order is sent and the hand close is booked instead; less held means it sells only that. This is the change that matters most: on 2026-09-11 four exit orders were sent for shares that had already been sold by hand, and the broker filled them as Sell to Open, leaving the account short SYY, SPY, SPXL and WEX over a weekend.
- Shorts are flagged, never traded. Any short equity position at the broker is written to the live state (broker_shorts) and journalled as LIVE_SHORT_AT_BROKER on every cycle until it is gone. The engines never short and never cover; a short in the account is yours to buy back by hand.
- Corrections. If a book’s record says the engine closed a trade but the broker shows that sell opened a short, the record is rewritten to the hand close that came earlier the same day and journalled as LIVE_CORRECTION.
Where it lives. Equity: ~/live_engines/live_book.py (reconcile(), confirm_fills(), the holding check in on_exit()), called from each engine’s poller. SPX: _reconcile_live_positions() and _confirm_live_fills() in server.py, on the RTH poll; the ledger builder applies LIVE_FILL rows. Dry runs that read the broker and write nothing: cd ~/stocks-server && .venv/bin/python ~/live_fills_preflight.py and cd ~/spx-server && .venv/bin/python ~/spx_fill_backfill.py (add --apply to write). A live page that disagrees with the app by more than cents means a cycle has not run yet (check journalctl -u stocks-server for reconcile) — not that the app is wrong.
Every card and every row on Strategies now carries the books it actually trades, verified against the droplet: PAPER (blue) means the rule runs on the practice bankroll, LIVE (green) means a real-money book runs alongside it, and RESEARCH (grey) means measured, not deployed. A rule showing both pills is a two-book rail. As of 2026-09-08 the two-book rails are: Adaptive Trend Harvester, the 15:30 Condor, the Stock engine, the ETF rotation and the Leveraged Mirror. Paper only: SPY Dip Calls, the Rolled ITM Vertical, the Volatility-Spike Bull Put, the 7DTE Momentum Spread and Night & Dip. When a book changes, change it in two places: tools/build_strategy_courses.py (the study cards) and the strategies array in subdomain_sites/pine/index.html (the numbered rows), then python3 tools/build_strategy_courses.py and deploy victorngoma-pine with --cwd.
📊 SPX Options Operations →▸
The full SPX playbook: the one live rail (VIDYA/RSI Harvester v1.2) and what was retired around it, the server premium stop — what it is, how to tune it, how to verify a fire — the daily operating workflow with JSON label verification, breakeven math, and the phase roadmap.
🎓 Lessons Learned & Best Practices →▸
What went wrong, what it cost, and the rule we follow now — trading lessons (trend, tails, optimistic backtests), data-integrity lessons (the −$10.9k ledger truth, the fake-VIX stub), server operations (kill -9, SSH prompt), and platform gotchas (asset caching, phantom 403s).
The two companies, in one picture▸
Everything runs on two providers. They do completely different jobs and neither can do the other’s.
| Cloudflare — the front door | DigitalOcean — the engine room |
|---|---|
|
|
One-line version: Cloudflare decides who gets in. DigitalOcean does the trading.
The two journeys a request can take▸
1. A member opens a strategy page.
- Their browser asks for victorngoma.com/spx.
- Cloudflare answers, and the Worker checks the D1 database: are they signed in, and does their plan allow this page?
- If yes, the Worker quietly fetches the page from spx.victorngoma.com — the droplet — and returns it. The member never sees that address.
- If no, they get the “contact the site administrator” notice and the droplet is never contacted.
2. An alert arrives (old chart alerts; today every strategy runs on the server).
- The alert posts to webhook.victorngoma.com.
- That address points straight at the droplet — Cloudflare is not involved.
- nginx receives it on 443 and passes it to the trading brain on 127.0.0.1:5005.
- The brain checks the webhook secret, runs the guards, and places the order.
Trading does not depend on Cloudflare. If Cloudflare had an outage, the website would go down but the engines would keep trading normally.
Which addresses go through Cloudflare, and which do not▸
Measured 2026-08-17 by checking for Cloudflare’s cf-ray response header:
| Address | Path | Protected by |
|---|---|---|
| victorngoma.com | Cloudflare | Worker login + tier gate |
| pine.victorngoma.com | Cloudflare | Worker (via /strategies) |
| advisory.victorngoma.com | Cloudflare | Worker + panel auth |
| spx / spy / etfs / stocks | direct to droplet | nginx Basic Auth |
| dashboard.victorngoma.com | direct to droplet | nginx Basic Auth |
| webhook.victorngoma.com | direct to droplet | webhook secret |
The direct ones are the origins the Worker proxies to, so they have to be reachable. Members never type them — they arrive via victorngoma.com paths. Hitting an origin directly returns 401 from nginx.
Consequence worth knowing: those addresses publish the droplet’s real IP, so they get no Cloudflare DDoS protection. That is the trade-off for the Worker being able to reach them. Note the inconsistency — advisory is proxied while the other panels are not; there is no strong reason for the difference.
What breaks if one of them has a bad day▸
| If this fails… | You lose | You keep |
|---|---|---|
| Cloudflare | the whole website, logins, every member-facing page | all trading — alerts, orders, the premium stop, journals |
| DigitalOcean droplet | all trading, the panels, the webhook, the data | the static pages (hub, academy, strategies, backtests) — they are on Cloudflare |
The droplet is the single point of failure that matters. That is why it carries: systemd auto-restart on every service, a 10-minute watchdog, nightly local archives, weekly DigitalOcean backups, and a known-good snapshot.
What is backed up, where, and how far back▸
| Backup | Covers | Where it lives | History |
|---|---|---|---|
| Nightly archive (vn_backup.sh, 23:30 UTC) | journals, ledger, reports, state, configs | same droplet, ~/backups/ | 60 days |
| DigitalOcean weekly backup | the entire machine | DigitalOcean, separate storage | 28 days |
| Snapshot verified-2026-08-17 | the entire machine, in a state verified working | DigitalOcean, separate storage | kept until deleted |
| Cloudflare D1 (member list) | users, roles, tiers | Cloudflare | Time Travel, 30 days |
| Code and site sources | everything buildable | Dropbox Local_Server/ on the Mac | Dropbox history |
The nightly archive protects against a deleted or corrupted file. It does not protect against losing the droplet, because it sits on the same disk. That is what the DigitalOcean backups and the snapshot are for. Both layers are needed.
Key facts & addresses▸
- VPS IP: 165.227.84.78 (DigitalOcean droplet "spx-server", Ubuntu 24.04)
- SSH user: victor
- Trading server path: /home/victor/spx-server/
- Trading service: spx-server.service (port 5005)
- Dashboard service: spx-dashboard.service (port 5006)
- Journal file: /home/victor/spx-server/journal/trades_journal_2026.csv
- URLs: hub = victorngoma.com · dashboard = dashboard.victorngoma.com · webhook = webhook.victorngoma.com · strategies = pine.victorngoma.com · runbook = runbook.victorngoma.com
- Cloudflare account: vngoma78@gmail.com
- Secrets location: your password manager (SSH passphrase, dashboard password, webhook secret)
- SPX safety net: the server premium stop closes any open SPX spread when its buyback cost reaches 2.5× the entry credit (live since 2026-07-30) — tuning and verification steps are in the SPX Options Operations guide
SSH into the VPS▸
Run this on your Mac (Terminal app), not on the server:
ssh victor@165.227.84.78
Enter your SSH passphrase when prompted (it's in your password manager). You'll land at a prompt that reads victor@spx-server:~$ — that confirms you're on the VPS.
If the prompt still says victorngoma@Victors-MacBook-Pro, you're still on your Mac — the SSH didn't connect. Re-run the command.
Download the full journal CSV to your Mac▸
Run this on your Mac (NOT on the VPS — open a fresh Mac terminal, do not SSH in first):
scp victor@165.227.84.78:/home/victor/spx-server/journal/trades_journal_2026.csv ~/Downloads/
Enter your SSH passphrase. The file lands in your Mac's ~/Downloads/ folder.
Check if the trading server is running▸
sudo systemctl status spx-server
Look for Active: active (running) in green. Press q to exit the view.
Restart the trading server▸
sudo systemctl restart spx-server
Then confirm it came back up:
sudo systemctl status spx-server
View the trading server log (live)▸
Tail the log to watch incoming webhooks in real time:
sudo tail -f /var/log/spx-server.log
Press Ctrl + C to stop watching.
To see just the last 50 lines:
sudo tail -50 /var/log/spx-server.log
Check / restart the dashboard▸
sudo systemctl status spx-dashboard
Restart if needed:
sudo systemctl restart spx-dashboard
Weekly watchlist update (newsletter list → strategy) — stopped▸
Stopped (Growth Stocks retired 10/11/2026). The Stocks engine traded a stock-picking newsletter’s Aggressive + Moderate "Buy" lists. Do this check about once a week:
- Open the newsletter’s scorecard page (Active tab).
- Select the whole page with Cmd+A, copy with Cmd+C. (Copy-paste beats screenshots — nothing gets misread or cut off.)
- Paste it to Claude with the message: "Weekly watchlist update — here is the newsletter paste."
- Claude runs stocks_strategy/update_universe.py against it and reports three lists: ADD (new recommendations), REMOVE (dropped ones), UNCHANGED.
- You approve. Rules Claude follows: a stock with an open position is never removed until it closes; multi-symbol rows (spinoffs, share classes) are flagged for your call, never auto-added.
- Claude updates the universe file, the trading server (deploy + restart), and regenerates the three alert scripts if tickers changed.
- Your only manual step: if scripts changed, re-paste them into the old chart alerts (see the alert-script procedure below). New stocks only trade once their script group is updated there.
Master file: Local_Server/stocks_strategy/stocks_universe.json — every ticker with its sector fund, strategy (S1/S3/S6), and script group (A/B/C).
Alert scripts & old chart alerts (Stocks A / B / C) — stopped▸
The old chart platform limited one script to 40 watched symbols, so the stocks universe is split into three generated scripts: A = technology, B = consumer/financial/industrial, C = everything else. Each needs exactly one alert.
To update a script (after a watchlist change):
- Find the files in Finder → Dropbox → Mac → Downloads → Local_Server → the alert-script folder: stocks_multi_strategy_A, _B, _C.
- Open the changed file in TextEdit, Cmd+A, Cmd+C.
- In the old chart platform: script editor (bottom of window) → open your saved script of the same letter → Cmd+A, Cmd+V → Save. The chart updates itself; the existing alert keeps working.
Creating an alert from scratch: alarm-clock icon → Create alert → Condition = the script → "Any alert() function call" → Notifications tab → tick Webhook URL and paste the webhook address (ends in ?secret=… — it's in your password manager, never in the script).
Each script also draws a small table on the chart's right edge showing its open positions. Settings → Inputs has checkboxes to hide it or show all stocks.
Restart a trading brain or panel (the safe way)▸
All four brains and the panels restart automatically only if they die "by accident". A polite stop looks intentional, so the supervisor leaves them dead.
After SSH'ing in (prompt must say victor@spx-server), restart the stocks brain like this:
kill -9 $(pgrep -f "stocks-server/.venv/bin/python stocks_server.py" | head -1)
Then confirm it came back (should print "ok":true):
sleep 8; curl -s http://127.0.0.1:5109/health
Ports: SPX brain 5005 · ETF brain 5107 · stocks brain 5109 · panels 5106/5108/5110/5111 · dashboard 5006.
Change position size or max open positions▸
Each brain reads a config file at startup. Current settings (2026-09-04): stocks = $500/position, max 25 open; ETF = $500/position, max 5 open; leveraged mirror = $500/position, max 10 open. Paper and live use the same slice. A share priced above $500 is bought as ONE share, never skipped.
- Stocks brain: /home/victor/stocks-server/stocks_config.json
- ETF brain: /home/victor/etf-server/etf_config.json
Edit the number (position_value or max_concurrent_positions), then restart that brain with the kill -9 procedure above. Changes affect new positions only — anything already open keeps its original size until it exits.
Easiest: just ask Claude — "set the stocks brain to $2,000 per position" — and it will edit, restart, and verify.
Manage member plans (tiers) in /admin▸
Members have a plan (matrix updated 2026-07-31): Observer (hub home only) → Member (adds the seven live strategy pages and the hub positions feed) → Pro (adds Live Dashboard, Strategies overview, Backtests, Advisory). Documentation and Runbook are owner/admin only — never part of any plan. Every page is enforced by the worker on every click, so changing a plan takes effect immediately in both directions; below-plan clicks show a "contact the site administrator" notice.
- Go to victorngoma.com/admin.
- In the user table, use the Plan dropdown next to a member — it saves instantly.
- When inviting someone, pick their plan in the invite form.
The same page shows Recent visits: who opened the site, when (Chicago time), roughly how long, and how many pages.
Add a new user to a locked tool▸
- Go to Cloudflare dashboard → Zero Trust
- Access controls → Policies
- Click the policy for the tool (e.g. pine-allowed-users) — pick the one with Used by applications = 1
- Click Configure
- Under Include → Value, type the new email and add it
- Click Save policy
The new person can now log in to that tool via email PIN code. Each tool has its own policy/allowlist — add someone to one tool without affecting others.
To remove someone: same steps, click the × on their email chip, then Save.
Update a hub or subdomain page▸
- Edit the index.html file in the matching Mac folder (e.g. victorngoma-hub, victorngoma-pine)
- Cloudflare dashboard → Workers & Pages → click the project (e.g. victorngoma-pine)
- Create deployment (or drag-and-drop the updated folder)
- Upload the new index.html → Deploy
Keep the filename index.html — Cloudflare serves that as the page automatically. Keep each project's files in its own folder.
Add a brand-new locked subdomain▸
Part 1 — deploy the page:
- Make a new Mac folder with an index.html inside
- Cloudflare → Workers & Pages → Create application → Pages → "Get started" next to "Drag and drop your files"
- Project name (e.g. victorngoma-docs) → Create project → upload folder → Deploy
- Custom domains tab → Set up a custom domain → enter the subdomain (e.g. docs.victorngoma.com) → Activate
Part 2 — lock it:
- Zero Trust → Access controls → Applications → Add an application
- Self-hosted and private → Public DNS → Continue
- Destinations: Subdomain = the subdomain, Domain = victorngoma.com, Path = empty
- Access policies → Create new policy → name it, Action = Allow, Include → Selector = Emails → add emails → Save policy
- Authentication: "Accept all available identity providers" = ON
- Details: Name it, Session Duration 24h → Create
Test in a fresh Incognito window (or phone) — you should hit the Cloudflare Access email login. If it loads straight through, the lock isn't active.
Verify a locked page is actually protected▸
- Open a fresh Incognito window, or use your phone
- Visit the subdomain
- You should see the Cloudflare Access email login page
- An email NOT on the allowlist should be denied; an allowed email gets a PIN code by email
If the page loads with no login prompt, the lock isn't working — check the Application exists and its DNS record is orange-clouded (proxied).