{"id":48914459,"url":"https://github.com/jefrnc/mt5-docker-api","last_synced_at":"2026-04-17T01:11:12.298Z","repository":{"id":305950099,"uuid":"1024471391","full_name":"jefrnc/mt5-docker-api","owner":"jefrnc","description":"Run MetaTrader5 on any OS via Docker. Features web-based VNC access, REST API with Swagger docs, WebSocket real-time data, and Python API for    algorithmic trading. Perfect for automated trading systems, backtesting, and remote MT5 access.","archived":false,"fork":false,"pushed_at":"2026-04-02T15:03:41.000Z","size":147,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-03T03:08:46.321Z","etag":null,"topics":["algorithmic-trading","api","containers","devops","docker","integration","metatrader5","python","rest-api","trading","websocket"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jefrnc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-22T18:47:45.000Z","updated_at":"2026-04-02T14:58:44.000Z","dependencies_parsed_at":"2025-07-22T21:21:35.892Z","dependency_job_id":"192d7826-a85e-4dbb-88da-836743169639","html_url":"https://github.com/jefrnc/mt5-docker-api","commit_stats":null,"previous_names":["jefrnc/mt5-docker-api"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jefrnc/mt5-docker-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jefrnc%2Fmt5-docker-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jefrnc%2Fmt5-docker-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jefrnc%2Fmt5-docker-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jefrnc%2Fmt5-docker-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jefrnc","download_url":"https://codeload.github.com/jefrnc/mt5-docker-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jefrnc%2Fmt5-docker-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31910616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["algorithmic-trading","api","containers","devops","docker","integration","metatrader5","python","rest-api","trading","websocket"],"created_at":"2026-04-17T01:11:11.654Z","updated_at":"2026-04-17T01:11:12.265Z","avatar_url":"https://github.com/jefrnc.png","language":"Python","readme":"# MetaTrader5 Docker API\n\n[![Docker Build](https://github.com/jefrnc/mt5-docker-api/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/jefrnc/mt5-docker-api/actions/workflows/docker-publish.yml)\n[![Docker Pulls](https://img.shields.io/docker/pulls/jsfrnc/mt5-docker-api)](https://hub.docker.com/r/jsfrnc/mt5-docker-api)\n[![Docker Image Size](https://img.shields.io/docker/image-size/jsfrnc/mt5-docker-api)](https://hub.docker.com/r/jsfrnc/mt5-docker-api)\n[![License](https://img.shields.io/github/license/jefrnc/mt5-docker-api)](LICENSE)\n\nA containerized solution for running MetaTrader5 trading platform with web-based VNC access and Python API support.\n\n## 🐳 Docker Hub\n\nThe official image is available on Docker Hub:\n\n**Repository:** [jsfrnc/mt5-docker-api](https://hub.docker.com/r/jsfrnc/mt5-docker-api)\n\n```bash\ndocker pull jsfrnc/mt5-docker-api:latest\n```\n\n## Overview\n\nThis Docker image allows you to run MetaTrader5 on any system that supports Docker, providing:\n- Web-based access through VNC (no VNC client needed)\n- Python API for algorithmic trading\n- Persistent storage for configurations and data\n- Automated installation and setup\n\n## Features\n\n- **Cross-Platform**: Run Windows-only MT5 on Linux/Mac systems\n- **Web Access**: Access MT5 through any web browser on port 3000\n- **Python Integration**: Built-in support for automated trading via Python\n- **Auto-Installation**: MT5 installs automatically on first run\n- **Persistent Data**: All settings and data persist across container restarts\n- **Health Monitoring**: Built-in health checks for reliability\n- **Optimized Performance**: Multi-stage build for smaller image size\n\n## Quick Start\n\n### Option 1: Using Docker Hub Image (Easiest)\n\nPull and run the latest image from Docker Hub:\n\n```bash\n# Pull the latest image\ndocker pull jsfrnc/mt5-docker-api:latest\n\n# Run the container\ndocker run -d \\\n  --name mt5-docker \\\n  -p 3000:3000 \\\n  -p 8000:8000 \\\n  -p 8001:8001 \\\n  -e VNC_PASSWORD=yourpassword \\\n  -v mt5_data:/root/.wine/drive_c/Program\\ Files/MetaTrader\\ 5 \\\n  jsfrnc/mt5-docker-api:latest\n```\n\nAvailable tags:\n- `jsfrnc/mt5-docker-api:latest` - Latest stable version\n- `jsfrnc/mt5-docker-api:v1.0.2` - Specific version\n\n### Option 2: Using Docker Compose (Recommended for Production)\n\n1. Create a project directory:\n```bash\nmkdir mt5-docker \u0026\u0026 cd mt5-docker\n```\n\n2. Download required files:\n```bash\nwget https://raw.githubusercontent.com/jefrnc/mt5-docker-api/main/docker-compose.yml\nwget https://raw.githubusercontent.com/jefrnc/mt5-docker-api/main/.env.example\n```\n\n3. Configure environment:\n```bash\ncp .env.example .env\nnano .env  # Edit with your settings\n```\n\n4. Start the container:\n```bash\ndocker compose up -d\n```\n\nThe image `jsfrnc/mt5-docker-api:latest` will be automatically pulled from Docker Hub.\n\n5. Access MetaTrader5:\n   - Open your browser and navigate to `http://localhost:3000`\n   - Enter the VNC password you set in `.env`\n   - API documentation available at `http://localhost:8000/docs`\n\n### Using Docker CLI\n\n```bash\ndocker run -d \\\n  -p 3000:3000 \\\n  -p 8000:8000 \\\n  -p 8001:8001 \\\n  -v mt5_data:/root/.wine/drive_c/Program\\ Files/MetaTrader\\ 5 \\\n  -e VNC_PASSWORD=yourpassword \\\n  -e MT5_LOGIN=your_login \\\n  -e MT5_PASSWORD=your_password \\\n  -e MT5_SERVER=your_server \\\n  jsfrnc/mt5-docker-api:latest\n```\n\n## Configuration\n\n### Environment Variables\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `VNC_PASSWORD` | Yes | - | VNC connection password |\n| `MT5_LOGIN` | No | - | MetaTrader5 account login |\n| `MT5_PASSWORD` | No | - | MetaTrader5 account password |\n| `MT5_SERVER` | No | - | MetaTrader5 broker server |\n| `API_KEY` | No | - | API key for authenticating REST API requests via `X-API-Key` header. If not set, auth is disabled (for local dev) |\n| `ALLOWED_ORIGINS` | No | `http://localhost:8080` | Comma-separated list of allowed CORS origins |\n| `VNC_PORT` | No | 3000 | Web VNC interface port |\n| `API_PORT` | No | 8000 | REST API server port |\n| `MT5_PORT` | No | 8001 | Python MT5 server port |\n| `WINEPREFIX` | No | `/root/.wine` | Wine prefix directory |\n| `MT5_VERSION` | No | 5.0.36 | MetaTrader5 Python library version |\n| `WINE_VERSION` | No | win10 | Wine compatibility mode |\n| `LOG_LEVEL` | No | INFO | Logging verbosity |\n\n### Volume Mounts\n\n- `/root/.wine/drive_c/Program Files/MetaTrader 5`: MT5 installation and data (persistent across restarts)\n- `/app/logs`: Application logs\n\n## API Usage\n\n### REST API\n\nThe container includes a REST API with automatic documentation:\n\n- **API Documentation**: http://localhost:8000/docs\n- **OpenAPI Schema**: http://localhost:8000/openapi.json\n\n#### Example API Calls:\n\n```bash\n# Get account info (include X-API-Key header if API_KEY is configured)\ncurl -H \"X-API-Key: YOUR_KEY\" http://localhost:8000/account\n\n# Get available symbols\ncurl http://localhost:8000/symbols\n\n# Get symbol details\ncurl http://localhost:8000/symbol/EURUSD\n\n# Place an order\ncurl -X POST http://localhost:8000/order \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"symbol\": \"EURUSD\",\n    \"volume\": 0.01,\n    \"order_type\": \"BUY\"\n  }'\n\n# Get open positions\ncurl http://localhost:8000/positions\n\n# Get historical data\ncurl -X POST http://localhost:8000/history/candles \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"symbol\": \"EURUSD\",\n    \"timeframe\": \"M5\",\n    \"start\": \"2024-01-01T00:00:00\",\n    \"end\": \"2024-01-02T00:00:00\"\n  }'\n```\n\n### WebSocket for Real-time Data\n\n```javascript\n// Connect to real-time tick stream\nconst ws = new WebSocket('ws://localhost:8000/ws/ticks/EURUSD');\n\nws.onmessage = (event) =\u003e {\n  const tick = JSON.parse(event.data);\n  console.log(`${tick.symbol}: Bid=${tick.bid}, Ask=${tick.ask}`);\n};\n```\n\n### Python Direct Connection\n\nYou can also connect directly to MT5 without the REST API:\n\n```python\nfrom mt5linux import MetaTrader5\n\n# Connect to the container\nmt5 = MetaTrader5(host='localhost', port=8001)\nmt5.initialize()\n\n# Check version\nprint(mt5.version())\n\n# Your trading logic here\n```\n\n## MQL5 Scripts Location\n\nIf you mount the MT5 volume locally, place your Expert Advisors and Scripts in:\n```\n./mt5/MQL5/\n```\n\nAccess MetaEditor through the MT5 interface for development.\n\n## Building from Source\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/jefrnc/mt5-docker-api\ncd mt5-docker-api\n```\n\n2. Build the image:\n```bash\ndocker build -t mt5-docker-api:latest .\n```\n\n## System Requirements\n\n- Docker Engine 20.10+\n- 4GB RAM minimum\n- 10GB disk space\n- x86_64/amd64 architecture (ARM not supported)\n\n## Security Considerations\n\n- Always use strong passwords\n- Run with minimal privileges\n- Keep the image updated\n- Use environment variables for sensitive data\n- Consider network isolation for production use\n\n## Troubleshooting\n\n### Container won't start\n- Check logs: `docker logs mt5`\n- Verify ports 3000 and 8001 are not in use\n- Ensure sufficient disk space\n\n### Can't connect to VNC\n- Verify container is running: `docker ps`\n- Check firewall settings\n- Try accessing `http://localhost:3000` directly\n\n### MT5 installation fails\n- Check internet connectivity\n- Verify Wine is working: `docker exec mt5 wine --version`\n- Review installation logs\n\n### Python API connection issues\n- Ensure port 8001 is exposed\n- Check mt5linux server is running\n- Verify network connectivity\n\n## Performance Tips\n\n- Allocate at least 2 CPU cores\n- Use SSD storage for better I/O\n- Limit concurrent connections\n- Monitor resource usage\n\n## License\n\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjefrnc%2Fmt5-docker-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjefrnc%2Fmt5-docker-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjefrnc%2Fmt5-docker-api/lists"}