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.

start_proxy.bat 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. echo ========================================
  4. echo Market Data Proxy Starter
  5. echo ========================================
  6. echo.
  7. REM Check if running as administrator (needed for hosts file modification)
  8. net session >nul 2>&1
  9. if %errorLevel% == 0 (
  10. echo [✓] Running as administrator
  11. ) else (
  12. echo [✗] This script requires administrator privileges
  13. echo Right-click and "Run as administrator"
  14. echo.
  15. pause
  16. exit /b 1
  17. )
  18. echo.
  19. echo [1/4] Adding marketData to hosts file...
  20. set "hosts_file=%windir%\System32\drivers\etc\hosts"
  21. set "entry=127.0.0.1 marketData"
  22. REM Check if entry already exists
  23. findstr /C:"marketData" "%hosts_file%" >nul 2>&1
  24. if !errorLevel! == 0 (
  25. echo [✓] marketData already exists in hosts file
  26. ) else (
  27. echo. >> "%hosts_file%"
  28. echo !entry! >> "%hosts_file%"
  29. echo [✓] Added marketData to hosts file
  30. )
  31. echo.
  32. echo [2/4] Starting Node.js API server...
  33. echo Starting API on port 3001...
  34. REM Get current directory and store it
  35. set "PROJECT_DIR=%cd%"
  36. start "MarketDataAPI" cmd /k "cd /d "%PROJECT_DIR%" && npm start"
  37. REM Wait a moment for API to start
  38. timeout /t 5 /nobreak >nul
  39. echo.
  40. echo [3/4] Starting Nginx proxy server...
  41. REM Get current directory for nginx path
  42. set "NGINX_PATH=%cd%\nginx-1.24.0\nginx.exe"
  43. start "NginxProxy" "%NGINX_PATH%"
  44. REM Wait for Nginx to start
  45. timeout /t 3 /nobreak >nul
  46. echo.
  47. echo [4/4] Testing proxy connection...
  48. echo Testing basic connectivity...
  49. curl -s http://marketData >nul 2>&1
  50. if !errorLevel! == 0 (
  51. echo [✓] Proxy server is responding
  52. ) else (
  53. echo [✗] Proxy server not responding
  54. goto :error
  55. )
  56. echo.
  57. echo Testing API through proxy...
  58. curl -s http://marketData/api/health >nul 2>&1
  59. if !errorLevel! == 0 (
  60. echo [✓] API proxy is working correctly
  61. ) else (
  62. echo [✗] API proxy not working
  63. goto :error
  64. )
  65. echo.
  66. echo ========================================
  67. echo SUCCESS! Proxy is ready!
  68. echo ========================================
  69. echo.
  70. echo Your proxy is now running:
  71. echo - API Server: http://localhost:3001
  72. echo - Proxy URL: http://marketData
  73. echo - MT5 URL: http://marketData/api/endpoint
  74. echo.
  75. echo You can now use http://marketData/api/ in your MT5 EA
  76. echo.
  77. echo Press any key to close this window...
  78. pause >nul
  79. goto :eof
  80. :error
  81. echo.
  82. echo ========================================
  83. echo ERROR! Something went wrong
  84. echo ========================================
  85. echo.
  86. echo Please check:
  87. echo 1. Is Node.js installed?
  88. echo 2. Run 'npm install' if dependencies are missing
  89. echo 3. Check if port 3001 is available
  90. echo 4. Check Nginx error logs in nginx-1.24.0/logs/
  91. echo.
  92. echo Press any key to close this window...
  93. pause >nul
  94. exit /b 1