Skip to content

Test branch #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: Branch_of_Chaos
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .recommenders/caches/identified-project-coordinates.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[[{"location":"E:\\Programming\\School\\JAVA_Application_Project\\Java_Course_Project\\Statistical_Analysis","type":"PROJECT","hints":{"PROJECT_NAME":"Statistical_Analysis"}},"ABSENT"],[{"location":"C:\\Program Files\\Java\\jre1.8.0_144","type":"JRE","hints":{"EXECUTION_ENVIRONMENT":"JavaSE-1.8"}},"jre:jre:1.8.0"]]
[[{"location":"C:\\Users\\DongGoo\\Downloads\\jfreechart-1.0.19\\jfreechart-1.0.19\\lib\\jfreechart-1.0.19.jar","type":"JAR","hints":{}},"ABSENT"],[{"location":"C:\\Program Files\\Java\\jre1.8.0_144","type":"JRE","hints":{"EXECUTION_ENVIRONMENT":"JavaSE-1.8"}},"jre:jre:1.8.0"],[{"location":"C:\\Java_Course_Project\\Statistical_Analysis","type":"PROJECT","hints":{"PROJECT_NAME":"Statistical_Analysis"}},"ABSENT"]]
Binary file not shown.
5 changes: 2 additions & 3 deletions Statistical_Analysis/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="GUISource"/>
<classpathentry kind="src" path="Global_Region"/>
<classpathentry kind="lib" path="E:/Programming/School/JAVA_Application_Project/Java_Course_Project/ExternalLib/Apache/commons-math3-3.6.1.jar"/>
<classpathentry kind="lib" path="E:/Programming/School/JAVA_Application_Project/Java_Course_Project/ExternalLib/Apache/commons-math3-3.6.1-javadoc.jar"/>
<classpathentry kind="lib" path="E:/Programming/School/JAVA_Application_Project/Java_Course_Project/ExternalLib/Apache/commons-math3-3.6.1-sources.jar"/>
<classpathentry kind="lib" path="C:/Users/DongGoo/Downloads/jfreechart-1.0.19/jfreechart-1.0.19/lib/jfreechart-1.0.19.jar"/>
<classpathentry kind="lib" path="C:/Users/DongGoo/Downloads/jfreechart-1.0.19/jfreechart-1.0.19/lib/jcommon-1.0.23.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
8 changes: 6 additions & 2 deletions Statistical_Analysis/Data/Historical/AAPL.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
timestamp,open,high,low,close,adjusted_close,volume,dividend_amount,,
2017-11-27,175.0500,175.0800,173.3400,174.0900,174.0900,20590163,0.0000,,
2017-11-24,175.1000,175.5000,174.6500,174.9700,174.9700,14026519,0.0000,,
2017-12-01,169.9500,171.6700,168.5000,171.0500,171.0500,39590080,0.0000,,
2017-11-30,170.4300,172.1400,168.4400,171.8500,171.8500,41484363,0.0000,,
2017-11-29,172.6300,172.9200,167.1600,169.4800,169.4800,41456722,0.0000,,
2017-11-28,174.3000,174.8700,171.8600,173.0700,173.0700,25468442,0.0000,,
2017-11-27,175.0500,175.0800,173.3400,174.0900,174.0900,20536313,0.0000,,
2017-11-24,175.1000,175.5000,174.6459,174.9700,174.9700,14026519,0.0000,,
2017-11-22,173.3600,175.0000,173.0500,174.9600,174.9600,24997274,0.0000,,
2017-11-21,170.7800,173.7000,170.7800,173.1400,173.1400,24875471,0.0000,,
2017-11-20,170.2900,170.5600,169.5600,169.9800,169.9800,15974387,0.0000,,
Expand Down
14 changes: 9 additions & 5 deletions Statistical_Analysis/DataMeta/Availability.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AAPL,2017-11-28,2000-01-03,
AAPL,2017-12-02,2000-01-03,
SFNC,2017-11-26,2000-01-03,
CPRT,2017-11-26,2000-01-03,
GOOG,2017-11-27,2014-03-27,
GOOG,2017-11-28,2014-03-27,
EDIG,2017-11-26,2000-01-03,
IRCP,2017-11-26,2003-11-05,
WAYN,2017-11-26,2000-01-03,
Expand All @@ -17,8 +17,8 @@ STX,2017-11-27,2002-12-11,
XOM,2017-11-27,2000-01-03,
MARA,2017-11-26,2012-05-04,
AVGO,2017-11-27,2009-08-06,
AAPL,2017-11-28,2000-01-03,
GOOG,2017-11-27,2014-03-27,
AAPL,2017-12-02,2000-01-03,
GOOG,2017-11-28,2014-03-27,
TSLA,2017-11-28,2010-06-29,
AMZN,2017-11-27,2000-01-03,
XRT,2017-11-27,2006-06-22,
Expand All @@ -29,6 +29,10 @@ XOM,2017-11-27,2000-01-03,
AVGO,2017-11-27,2009-08-06,
AAP,2017-11-27,2001-11-29,
ABC,2017-11-27,2000-01-03,
AAPL,2017-11-28,2000-01-03,
AAPL,2017-12-02,2000-01-03,
TSLA,2017-11-28,2010-06-29,
GOOG,2017-11-28,2014-03-27,
AAPL,2017-12-02,2000-01-03,
AAPL,2017-12-02,2000-01-03,
AAPL,2017-12-02,2000-01-03,
AAPL,2017-12-02,2000-01-03,
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
import javax.swing.*;

public class GeneralInfoFramePanel_LatestData extends JPanel{

}
124 changes: 124 additions & 0 deletions Statistical_Analysis/GUISource/graphFrame/GraphFramePanel_Chart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
package graphFrame;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Date;
import java.util.Collection;
import java.util.Collections;

import javax.swing.*;

import org.jfree.chart.*;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.Timeline;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.CandlestickRenderer;
import org.jfree.data.*;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DatasetGroup;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.xy.DefaultHighLowDataset;
import org.jfree.data.xy.XYDataset;

import black.Utils;
import gray.Global;
import red.Stock;

public class GraphFramePanel_Chart extends JPanel{
Stock stock;

String symbol;
ArrayList<String> date;
ArrayList<Double> high;
ArrayList<Double> low;
ArrayList<Double> open;
ArrayList<Double> adj_close;
ArrayList<Double> volume;

BorderLayout layout = new BorderLayout();

DefaultHighLowDataset data;


JFreeChart chart;
ChartPanel chartPanel;


Double y_axis_min;
Double y_axis_max;

GraphFramePanel_Chart(){
renderPanel();
}

public void renderPanel() {
removeAll();

setLayout(layout);

data = createDataset();
chart = createChart(data);
chartPanel = new ChartPanel(chart);

add(chartPanel);

validate();
repaint();
}

@SuppressWarnings("unchecked")
public DefaultHighLowDataset createDataset() {
stock = new Stock(Global.SYMBOL);

symbol = stock.SYMBOL;
date = stock.request("DATE", Global.GraphStart, Global.GraphEnd);
high = stock.request("HIGH", Global.GraphStart, Global.GraphEnd);
low = stock.request("LOW", Global.GraphStart, Global.GraphEnd);
open = stock.request("OPEN", Global.GraphStart, Global.GraphEnd);
adj_close = stock.request("ADJ_CLOSE", Global.GraphStart, Global.GraphEnd);
volume = stock.request("VOLUME", Global.GraphStart, Global.GraphEnd);

Date[] date_list = new Date[date.size()];
date_list = Utils.StringToDate(date);
double[] high_list = new double[high.size()];
double[] low_list = new double[low.size()];
double[] open_list = new double[open.size()];
double[] adj_close_list = new double[adj_close.size()];
double[] volume_list = new double[volume.size()];
for (int i=0; i<high_list.length; i++) {
high_list[i] = high.get(i);
low_list[i] = low.get(i);
open_list[i] = open.get(i);
adj_close_list[i] = adj_close.get(i);
volume_list[i] = volume.get(i);
}

y_axis_min = Collections.min(low);
y_axis_max = Collections.max(high);

DefaultHighLowDataset data = null;
data = new DefaultHighLowDataset(symbol, date_list, high_list, low_list, open_list, adj_close_list, volume_list);

return data;
}

public JFreeChart createChart(DefaultHighLowDataset dataset) {

chart = ChartFactory.createCandlestickChart("History of " + stock.SYMBOL, "Time", "Price", dataset, true);

XYPlot plot = chart.getXYPlot();
CandlestickRenderer renderer = (CandlestickRenderer) plot.getRenderer();
renderer.setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST);

NumberAxis domain = (NumberAxis) plot.getRangeAxis();
domain.setRange(y_axis_min - 1, y_axis_max + 1);

return chart;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package graphFrame;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

import gray.Global;

public class GraphFramePanel_Mother extends JPanel{
GraphFramePanel_Chart chart;
GraphFramePanel_Search search;

GraphFramePanel_Mother() {
renderpanel();
}



public void renderpanel() {
removeAll();

setLayout(null);

chart = new GraphFramePanel_Chart();
chart.setBounds(0, 0, 800, 500);

search = new GraphFramePanel_Search();
search.setBounds(820, 20, 200, 50);

ActionControl();

add(chart);
add(search);

validate();
repaint();
}

public void ActionControl() {
search.button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
chart = new GraphFramePanel_Chart();

Global.GraphStart = search.start_date.getText();
Global.GraphEnd = search.end_date.getText();

renderpanel(); //Must render this very panel again.
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package graphFrame;

import java.awt.*;
import java.awt.event.*;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

import javax.swing.*;

import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.data.xy.DefaultHighLowDataset;

public class GraphFramePanel_Search extends JPanel{
JLabel start_search = new JLabel();
JLabel end_search = new JLabel();
JLabel blank = new JLabel();
JTextField start_date = new JTextField();
JTextField end_date = new JTextField();
JButton button = new JButton();

String start;
String end;

GraphFramePanel_Chart refresh;

GridLayout layout = new GridLayout();


GraphFramePanel_Search() {
renderPanel();
}

private void renderPanel() {
removeAll();

layout.setColumns(2);
layout.setRows(3);
setLayout(layout);

start_search = new JLabel("Start Date : ");
end_search = new JLabel(" End Date : ");
blank = new JLabel("");
start_date = new JTextField();
end_date = new JTextField();
button = new JButton("Search!");


add(start_search); add(start_date);
add(end_search); add(end_date);
add(blank); add(button);


validate();
repaint();

}
}
18 changes: 17 additions & 1 deletion Statistical_Analysis/GUISource/graphFrame/GraphFrame_Mother.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package graphFrame;
import java.awt.BorderLayout;

public class GraphFrame_Mother {
import javax.swing.*;

public class GraphFrame_Mother extends JInternalFrame {
GraphFramePanel_Mother motherpanel;

BorderLayout layout = new BorderLayout();
public GraphFrame_Mother() {
super("Stock Data Graph", true, true, true, true);
setLayout(layout);
setSize(1050,600);
setLocation(500,0);

motherpanel = new GraphFramePanel_Mother();
add(motherpanel);

setVisible(true);
}
}
2 changes: 0 additions & 2 deletions Statistical_Analysis/GUISource/white/GUIMain.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package white;

import java.awt.Font;
import java.awt.GraphicsEnvironment;

import gray.Global;

Expand Down
15 changes: 11 additions & 4 deletions Statistical_Analysis/GUISource/white/MotherFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class MotherFrame extends JFrame{

JMenuItem menuitem_gate;

JMenuItem graphpanelMI1;
JMenuItem pricegraph;
JMenuItem graphpanelMI2;

JMenuItem generalinfoMI1;
Expand All @@ -53,6 +53,7 @@ public MotherFrame() {
private void createDefaultInternalFrames() {
jdpDesktop.add(new GateFrame_Mother());
jdpDesktop.add(new GeneralInfoFrame_Mother());
jdpDesktop.add(new GraphFrame_Mother());
}

private void setInternalFramework() {
Expand All @@ -66,7 +67,7 @@ private void setMotherFrame() {
borderlayout = new BorderLayout();
setLayout(borderlayout);
setSize(1024, 768);
this.setBounds(0, 0, 1600, 900);
this.setBounds(0, 0, 1600, 1000);
this.setVisible(true);
}

Expand Down Expand Up @@ -94,7 +95,13 @@ public void actionPerformed(ActionEvent e) {
});


graphpanelMI1 = new JMenuItem("graphpanelMI1");
pricegraph = new JMenuItem("pricegraph");
pricegraph.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Creating Price Graph");
jdpDesktop.add(new GraphFrame_Mother());
}
});
graphpanelMI2 = new JMenuItem("graphpanelMI2");

generalinfoMI1 = new JMenuItem("General Stock Information");
Expand All @@ -112,7 +119,7 @@ public void actionPerformed(ActionEvent e) {

mainpanelmothermenu.add(menuitem_gate);

graphpanelmothermenu.add(graphpanelMI1);
graphpanelmothermenu.add(pricegraph);
graphpanelmothermenu.add(graphpanelMI2);

generalinfomothermenu.add(generalinfoMI1);
Expand Down
4 changes: 4 additions & 0 deletions Statistical_Analysis/Global_Region/gray/Global.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ public class Global {
public static String SYMBOL = "AAPL";
public static MotherFrame motherframe;

public static String GraphStart = "2016-01-01";
public static String GraphEnd = "2017-10-01";

public static String Graph_SYMBOL = "AAPL";
public Global() {

}
Expand Down
Loading