Step vocabulary gains `waitFor`: block until a selector exists, then continue. Nothing is clicked or typed — it is a gate for conditions something outside the run has to satisfy. Unlike every other step it carries no signed-out guard, because the things worth gating on often sit on the login page, where that guard would abort the run at exactly the wrong moment. Honours the dashboard's Stop button, since a two-minute gate that ignored it would be worse than no gate. Session handling. A run that lands on the login page must not continue: once redirected, every selector resolves against a login form, so a click aimed at "Add Account" hits whatever that form renders in the same place. Runs now detect the redirect and stop before sending any input, with a distinct SignedOutError rather than a generic failure. Two ways out of that state, in order: a firm's `authSteps` run and the failed step is retried, or — when none are defined — the run pauses for signedOutWaitSeconds so a human can sign in, then resumes. Auth steps are verified rather than trusted: they can all "succeed" while the site still rejects the sign-in, so the session is re-checked before the retry, and the run stops with "auth steps ran but the session is still signed out" if it did not take. That check polls for up to 20s instead of reading once. Submitting a login form starts a network round trip and then a redirect, so the tab still shows the login URL for a second or two afterwards; checking immediately failed a sign-in that was merely in flight, killing run #15 nine seconds after it had actually worked. Third instance of the same mistake in this system — reading page state immediately after an action that triggers async navigation. The runner reports its version in the heartbeat and the dashboard blocks the buttons when it is behind. A running Python process does not reload when the source changes, so a stale runner fails on step types it predates; that cost a debugging round when a navigate step reached a runner that had never heard of one. lib/automations.ts carries the Tradeify buy-accounts flow: navigate to the dashboard, open Add Account, pick the account type and size, enter the account name, and work through the challenge widget before submitting. Selectors are authored by hand against the live page. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
AutoFirmer
Automated futures trading dashboard for prop firm accounts via Tradovate.
VPS Setup (Windows Server 2019 / 2022)
All commands are run in PowerShell (run as Administrator).
1. Install Git
Download and install from https://git-scm.com/download/win, or via winget:
winget install --id Git.Git -e --source winget
Restart PowerShell after installing so git is on the PATH.
2. Install Node.js 22+
winget install --id OpenJS.NodeJS.LTS -e --source winget
Restart PowerShell, then verify:
node --version # should be v22.x or higher
npm --version
3. Install Windows Build Tools (required for better-sqlite3)
better-sqlite3 compiles a native C++ module and needs the Visual Studio build tools:
npm install -g windows-build-tools
If that fails on newer Node, install manually:
- Download Build Tools for Visual Studio from https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022
- During install, select "Desktop development with C++"
4. Clone the repo
git clone https://github.com/Senofy/autofirmer.git
cd autofirmer
5. Install dependencies
npm install
6. Build
npm run build
7. Run
Development (with hot reload):
npm run dev
Production:
npm start
The app runs on port 3000. Access it at http://<your-vps-ip>:3000.
First-time setup
On first run, the SQLite database (autotrader.sqlite) is created automatically in the project root. No migrations need to be run manually.
Open the app in your browser and add your firms through the UI:
- Click + Add Firm on the main page
- Enter the firm name, Tradovate username, and password
- Go to the firm's Settings page to configure account types (prefix, profit target, consistency %, etc.)
- Return to the main page — accounts will populate once the firm connects to Tradovate
Keeping it running (PM2)
Install PM2 globally:
npm install -g pm2
npm install -g pm2-windows-startup
Start the app and save the process list:
cd C:\path\to\autofirmer
pm2 start "npm start" --name autofirmer
pm2 save
pm2-startup install
To restart after pulling updates:
cd C:\path\to\autofirmer
git pull
npm install
npm run build
pm2 restart autofirmer
Firewall
To restrict port 3000 to a specific trusted IP only:
New-NetFirewallRule -DisplayName "AutoFirmer" -Direction Inbound -Protocol TCP -LocalPort 3000 -RemoteAddress <your-ip> -Action Allow
Or open it to all inbound (less secure):
New-NetFirewallRule -DisplayName "AutoFirmer" -Direction Inbound -Protocol TCP -LocalPort 3000 -Action Allow
Updating
cd C:\path\to\autofirmer
git pull
npm install # only needed if dependencies changed
npm run build
pm2 restart autofirmer