-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_java_analysis.sh
More file actions
executable file
·194 lines (168 loc) · 4.38 KB
/
Copy pathrun_java_analysis.sh
File metadata and controls
executable file
·194 lines (168 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/bin/bash
# Quantitative Trading Analysis - Java Runner Script
# This script provides easy execution of the Java analysis
echo "============================================================"
echo "QUANTITATIVE TRADING STRATEGY ANALYSIS - JAVA VERSION"
echo "============================================================"
# Check if Maven is installed
if ! command -v mvn &> /dev/null; then
echo "❌ Maven is not installed. Please install Maven first."
echo " Visit: https://maven.apache.org/install.html"
exit 1
fi
# Check if Java is installed
if ! command -v java &> /dev/null; then
echo "❌ Java is not installed. Please install Java 11 or higher."
echo " Visit: https://openjdk.java.net/install/"
exit 1
fi
echo "✅ Prerequisites check passed"
echo ""
# Parse command line arguments
START_DATE=${1:-"2020-01-01"}
END_DATE=${2:-$(date +"%Y-%m-%d")}
echo "📊 Analysis Parameters:"
echo " Start Date: $START_DATE"
echo " End Date: $END_DATE"
echo ""
# Function to run analysis
run_analysis() {
echo "🚀 Running quantitative trading analysis..."
echo ""
mvn exec:java \
-Dexec.mainClass="com.quantitative.trading.MainAnalysis" \
-Dexec.args="$START_DATE $END_DATE" \
-q
}
# Function to run tests
run_tests() {
echo "🧪 Running test suite..."
echo ""
mvn test -q
if [ $? -eq 0 ]; then
echo "✅ All tests passed!"
else
echo "❌ Some tests failed. Please check the output above."
exit 1
fi
}
# Function to build project
build_project() {
echo "🔨 Building project..."
echo ""
mvn clean compile -q
if [ $? -eq 0 ]; then
echo "✅ Build successful!"
else
echo "❌ Build failed. Please check the output above."
exit 1
fi
}
# Function to create executable JAR
create_jar() {
echo "📦 Creating executable JAR..."
echo ""
mvn clean package -q
if [ $? -eq 0 ]; then
echo "✅ JAR created successfully!"
echo " Location: target/trading-analysis-1.0.0.jar"
else
echo "❌ JAR creation failed. Please check the output above."
exit 1
fi
}
# Function to run JAR
run_jar() {
if [ ! -f "target/trading-analysis-1.0.0.jar" ]; then
echo "📦 JAR not found. Creating it first..."
create_jar
fi
echo "🚀 Running analysis from JAR..."
echo ""
java -jar target/trading-analysis-1.0.0.jar "$START_DATE" "$END_DATE"
}
# Main menu
show_menu() {
echo "📋 Available Options:"
echo " 1. Run Analysis (Maven exec)"
echo " 2. Run Analysis (JAR)"
echo " 3. Run Tests"
echo " 4. Build Project"
echo " 5. Create JAR"
echo " 6. Run All Tests + Analysis"
echo " 7. Exit"
echo ""
read -p "Select option (1-7): " choice
}
# Main execution
if [ $# -eq 0 ]; then
# Interactive mode
while true; do
show_menu
case $choice in
1)
run_analysis
;;
2)
run_jar
;;
3)
run_tests
;;
4)
build_project
;;
5)
create_jar
;;
6)
run_tests
if [ $? -eq 0 ]; then
echo ""
run_analysis
fi
;;
7)
echo "👋 Goodbye!"
exit 0
;;
*)
echo "❌ Invalid option. Please select 1-7."
;;
esac
echo ""
read -p "Press Enter to continue..."
echo ""
done
else
# Command line mode
case "$1" in
"test")
run_tests
;;
"build")
build_project
;;
"jar")
create_jar
;;
"run-jar")
run_jar
;;
"all")
run_tests
if [ $? -eq 0 ]; then
echo ""
run_analysis
fi
;;
*)
# Default: run analysis with provided dates
run_analysis
;;
esac
fi
echo ""
echo "============================================================"
echo "ANALYSIS COMPLETED"
echo "============================================================"