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 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 market-price.insightbull.io to hosts file...
  20. set "hosts_file=%windir%\System32\drivers\etc\hosts"
  21. set "entry=127.0.0.1 market-price.insightbull.io"
  22. REM Check if entry already exists
  23. findstr /C:"market-price.insightbull.io" "%hosts_file%" >nul 2>&1
  24. if !errorLevel! == 0 (
  25. echo [✓] market-price.insightbull.io already exists in hosts file
  26. ) else (
  27. echo. >> "%hosts_file%"
  28. echo !entry! >> "%hosts_file%"
  29. echo [✓] Added market-price.insightbull.io 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 for both services
  35. set "PROJECT_DIR=%cd%"
  36. set "NGINX_DIR=%PROJECT_DIR%\nginx-1.24.0"
  37. REM Start Node.js API server from project directory
  38. start "MarketDataAPI" cmd /k "cd /d "%PROJECT_DIR%" && node src/server.js"
  39. REM Wait for API to start
  40. timeout /t 5 /nobreak >nul
  41. REM Test if API server started successfully
  42. curl -s http://localhost:3001/health >nul 2>&1
  43. if !errorLevel! == 0 (
  44. echo [✓] Node.js API server started successfully
  45. ) else (
  46. echo [✗] Failed to start API server
  47. goto :error
  48. )
  49. echo.
  50. echo [3/4] Starting Nginx proxy server...
  51. REM Start Nginx from its own directory
  52. start "NginxProxy" cmd /k "cd /d "%NGINX_DIR%" && nginx.exe"
  53. REM Wait for Nginx to start
  54. timeout /t 3 /nobreak >nul
  55. echo.
  56. echo [4/4] Testing proxy connection...
  57. echo Testing basic connectivity...
  58. curl -s http://market-price.insightbull.io >nul 2>&1
  59. if !errorLevel! == 0 (
  60. echo [✓] Proxy server is responding
  61. ) else (
  62. echo [✗] Proxy server not responding
  63. goto :error
  64. )
  65. echo.
  66. echo Testing API through proxy...
  67. curl -s http://market-price.insightbull.io/api/health >nul 2>&1
  68. if !errorLevel! == 0 (
  69. echo [✓] API proxy is working correctly
  70. ) else (
  71. echo [✗] API proxy not working
  72. goto :error
  73. )
  74. echo.
  75. echo ========================================
  76. echo SUCCESS! Proxy is ready!
  77. echo ========================================
  78. echo.
  79. echo Your proxy is now running:
  80. echo - API Server: http://localhost:3001
  81. echo - Proxy URL: http://market-price.insightbull.io
  82. echo - MT5 URL: http://market-price.insightbull.io/api/endpoint
  83. echo.
  84. echo You can now use http://market-price.insightbull.io/api/ in your MT5 EA
  85. echo.
  86. echo Press any key to close this window...
  87. pause >nul
  88. goto :eof
  89. :error
  90. echo.
  91. echo ========================================
  92. echo ERROR! Something went wrong
  93. echo ========================================
  94. echo.
  95. echo Please check:
  96. echo 1. Is Node.js installed?
  97. echo 2. Run 'npm install' if dependencies are missing
  98. echo 3. Check if port 3001 is available
  99. echo 4. Check Nginx error logs in nginx-1.24.0/logs/
  100. echo.
  101. echo Press any key to close this window...
  102. pause >nul
  103. exit /b 1