{"id":21888732,"url":"https://github.com/sesto-dev/metatrader5-quant-server-python","last_synced_at":"2025-04-09T14:06:29.692Z","repository":{"id":263787703,"uuid":"888880020","full_name":"sesto-dev/metatrader5-quant-server-python","owner":"sesto-dev","description":"Repository for YouTube tutorial on how to run MetaTrader5 + VNC + Python Flask API in a Docker Container on a Linux server. ","archived":false,"fork":false,"pushed_at":"2024-12-25T06:07:26.000Z","size":2507,"stargazers_count":76,"open_issues_count":0,"forks_count":22,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-02T13:01:52.124Z","etag":null,"topics":["docker","docker-compose","forex","metatrader","metatrader-5","metatrader5-web-api","quant","quantitative","quantitative-analysis","quantitative-finance","quantitative-trading"],"latest_commit_sha":null,"homepage":"https://youtube.com/playlist?list=PLotEOI0Sz3OzdSp7qR6vHs8EYnmQwqWAF","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sesto-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-15T07:23:06.000Z","updated_at":"2025-04-02T11:32:12.000Z","dependencies_parsed_at":"2025-04-02T13:01:21.848Z","dependency_job_id":"074f1f85-12d9-4a58-91f4-467e95dc908a","html_url":"https://github.com/sesto-dev/metatrader5-quant-server-python","commit_stats":null,"previous_names":["sesto-dev/metatrader5-quant-server-python"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sesto-dev%2Fmetatrader5-quant-server-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sesto-dev%2Fmetatrader5-quant-server-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sesto-dev%2Fmetatrader5-quant-server-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sesto-dev%2Fmetatrader5-quant-server-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sesto-dev","download_url":"https://codeload.github.com/sesto-dev/metatrader5-quant-server-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054227,"owners_count":21039952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","forex","metatrader","metatrader-5","metatrader5-web-api","quant","quantitative","quantitative-analysis","quantitative-finance","quantitative-trading"],"created_at":"2024-11-28T11:16:50.337Z","updated_at":"2025-04-09T14:06:29.659Z","avatar_url":"https://github.com/sesto-dev.png","language":"Python","readme":"# MetaTrader 5 Docker Setup\n\n![Banner](https://github.com/user-attachments/assets/6b5101ea-275b-4ae4-8f65-6a4fc30f30bf)\n\n## Table of Contents\n\n- [MetaTrader 5 Docker Setup](#metatrader-5-docker-setup)\n  - [Table of Contents](#table-of-contents)\n  - [Overview](#overview)\n  - [Features](#features)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n    - [Environment Variables](#environment-variables)\n    - [Docker Compose Services](#docker-compose-services)\n    - [Volumes](#volumes)\n  - [Usage](#usage)\n  - [Logging](#logging)\n  - [Troubleshooting](#troubleshooting)\n  - [Contributing](#contributing)\n  - [License](#license)\n\n## Overview\n\nThis project provides a Docker-based setup to run MetaTrader 5 (MT5) using Wine on a Debian-based environment. It leverages Traefik as a reverse proxy for managing HTTP/HTTPS traffic and ensures secure access through Let's Encrypt certificates. The setup includes VNC for remote desktop access and is configured to run as a background service with proper logging and environment management.\n\n## Features\n\n- **Dockerized Environment:** Simplifies deployment and management of MT5.\n- **Wine Compatibility:** Runs MetaTrader 5 on a Linux-based system.\n- **Traefik Integration:** Handles reverse proxying with automatic SSL certificate generation via Let's Encrypt.\n- **VNC Access:** Provides remote desktop access to the MT5 application.\n- **Logging:** Implements structured logging for easy monitoring and debugging.\n- **Environment Configuration:** Easily manage settings using environment variables.\n\n## Prerequisites\n\n- **Docker:** Ensure Docker is installed on your system. [Install Docker](https://docs.docker.com/get-docker/)\n- **Docker Compose:** Required for orchestrating the services. [Install Docker Compose](https://docs.docker.com/compose/install/)\n- **Domain Name:** A registered domain for accessing Traefik and VNC services.\n- **SSL Certificate:** Managed automatically via Let's Encrypt.\n\n## Installation\n\n1. **Clone the Repository**\n\n   ```bash\n   git clone -b chapter-1 --single-branch https://github.com/sesto-dev/metatrader5-linux-django-docker.git\n   cd metatrader5-linux-django-docker\n   ```\n\n2. **Configure Environment Variables**\n\n   Create a `.env` file based on the provided example:\n\n   ```bash\n   cp .env.example .env\n   ```\n\n   Open the `.env` file and set the necessary variables:\n\n   ```env\n   # Backend - MT5\n   CUSTOM_USER=admin\n   PASSWORD=yourpassword\n   VNC_DOMAIN=your-vnc-domain.com\n\n   # Traefik\n   TRAEFIK_DOMAIN=your-traefik-domain.com\n   TRAEFIK_USERNAME=yourusername\n   ACME_EMAIL=youremail@example.com\n   ```\n\n   **Note:** To generate and set the hashed password in one command for Traefik's HTTP Basic Auth, you can use the following command:\n\n   ```bash\n   export TRAEFIK_HASHED_PASSWORD=$(openssl passwd -apr1 $PASSWORD)\n   ```\n\n3. **Create Docker Network**\n\n   ```bash\n   docker network create traefik-public\n   ```\n\n4. **Build and Start the Services**\n\n   ```bash\n   docker-compose up -d\n   ```\n\nThis command builds the Docker images and starts the services in detached mode.\n\n## Configuration\n\n### Environment Variables\n\n- `CUSTOM_USER`: Username for accessing the MT5 service.\n- `PASSWORD`: Password for the custom user.\n- `VNC_DOMAIN`: Domain for accessing the VNC service.\n- `TRAEFIK_DOMAIN`: Domain for Traefik dashboard.\n- `TRAEFIK_USERNAME`: Username for Traefik basic authentication.\n- `ACME_EMAIL`: Email address for Let's Encrypt notifications.\n\n### Docker Compose Services\n\n- **Traefik:** Acts as a reverse proxy with HTTPS support.\n- **MT5:** Runs MetaTrader 5 using Wine.\n\n### Volumes\n\n- `/var/run/docker.sock`: Allows Traefik to monitor Docker services.\n- `./config`: Stores Wine configurations and MT5 data.\n- `traefik-public-certificates`: Persists SSL certificates generated by Let's Encrypt.\n\n## Usage\n\n1. **Accessing MetaTrader 5**\n\n   Navigate to `https://your-vnc-domain.com` in your web browser to access the VNC interface for MetaTrader 5.\n\n2. **Traefik Dashboard**\n\n   Access the Traefik dashboard at `https://your-traefik-domain.com`. You will be prompted for the Traefik username and password configured in the `.env` file.\n\n3. **Managing Services**\n\n   - **Start Services:**\n\n     ```bash\n     docker-compose up -d\n     ```\n\n   - **Stop Services:**\n\n     ```bash\n     docker-compose down\n     ```\n\n   - **View Logs:**\n\n     ```bash\n     docker-compose logs -f\n     ```\n\n## Logging\n\nThe setup uses JSON-file logging with the following configuration:\n\n- **Log Driver:** `json-file`\n- **Max Size:** `1m`\n- **Max File:** `1`\n\nLogs are managed per service and can be viewed using Docker commands or integrated with external logging solutions like Promtail.\n\n## Troubleshooting\n\n- **Traefik Not Accessible:**\n\n  - Ensure that ports `80` and `443` are open and not blocked by a firewall.\n  - Verify that your domain DNS settings are correctly pointing to your server.\n\n- **MT5 Not Starting:**\n\n  - Check the logs of the `mt5` service for any installation errors.\n  - Ensure that Wine dependencies are properly installed.\n\n- **VNC Connection Issues:**\n  - Confirm that the VNC service is running and accessible via the specified domain.\n  - Verify network configurations and firewall settings.\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. **Fork the Repository**\n\n2. **Create a Feature Branch**\n\n   ```bash\n   git checkout -b feature/YourFeature\n   ```\n\n3. **Commit Your Changes**\n\n   ```bash\n   git commit -m \"Add Your Feature\"\n   ```\n\n4. **Push to the Branch**\n\n   ```bash\n   git push origin feature/YourFeature\n   ```\n\n5. **Open a Pull Request**\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsesto-dev%2Fmetatrader5-quant-server-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsesto-dev%2Fmetatrader5-quant-server-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsesto-dev%2Fmetatrader5-quant-server-python/lists"}