This document maps the current backend modules to their responsibilities and clarifies what each service does today.
Responsibilities:
- creates the FastAPI app
- configures CORS for the Vite frontend
- registers all routers
- exposes
/health - exposes
WS /runs/{run_id}/stream - exposes placeholder
WS /ws/stream
Responsibilities:
- preview a source
- save a normalized dataset
- list saved datasets
Important note:
- the public source contract includes
polygon, but the current implementation only loads Excel and CSV files
Responsibilities:
- list runs
- fetch a run by ID
- create replay runs
- create live runs
Request contract:
dataset_idrun_configpython_artifact- optional
pine_artifact - optional
bridge_artifact_id
Responsibilities:
- list manual Pine bridge artifacts
- save manual Pine bridge artifacts
Responsibilities:
- list permission grant history
- create a grant or revocation entry
Responsibilities:
- expose Ollama health information
- list local models
- proxy chat requests through
ChatService
Responsibilities:
- report whether backend dependencies are available
Responsibilities:
- expose a sample comparison endpoint for development or demo use
Important note:
- this endpoint is not part of the main user workflow
Responsibilities:
- inspect Excel and CSV sources
- infer column mapping
- load source frames
- normalize timestamps and OHLCV fields
- convert normalized frames into
CandlePoint[] - describe source capabilities
Current limitations:
- no provider-backed fetch implementation
- no resampling engine
- no calendar or session filtering
Responsibilities:
- run user Python strategy code
- limit imports to an allowlist
- require
run_strategy(frame)to return apandas.DataFrame - derive indicator series from numeric or boolean result columns
- derive simple long entry and exit trade events from
long_condition
Current limitations:
- this is not a hardened sandbox
- there is no resource isolation beyond a limited import surface
- trade extraction is based only on
long_condition - short logic and richer order models are not implemented
Responsibilities:
- compare Pine and Python indicator series
- compare Pine and Python trades
- classify mismatches
- produce
ComparisonResult
Responsibilities:
- wrap
DataManagerfor preview and save flows - create dataset artifacts and persist metadata
- load saved dataset frames from CSV
Storage behavior:
- normalized data is written to CSV
- dataset metadata is written to JSON index files
Responsibilities:
- create replay runs
- create live runs
- persist run state
- resolve bridge artifacts
- call the Python engine
- call the comparison engine
- emit latest live event snapshots
Current live behavior:
- implemented with a background thread
- increments one bar per second
- recalculates Python outputs on each step
Current limitations:
- in-process background thread instead of dedicated worker
- no cancel or pause control
- no distributed job handling
Responsibilities:
- persist bridge artifacts as JSON
- list bridge artifacts
- fetch bridge artifacts by ID
Responsibilities:
- append permission grants to storage
- check active access for a target and access level
- list permission history
Current limitations:
- append-only history rather than a richer access-control model
- no user identity layer
Responsibilities:
- validate chat intent conditions
- enforce write approval for
apply_fix - call
OllamaClient - convert errors into structured fallback responses
- add mismatch context into fallback responses
- log per-request status
Responsibilities:
- discover local models
- classify chat-capable versus embedding-only models
- send plain-text requests to Ollama
- sanitize noisy model output
- raise structured chat errors
Responsibilities:
- report backend availability
- test Ollama binary presence and API reachability
- report bridge capability
- report market provider key presence
Responsibilities:
- create artifact directories
- manage JSON index files
- upsert records
- read and write JSON payloads
Important note:
- this is the active persistence layer today
- SQLite and DuckDB settings exist in configuration, but are not yet used by the storage implementation
Responsibilities:
- keep frontend and backend payload shapes aligned
- define datasets, runs, strategies, indicator series, trades, comparison, permissions, and chat contracts
Responsibilities:
- centralize environment-backed settings
- define default Ollama path
- define target paths for planned SQLite and DuckDB integration
Important note:
- several settings describe the target architecture, not the current active persistence implementation