System Architecture

This document provides a comprehensive overview of the system architecture for the Signal trading platform, covering the core AI decision-making pipeline, mathematical analysis engine, service-oriented design patterns, and micro-frontend architecture. For detailed information about individual trading components, see Trading Components. For agent system implementation details, see Agent System Reference.

The Signal platform implements a sophisticated three-layer architecture combining AI-driven decision making, mathematical analysis, and distributed frontend components.

Mermaid Diagram

The core decision-making system implements a three-stage AI pipeline that mimics professional trader thinking patterns, with each stage serving a specific function in the trading workflow.

Mermaid Diagram

Each stage implements adaptive Time-To-Live intervals that adjust based on market conditions and position profitability:

Stage TTL Type Interval Condition
SignalOutline BULLISH_TTL 2.5 minutes position="long"
SignalOutline BEARISH_TTL 1.5 minutes position="short"
SignalOutline NEUTRAL_TTL 5 minutes position="wait"
CloseOutline PROFIT_RISING_TTL 2.5 minutes Profit growing, price rising
CloseOutline PROFIT_FALLING_TTL 1.0 minutes Profit declining, price falling
CloseOutline LOSS_RISING_TTL 5 minutes Loss shrinking, price rising
CloseOutline LOSS_FALLING_TTL 5 minutes Loss growing, price falling
RiskOutline CHECK_TTL 15 minutes Global condition assessment

The system employs six specialized mathematical services that provide comprehensive technical analysis across multiple timeframes, each optimized for specific trading strategies.

Mermaid Diagram

Each mathematical service implements specific indicator configurations optimized for its timeframe and trading strategy:

Short-term Scalping (15-minute candles):

  • Data: 144 candles spanning 36 hours
  • Fast indicators: RSI(9), StochRSI(9), MACD(8,21,5)
  • Tight Bollinger Bands(10,2.0) for precise signals
  • Quick moving averages: EMA(8), EMA(21)

Swing Trading (30-minute candles):

  • Data: 96 candles spanning 48 hours
  • Balanced indicators: RSI(14), StochRSI(14), MACD(12,26,9)
  • Standard Bollinger Bands(20,2)
  • Medium-term averages: EMA(13), EMA(34), SMA(20)

Position Trading (1-hour candles):

  • Data: 48 candles spanning 48 hours
  • Comprehensive suite: RSI(14), MACD(12,26,9), Signal(9)
  • Long-term averages: SMA(50), EMA(20), EMA(34), DEMA(21)
  • Trend strength: ATR(14/20), Momentum(10), ADX(14), CCI(20)

The system implements a sophisticated dependency injection container with service-oriented design patterns, ensuring loose coupling and high testability.

Mermaid Diagram

The DI container follows a consistent registration pattern for all services:

// Core service registration example
container.bind<SignalLogicService>(TYPES.signalLogicService).to(SignalLogicService);
container.bind<BinanceService>(TYPES.binanceService).to(BinanceService);
container.bind<SettingsConnectionService>(TYPES.settingsConnectionService).to(SettingsConnectionService);

// Math services registration
container.bind<ShortTermMathService>(TYPES.shortTermMathService).to(ShortTermMathService);
container.bind<SwingTermMathService>(TYPES.swingTermMathService).to(SwingTermMathService);
container.bind<LongTermMathService>(TYPES.longTermMathService).to(LongTermMathService);

The platform implements eight independent React applications, each serving specific business functions with autonomous deployment capabilities.

Mermaid Diagram

Each micro-frontend serves distinct functional requirements:

Application Port Primary Features Key Components
about-app 3000 System information, project details About pages, contact info
candle-app 3000 Candlestick analysis with charts MainView, CoinView, DataView, lightweight-charts
chat-app 3000 Multi-agent AI consultation MainView, Agent Swarm integration
kpi-app 3000 Trading performance dashboard MainView, revenue metrics, cryptocurrency-icons
news-app 3000 Cryptocurrency news aggregation MainView, CoinView, social signals
setup-app 3000 System configuration interface MainView, SetupView, StateView, ExportView
signal-app 3000 Trading signals management MainView, signal monitoring
strategy-app 3000 Strategy analysis and backtesting MainView, CoinView, performance analysis

The platform implements a multi-agent AI consultation system with specialized cryptocurrency consultants coordinated through a central triage mechanism.

Mermaid Diagram

The system implements sophisticated AI model selection through the InferenceMetaService, supporting multiple providers:

Available AI Providers:

  • HuggingFace: openai/gpt-oss-120b, DeepSeek-R1, DeepSeek-V3
  • xAI: grok-3, grok-3-mini
  • Ollama: gpt-oss:120b, deepseek-r1:671b, deepseek-v3:671b

The getActiveInference() method checks Boolean flags in SettingsConnectionService to determine the active model, with automatic fallback to the default model.

The system implements enterprise-grade configuration management with Redis-based storage, feature flags, and sophisticated UI-to-backend mapping.

Mermaid Diagram

The system manages three primary configuration categories:

Signal Strength Control (5 levels):

  • UI: Single slider (1-5)
  • Backend: 5 Boolean flags (isSignalStrengthMinimal through isSignalStrengthMaximal)
  • Integration: SignalCoreService.CHECK_SIGNAL_RANGE_FN validates TP/SL thresholds
  • Ranges: TP 0.5%-3.0%, SL 0.25%-1.5%

AI Behavior Feature Control (6 filters):

  • Signal Risk Filter: Trend coherence requirement
  • Signal Volume Filter: Volume growth requirement
  • Signal Overlap Filter: Position conflict protection
  • Close Risk Filter: Bull market holding logic
  • Close With Profit Filter: Early profitable closure
  • Close With Loss Filter: Early loss-cutting closure

LLM Selection Control (8 models):

  • UI: Dropdown selection
  • Backend: 8 Boolean flags (isInferenceSelection0 through isInferenceSelection7)
  • Integration: InferenceMetaService.getActiveInference() provides dynamic model selection

The system uses a hybrid storage approach with MongoDB for time-series trading data and Redis for configuration and caching.

Mermaid Diagram

The architecture demonstrates enterprise-grade design patterns with clear separation of concerns, comprehensive dependency injection, and sophisticated configuration management. The three-stage AI pipeline provides professional-level trading decision making while the micro-frontend architecture ensures maintainable and scalable user interfaces.