sYnapse
sYnapse is a modern, unified agentic trading gateway designed to interface with various broker APIs, enabling secure, autonomous, and low-latency algorithmic trading. Built to run on edge infrastructure, it coordinates and executes trades on both equity and futures markets while providing real-time telemetry on active positions, capital allocation, and order statuses.
System Architecture
Execution & Compute
| Runtime | Cloudflare Workers (Edge Compute) |
| Language | TypeScript, React (Frontend) |
| UI Bundler | Vite |
| SSO Gateway | sYnID (OpenAuth.js) |
Data & State
| Broker Link | Durable Objects (WebSockets) |
| Database | Cloudflare D1 (Serverless SQL) |
| Storage | Cloudflare KV (Configuration caching) |
| Security | Cloudflare Turnstile (Anti-Bot) |
Multi-Broker Strategy Orchestration: The backend worker uses modular adapters to talk to both Alpaca API (equities/options) and Tradovate API (futures), allowing a single agentic strategy to hedge across asset classes.
Core Features
- Secure Broker Gateways — Handles OAuth, session refreshes, and encrypted API keys securely at the edge.
- Durable WebSockets — Maintains constant, low-latency socket connections to broker data streams using Cloudflare Durable Objects.
- State Management — Logs orders, trades, and strategy metrics into a serverless SQL database (D1) for analytics.
- Single Sign-On (SSO) — Seamless authentication integration using the shared domain’s sYnID provider.
- Strategy Backtesting — Historical backtesting engine that simulates performance, returns trades, equity curves, metrics, and visualizes indicators.
Supported Strategies
- MACD Crossover (
macd_crossover) — Computes fast/slow EMAs and a signal line, triggering signals on crossover events. - Donchian Channel Breakout (
donchian_breakout) — Computes rolling high/low bounds, buying breakouts on the upper channel and selling on the lower channel. - Z-Score Mean Reversion (
zscore_reversion) — Measures standard deviations from SMA to buy oversold assets (Z-Score < -2.0) and sell overbought ones (Z-Score > 2.0). - Congressional Political Trades (
political_trades) — Automates positions based on US House and Senate STOCK Act filings, synced via S3 to SQLite/D1 to build a custom Congressional Sentiment Index (CSI).
Technical Organization
The application repository is split into a deployable edge backend and a single-page administration UI:
src/worker.ts: Worker API endpoints, cron executor, and static asset servingsrc/brokers/*: Broker client wrappers (Alpaca, Tradovate) and authentication managersweb/: React UI dashboard for configuration, manual order override, and strategy performance visualization