Market Data Service is a high-performance financial data API that provides comprehensive Symbol prices of different markets through both RESTful endpoints and real-time WebSocket connections.
This guide will help you set up the Market Data Service for local development with MT5 EA connectivity.
# Clone the repository
git clone https://git.mqldevelopment.com/muhammad.uzair/market-data-service.git
cd market-data-service
# Run the automated setup script (fully automated - will prompt for password on macOS)
# On Linux, you may need: sudo bash scripts/setup-local-dev.sh
bash scripts/setup-local-dev.sh
Note: On macOS, the script automatically prompts for your administrator password using a system dialog. On Linux, you may need to run with sudo.
Alternative (Manual Setup): If you prefer to do it manually:
# Add market-data.local to your hosts file
echo "127.0.0.1 market-data.local" | sudo tee -a /etc/hosts
# Start all services (database, API, Nginx)
docker-compose up -d
# Verify services are running
docker-compose ps
# Test health endpoint
curl http://market-data.local/health
# Test API endpoint
curl http://market-data.local/api/symbols
You should see JSON responses. If you do, your setup is complete! ✅
MT5 Expert Advisors require valid domain URLs in their "Allowed URLs" list. MT5 does not allow:
localhost127.0.0.1http://localhost:80MT5 requires a domain-like URL:
http://market-data.localThe market-data.local domain resolves to your local Docker setup via the /etc/hosts file, allowing MT5 EA to connect to your local development server.
The setup script (bash scripts/setup-local-dev.sh) automatically adds the required entry. On macOS, it will prompt for your administrator password using a system dialog. On Linux, you may need to run it with sudo.
Verify the entry:
# View current entry
cat /etc/hosts | grep market-data.local
Manual setup (if needed):
# Add entry manually (macOS/Linux)
echo "127.0.0.1 market-data.local" | sudo tee -a /etc/hosts
Windows:
C:\Windows\System32\drivers\etc\hosts127.0.0.1 market-data.localStart Services:
docker-compose up -d
View Logs:
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f api
docker-compose logs -f nginx
docker-compose logs -f db
Stop Services:
docker-compose down
Restart Services:
docker-compose restart
Check Service Status:
docker-compose ps
All services should show "Up" status.
Test Endpoints:
# Health check
curl http://market-data.local/health
# API endpoints
curl http://market-data.local/api/symbols
curl http://market-data.local/api/health
# Test with browser
open http://market-data.local/health # macOS
# or visit http://market-data.local/health in your browser
http://market-data.localMarketDataSender.mq5 to any charthttp://market-data.local1000 (or your preference)5 (or your preference)✅ Symbols initialized: X✅ Successfully sent live prices to API# Health check
curl http://market-data.local/health
# Expected response:
# {"success":true,"message":"Market Data Service is running",...}
# Get symbols
curl http://market-data.local/api/symbols
# Get health
curl http://market-data.local/api/health
ApiBaseUrl = "http://market-data.local"# Connect to database
docker-compose exec db psql -U postgres -d financial_data
# Check tables
\dt
# Check symbols
SELECT * FROM symbols LIMIT 5;
# Check live prices
SELECT * FROM live_prices LIMIT 5;
# Exit
\q
Solution:
# Verify hosts entry exists
cat /etc/hosts | grep market-data.local
# If missing, add it
echo "127.0.0.1 market-data.local" | sudo tee -a /etc/hosts
# Flush DNS cache (macOS)
sudo dscacheutil -flushcache
# Flush DNS cache (Linux)
sudo systemd-resolve --flush-caches
Solution:
# Check if services are running
docker-compose ps
# If not running, start them
docker-compose up -d
# Check service logs
docker-compose logs api
docker-compose logs nginx
# Restart services
docker-compose restart
Solution:
http://market-data.local (no trailing slash)curl http://market-data.local/healthdocker-compose psdocker-compose logs nginxSolution:
# Check API service
docker-compose logs api
# Check database connection
docker-compose exec db pg_isready -U postgres
# Restart API service
docker-compose restart api
Solution:
# Check database is running
docker-compose ps db
# Check database logs
docker-compose logs db
# Restart database
docker-compose restart db
# Wait for database to be ready
docker-compose exec db pg_isready -U postgres
Solution:
# Check what's using port 80
sudo lsof -i :80
# Stop conflicting service or change Nginx port in docker-compose.yml
# Edit docker-compose.yml, change "80:80" to "8080:80"
# Then use: http://market-data.local:8080
The API service uses volume mounts for live code reloading:
# Code changes in src/ are automatically reloaded
# No need to restart containers
# View API logs to see changes
docker-compose logs -f api
Migrations run automatically on container start. To run manually:
# Run migrations
docker-compose exec api npx sequelize-cli db:migrate
# Check migration status
docker-compose exec api npx sequelize-cli db:migrate:status
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f api
docker-compose logs -f nginx
docker-compose logs -f db
# Last 100 lines
docker-compose logs --tail=100 api
http://market-data.localApiBaseUrl = "http://market-data.local"http://market-price.insightbull.ioApiBaseUrl = "http://market-price.insightbull.io"You can easily switch by changing the ApiBaseUrl input in MT5 EA settings.
macOS/Linux:
# Remove the entry
sudo sed -i '' '/market-data.local/d' /etc/hosts # macOS
sudo sed -i '/market-data.local/d' /etc/hosts # Linux
Windows:
C:\Windows\System32\drivers\etc\hosts127.0.0.1 market-data.local# Stop and remove containers
docker-compose down
# Stop and remove containers + volumes (⚠️ deletes database data)
docker-compose down -v
# Setup (one-time, fully automated on macOS)
bash scripts/setup-local-dev.sh
# On Linux, you may need: sudo bash scripts/setup-local-dev.sh
# Start services
docker-compose up -d
# Stop services
docker-compose down
# View logs
docker-compose logs -f api
# Test endpoint
curl http://market-data.local/health
# Check services
docker-compose ps
http://market-data.localhttp://market-data.local/healthhttp://market-data.local/api/*http://market-data.localhttp://market-data.localIf you encounter issues not covered in this guide:
docker-compose logscat /etc/hosts | grep market-data.localcurl http://market-data.local/healthFor additional support, check the main README.md or project documentation.