Skip to content

Commit 705aaa4

Browse files
committed
Standard Deviation
1 parent fd5523d commit 705aaa4

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
EDIG,2017-11-13,2000-01-03
22
TSLA,2017-11-13,2010-06-29
33
AAPL,2017-11-13,2000-01-03
4-
TESTS,2017-11-13,2017-11-02
4+
TESTS,2017-11-14,2017-11-02

Statistical_Analysis/src/gui/GUIMain.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected void paintComponent(Graphics g) {
6969
g2.setColor(gridColor);
7070
g2.drawLine(padding + labelPadding + 1 + pointWidth, y0, getWidth() - padding, y1);
7171
g2.setColor(Color.BLACK);
72-
String yLabel = ((int) ((getMinScore() + (getMaxScore() - getMinScore()) * ((i * 10.0) / numberYDivisions)) * 100f)) / 100.0 + "";
72+
String yLabel = ((int) ((getMinScore() + (getMaxScore() - getMinScore()) * ((i * 100.0) / numberYDivisions)) * 100f)) / 100.0 + "";
7373
FontMetrics metrics = g2.getFontMetrics();
7474
int labelWidth = metrics.stringWidth(yLabel);
7575
g2.drawString(yLabel, x0 - labelWidth - 5, y0 + (metrics.getHeight() / 2) - 3);
@@ -154,17 +154,14 @@ public List<Double> getScores() {
154154
}
155155

156156
private static void createAndShowGui() {
157-
Stock S_AAPL = new Stock("TSLA");
158-
S_AAPL.retrieve();
159-
ArrayList P = S_AAPL.request("ADJ_CLOSE", "2017-05-08", "2017-11-08");
160-
//ArrayList AAPL_A = S_AAPL.request("CLOSE", "2012-01-01", "2017-01-01");
161-
162-
SStat EDIG_S = new SStat(S_AAPL);
163-
ArrayList AL = EDIG_S.PercentageChange("CLOSE", 30, "2012-01-01", "2017-01-01");
164-
System.out.println(AL);
165-
ArrayList Dev = EDIG_S.ReturnDeviation("ADJ_CLOSE", 30, "2012-01-01", "2014-01-01", "GEO");
157+
Stock Test = new Stock("TESTS");
158+
Test.retrieve();
159+
SStat Test_St = new SStat(Test);
160+
ArrayList Ret = Test_St.ReturnDeviation("ADJ_CLOSE", 1, "2017-11-02", "2017-11-10", "ARI");
161+
Ret = Test_St.PercentageChange("ADJ_CLOSE", 1, "2016-01-01", "2017-11-20");
162+
Ret = Test.Adj_Close;
166163

167-
GUIMain mainPanel = new GUIMain(Dev);
164+
GUIMain mainPanel = new GUIMain(Ret);
168165
mainPanel.setPreferredSize(new Dimension(800, 600));
169166
JFrame frame = new JFrame("DrawGraph");
170167
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package stat_c;
2+
3+
4+
5+
6+
7+
/*
8+
* Portfolio Class.
9+
* I originally designed SStat Class to convey statistics for two stock data, but it would incur too much lines of code in one class.
10+
* It turns out, however, I remembered that if I wanted to construct a portfolio that contains more than two stocks,
11+
* I didn't have to put every stocks altogether, but rather, I could update them by adding in single stock data.
12+
*/
13+
public class PP {
14+
15+
}

0 commit comments

Comments
 (0)