-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStockSmart.java
More file actions
92 lines (73 loc) · 3.34 KB
/
Copy pathStockSmart.java
File metadata and controls
92 lines (73 loc) · 3.34 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
/**
* Main File
* @Kush Garg (kushgarg.com/stocksmart)
* @BUILD 1.6 (a version number or a date)
*/
import java.io.*;
import java.util.*;
public class StockSmart //Main Program
{
//WARNING 1: Files must be in dd/mm/yy format and CSV sheets can only have 2 columns
//WARNING 2: Stock History Files must be the same in formatting/time period span
//DISCLAIMER: Program to be used in conjunction with reasearch, not an independent analyzer
private double StockSmartScore1;
private double StockSmartScore2;
public static boolean ready = false;
private static double beta = 1.0;
private static double principalInvestment = 100.0;
private static double predictedHigh = 1900.0;
private static double predictedLow = 1790.0;
public StockSmart()
{
StockSmartScore1 = 0;
StockSmartScore2 = 0;
}
public static void main(String[] args) throws FileNotFoundException
{
StockSmart app = new StockSmart(); //Creates Main App Object
GUI.gui();
while(!ready){
try
{
Thread.sleep(1000);
}
catch(InterruptedException ex)
{
Thread.currentThread().interrupt();
}
}
//Stock1
FileIO amzn = new FileIO(GUI.c1FileDir);
amzn.getData();
Calculation.Calc1(GUI.c1beta, amzn.getCurr(), GUI.principal, amzn.getLow(), amzn.getHigh(), GUI.c1High, GUI.c1Low);
app.StockSmartScore1 = Calculation.getScore1();
//Stock2
FileIO nvda = new FileIO(GUI.c2FileDir);
nvda.getData();
Calculation.Calc1(GUI.c2beta, nvda.getCurr(), GUI.principal, nvda.getLow(), nvda.getHigh(), GUI.c2High, GUI.c2Low);
app.StockSmartScore2 = Calculation.getScore1();
FileIO index = new FileIO(GUI.indexFileDir);
index.getData();
Calculation.Calc1(GUI.c2beta, nvda.getCurr(), GUI.principal, nvda.getLow(), nvda.getHigh(), GUI.c2High, GUI.c2Low);
app.StockSmartScore2 = Calculation.getScore1();
GUI.result.append("Stock 1 has a score of: " + app.StockSmartScore1 + " \n");
GUI.result.append("Stock 2 has a score of: " + app.StockSmartScore2 + " \n");
String analysis = "\n";
if(app.StockSmartScore1 > app.StockSmartScore2){
analysis += amzn.getFileName() + " is the better stock to invest in, because its quanitfiable risk is outweighted by its return on investment";
analysis += "\n ";
}
else if(app.StockSmartScore1 < app.StockSmartScore2){
analysis += nvda.getFileName()+" is the better stock to invest in, because its quanitfiable risk is outweighted by its return on investment";
analysis += "\n";
}
else{
analysis += "It appears both stocks yielded the same score, this is an extraordinary situation. Our Risk/ROI model determines that neither stock has a conclusive, quantifiable advantage over the other. Choose the stock which you feel more confident in, as neither stock appears to be a poor choice.";
analysis += "\n";
}
GUI.result.append(analysis);
//FileIO.subroutine1();
//GUI.subroutine2();
Graph.graphStocks(amzn, nvda, index);
}
}