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