Skip to content

Tradeboard Design Documentation ​

This directory describes the implemented architecture of Tradeboard 2.0.2.2. Tradeboard is a self-hosted, single-user trading application with a Flask/Flask-RESTX backend, React 19 frontend, broker plugins, a separate WebSocket proxy, sandbox execution, hosted strategies, Flow automation, portfolio analytics, chart trading, and optional local or remote MCP access.

The current inventory is 36 broker plugins: 34 securities brokers, Delta Exchange for crypto derivatives, and a Dhan sandbox plugin for paper trading. Every one of the 36 has a plugin.json. Broker capabilities are metadata-driven; a plugin's presence does not imply every optional broker operation is supported.

Documentation Policy ​

  • Code and registered routes are authoritative when a design document conflicts with an example.
  • The public REST contract lives in the API documentation.
  • Flask-RESTX Swagger/OpenAPI UI is intentionally disabled with doc=False in restx_api/__init__.py. Do not advertise or re-enable /api/docs as part of documentation maintenance.
  • These pages describe implemented behavior verified against the application code and registered routes.

Runtime And Core Architecture ​

ModuleDescription
00 Directory StructureCurrent repository boundaries and ownership
01 FrontendReact 19, Vite 8, routing, state, data access
02 BackendFlask factory, route layers, services, background work
04 Cache ArchitectureIn-process caches and invalidation behavior
17 Connection PoolingHTTP and market-data connection reuse
18 Database StructureSQLite and DuckDB stores, NullPool, teardown
20 Design PrinciplesLocal conventions and architectural constraints
27 Service LayerRoute-to-service-to-broker boundaries
31 UtilitiesShared auth, config, logging, networking helpers
34 App StartupValidation, registration, initialization, server startup
53 Event BusPer-process async side-effect dispatch

Authentication And Security ​

ModuleDescription
03 Login And Broker FlowApp auth, TOTP, broker selection, session resume
05 Security ArchitectureKeys, encryption, CSRF, CORS, CSP, middleware
23 IP SecurityIP extraction, bans, proxy trust
24 Browser SecurityCookies, CSRF, CSP, hardening headers
40 Logout And Session LifecycleDaily expiry, heartbeat, reconnect, multi-session behavior
47 SMTP ConfigurationMail configuration and diagnostics
48 Password ResetReset flow and password change revocation
50 TOTP ConfigurationPer-purpose two-factor policy

Trading, Data, And Automation ​

ModuleDescription
06 WebSocketsProxy protocol, ZMQ fan-in, adapters, subscriptions
07 SandboxAnalyzer execution engine and isolated state
08 HistorifyDuckDB historical-data subsystem
09 REST APIRegistered v1 architecture; Swagger intentionally disabled
10 FlowVisual workflow storage and execution
13 ChartinkScanner automation
14 TradingView And GoChartingJSON integration surfaces
19 PlaceOrder FlowValidation, mode routing, Action Center, broker calls
32 Master ContractBroker instrument downloads and cache policy
33 Broker FolderPlugin module convention
38 Python StrategiesHosted-process model and logs
39 Strategy RMS EngineDurable multi-leg and signal lifecycle, RMS, recovery, RESTX, and webhooks
42 Action CenterSemi-auto order approval
54 Scalping TerminalKeyboard trading, charts, persisted stops, risk monitor
55 Portfolio AnalyticsRead-only backtesting and current-holdings scenario analysis

UI, Tools, And Integrations ​

ModuleDescription
15 Basic UI And AnalyticsCurrent React pages and analytics tools
37 API Key And PlaygroundAPI key management and WebSocket tester
41 MCP ArchitectureLocal stdio and opt-in remote OAuth transport
43 Telegram BotBot lifecycle, commands, automatic and explicit alerts
44 Toast NotificationsBrowser notification categories
44 PnL TrackerLive P&L charting
46 SearchContract and underlying search
49 ThemesTheme and accent persistence
51 Broker And System ConfigEnvironment and broker configuration boundaries
52 Broker FactoryWebSocket adapter construction

Operations And Deployment ​

ModuleDescription
11 DockerContainer build and compose runtime
12 Ubuntu ServerHost deployment
16 Centralized LoggingPython logs and file retention
21 Admin SectionRuntime and Remote MCP administration
22 Log SectionOrder and analyzer log views
25 Latency MonitorAPI timing data
26 Traffic LogsRequest telemetry and ban support
28 Environment Configuration.env contract
29 Ngrok ConfigurationTunnel management
30 Upgrade ProcedureUpgrade and backup flow
35 Development And TestingLocal checks and CI coverage
36 Rate LimitingLimiter configuration and endpoint classes