Skip to content

JakubIwicki/SlopBot

Repository files navigation

SlopBot

Algorithmic trading engine for Capital.com — streaming market data, ML-driven predictions, and automated position management in .NET.

flowchart TB
    WS[Capital.com WebSocket]

    subgraph Engine["Trading Engine"]
        MDIS[MarketDataIngestionService]
        ODC["OhlcDataChannel (Channel)"]
        MSC["MovingStopLossChannel (Channel)"]
        TBC["TimeBarrierChannel (Channel)"]
    end

    subgraph Core["Bot Coordination"]
        SBSC[SlopBotCoordinationService]
        TFS[TimeframeSynchronizer]
        HDC[HistoricalDataCache]
        OSC[OhlcStateCache]
    end

    subgraph Bot["SloppyBot"]
        SBC[SlopBotCalculator]
        STFP[SlopTimeFrameProcessor]
        IND["10+ Technical Indicators"]
    end

    subgraph Workers["Position Management"]
        MSLW[MovingStopLossWorker]
        TBW[TimeBarrierWorker]
    end

    DJ[Django ML API]
    CTC[CapitalComTradingCalculator]
    CAP[Capital.com REST API]

    WS --> MDIS
    MDIS --> ODC & MSC & TBC
    ODC --> SBSC
    SBSC --> TFS --> Bot
    SBC --> STFP --> IND --> DJ --> SBC
    SBC --> CTC --> CAP
    MSC --> MSLW --> CAP
    TBC --> TBW --> CAP
    SBSC -.-> HDC
    SBSC -.-> OSC
Loading

Architecture Patterns

  • Producer-consumer pipelines via System.Threading.Channels — lock-free, bounded, with backpressure
  • Per-account session isolation via AccountSessionProvider — multi-tenant safe
  • Timeframe synchronization — LTF/HTF alignment with deduplication and gap detection
  • Dynamic position sizing — ATR-based risk calculation with configurable multipliers
  • Trailing stop-loss — step-based tightening as price moves toward take-profit
  • Time barriers — auto-close positions exceeding candle-count limits per direction

Project Map

Project What It Does
api.SlopBot.net Engine host — bootstrapper, coordination, workers, channels
TradingApi.Capital HTTP + WebSocket client for Capital.com with session lifecycle
Trading.Api.Django HTTP client for external ML prediction API
TradingApi.Common Shared DTOs, indicators, calculators, WebSocket subscription types
TradingApi.Cron Standalone job host — bot loop, position worker
TradingApiConsole CLI tool — downloads daily OHLCV for 300+ US stocks
TradingApi.EmFxDownloader CLI tool — downloads EM FX CFD data
TradingApi.Formatter Market data formatting utilities
TradingApi.Tests xUnit + Moq — indicators, calculators, bots, integration tests

Tech

.NET 9/10 · ASP.NET Core · System.Threading.Channels · xUnit · Moq · Serilog · Capital.com API · Django ML API · XGBoost

About

Algorithmic trading engine for Capital.com — streaming market data, ML-driven predictions, and automated position management in .NET

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages