# mohammedalrawi1/zeromq-mt5-bot architecture

> Architecture diagram of the GitHub repository mohammedalrawi1/zeromq-mt5-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohammedalrawi1/zeromq-mt5-bot
- Repository: https://github.com/mohammedalrawi1/zeromq-mt5-bot

## Overview

ZeroMQ-MT5-Bot is a web dashboard and server for creating and monitoring trading strategies executed through an MT5 connection. The main workflow runs from dashboard trade entry, through authenticated server handling and Bot strategy/trade management, to MT request transport and the broker; the server also exposes trade history and economic-calendar news. Dashboard modules cover trade forms, live trade views, history, and news. The README provides no architectural detail, and unsampled source limits confirmation of several UI and socket relationships.

Main entry points: [`server.js`](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/server.js) (Express routes and auth), [`Bot.js`](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/Bot.js) (Strategy and trade manager), [`public/dashboard/modules/pages/TradesPage.js`](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/pages/TradesPage.js) (Trade entry), [`MongoDB.js`](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/MongoDB.js) (MongoDB access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_login["Login client<br/>[script.js]"]
  node_dashboard["Dashboard app<br/>[App.js]"]
  node_tradeform["Trade entry<br/>[TradesPage.js]"]
  node_tradeviews["Trade views<br/>[Trade.js]"]
  node_historyview["Trade history view<br/>[HistoryTrade.js]"]
  node_historypage["History page<br/>[HistoryPage.js]"]
  node_newsui["News dashboard<br/>[NewsContainer.js]"]
end

subgraph group_api["Server API"]
  node_http["Express routes and auth<br/>[server.js]"]
  node_dbhelper["MongoDB access<br/>[MongoDB.js]"]
end

subgraph group_trading["Trade execution"]
  node_bot["Strategy and trade manager<br/>[Bot.js]"]
  node_mt["MT command and event adapter<br/>[MT.js]"]
  node_buffer["Request queue<br/>[ZMQBuffer.js]"]
end

subgraph group_integration["External integrations"]
  node_calendar["Economic calendar fetcher<br/>[NewsScraper.js]"]
  node_mongodb[("MongoDB")]
  node_mt5["MT5 service"]
  node_calendarservice["Economic calendar service"]
end

node_trader(("Trader"))

node_trader -.->|"signs in"| node_login
node_trader -.->|"enters trade"| node_tradeform
node_login -.->|"submits credentials"| node_http
node_dashboard -->|"updates"| node_tradeviews
node_dashboard -->|"fetches trades"| node_http
node_tradeform -->|"posts trade"| node_http
node_historypage -.->|"renders"| node_historyview
node_tradeform -.->|"selects news"| node_newsui
node_http -->|"creates trade"| node_bot
node_http -->|"closes trade"| node_bot
node_http -->|"reads history"| node_dbhelper
node_http -->|"requests news"| node_calendar
node_bot -->|"manages positions"| node_mt
node_bot -->|"persists trade data"| node_dbhelper
node_mt -->|"sends requests"| node_buffer
node_buffer -->|"sends ZeroMQ requests"| node_mt5
node_mt5 -->|"publishes updates"| node_mt
node_dbhelper -->|"reads and writes"| node_mongodb
node_calendar -->|"fetches events"| node_calendarservice

click node_login "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/login/script.js"
click node_dashboard "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/App.js"
click node_tradeform "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/pages/TradesPage.js"
click node_tradeviews "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/Trade.js"
click node_historyview "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/HistoryTrade.js"
click node_historypage "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/pages/HistoryPage.js"
click node_newsui "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/NewsContainer.js"
click node_http "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/server.js"
click node_bot "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/Bot.js"
click node_mt "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/MT.js"
click node_buffer "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/ZMQBuffer.js"
click node_dbhelper "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/MongoDB.js"
click node_calendar "https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/NewsScraper.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_login,node_dashboard,node_tradeform,node_tradeviews,node_historyview,node_historypage,node_newsui toneBlue
class node_http,node_dbhelper toneAmber
class node_bot,node_mt,node_buffer toneMint
class node_calendar,node_mongodb,node_mt5,node_calendarservice toneRose
class node_trader toneIndigo
```

## Components

### Web interface

- [Login client](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/login/script.js): `public/login/script.js`
- [Dashboard app](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/App.js): `public/dashboard/modules/App.js`
- [Trade entry](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/pages/TradesPage.js): `public/dashboard/modules/pages/TradesPage.js`
- [Trade views](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/Trade.js): `public/dashboard/modules/Trade.js`
- [Trade history view](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/HistoryTrade.js): `public/dashboard/modules/HistoryTrade.js`
- [History page](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/pages/HistoryPage.js): `public/dashboard/modules/pages/HistoryPage.js`
- [News dashboard](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/public/dashboard/modules/NewsContainer.js): `public/dashboard/modules/NewsContainer.js`

### Server API

- [Express routes and auth](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/server.js): `server.js`
- [MongoDB access](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/MongoDB.js): `MongoDB.js`

### Trade execution

- [Strategy and trade manager](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/Bot.js): `Bot.js`
- [MT command and event adapter](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/MT.js): `MT.js`
- [Request queue](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/ZMQBuffer.js): `ZMQBuffer.js`

### External integrations

- [Economic calendar fetcher](https://github.com/mohammedalrawi1/zeromq-mt5-bot/blob/main/NewsScraper.js): `NewsScraper.js`
- **MongoDB**
- **MT5 service**
- **Economic calendar service**

### Other components

- **Trader**

## Connections

- Trader → Login client: signs in
- Trader → Trade entry: enters trade
- Login client → Express routes and auth: submits credentials
- Dashboard app → Trade views: updates (evidence: `public/dashboard/modules/App.js`)
- Dashboard app → Express routes and auth: fetches trades (evidence: `public/dashboard/modules/App.js`)
- Trade entry → Express routes and auth: posts trade (evidence: `public/dashboard/modules/pages/TradesPage.js`)
- History page → Trade history view: renders
- Trade entry → News dashboard: selects news
- Express routes and auth → Strategy and trade manager: creates trade (evidence: `server.js`)
- Express routes and auth → Strategy and trade manager: closes trade (evidence: `server.js`)
- Express routes and auth → MongoDB access: reads history (evidence: `server.js`)
- Express routes and auth → Economic calendar fetcher: requests news (evidence: `server.js`)
- Strategy and trade manager → MT command and event adapter: manages positions (evidence: `Bot.js`)
- Strategy and trade manager → MongoDB access: persists trade data (evidence: `Bot.js`)
- MT command and event adapter → Request queue: sends requests (evidence: `MT.js`)
- Request queue → MT5 service: sends ZeroMQ requests (evidence: `ZMQBuffer.js`)
- MT5 service → MT command and event adapter: publishes updates (evidence: `MT.js`)
- MongoDB access → MongoDB: reads and writes (evidence: `MongoDB.js`)
- Economic calendar fetcher → Economic calendar service: fetches events (evidence: `NewsScraper.js`)
