Files
Finlytic/FinlyticTrades/Project.md
T

1.8 KiB

Finlytic Trades Service

Finlytic Trades is a C# microservice managing the full lifecycle of automated trade signals and positions. It handles proposed trade validation, position tracking, TTL expiration, hourly performance updates, and trade closure.


Core Modules & Architecture

  1. Trade Lifecycle Engine (ITradeLifecycleService):

    • Ingests trade proposals (TradeProposalDto), validates parameters (Entry, Stop Loss, Take Profit, Win Rate, Risk Tolerance), and tracks positions through Active, Closed, Expired, or Cancelled states.
  2. TTL Worker Service (TtlWorkerService):

    • Periodically checks active trades against Time-To-Live (TtlMinutes) constraints and automatically expires stale trades.
  3. Feedback Exporter Engine (FeedbackExporterEngine):

    • Exports trade outcome data (TradeFeedbackRecord) for AI model retraining and win-rate calibration.
  4. MQTT RPC & Event Communication:

    • Subscribes to finlytic/trades/proposed/# and finlytic/trades/updates/#.
    • Handles RPC requests on finlytic/trades/get_active/request and finlytic/trades/close/request/#.
    • Publishes position updates to finlytic/trades/update and finlytic/trades/get_active/response.

Feature Status

Implemented Features

  • Full Trade Lifecycle Management (TradesDbContext with PostgreSQL indexes).
  • Automated TTL Expiration Worker (TtlWorkerService).
  • AI Feedback Record Exporter (FeedbackExporterEngine).
  • Pure Worker Service Architecture (Host.CreateApplicationBuilder, Kestrel HTTP server removed).
  • Zero-Allocation MQTT RPC handlers for active trades & trade closure.

Planned Features

  • Automated Trailing Stop Loss adjustment engine based on ATR (Average True Range).
  • Direct Broker API Execution integration (Trade Republic / Interactive Brokers automated order placement).