aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/mock_tradeClarks.sqlite3bin45056 -> 53248 bytes
-rw-r--r--src/main/java/edu/brown/cs/student/term/Main.java3
-rw-r--r--src/main/java/edu/brown/cs/student/term/ProfitCalculation.java6
3 files changed, 4 insertions, 5 deletions
diff --git a/data/mock_tradeClarks.sqlite3 b/data/mock_tradeClarks.sqlite3
index 7b5f3d1..980c539 100644
--- a/data/mock_tradeClarks.sqlite3
+++ b/data/mock_tradeClarks.sqlite3
Binary files differ
diff --git a/src/main/java/edu/brown/cs/student/term/Main.java b/src/main/java/edu/brown/cs/student/term/Main.java
index 3124ea4..fd352f7 100644
--- a/src/main/java/edu/brown/cs/student/term/Main.java
+++ b/src/main/java/edu/brown/cs/student/term/Main.java
@@ -48,7 +48,7 @@ public final class Main {
}
- ProfitCalculation person = new ProfitCalculation(null, "Sophie", new Date(1515629591000L), new Date(1715507898000L));
+ ProfitCalculation person = new ProfitCalculation(null, "Vincent", new Date(1515629591000L), new Date(1715507898000L));
try {
person.setConnection("./data/mock_tradeClarks.sqlite3");
} catch(Exception e) {
@@ -56,7 +56,6 @@ public final class Main {
}
person.calculateGains();
- person.compareToNASDAQ();
// HashMap<String, Command> commandHashMap = new HashMap<>();
// /** add commands to map here! */
diff --git a/src/main/java/edu/brown/cs/student/term/ProfitCalculation.java b/src/main/java/edu/brown/cs/student/term/ProfitCalculation.java
index 6510194..aa1bc09 100644
--- a/src/main/java/edu/brown/cs/student/term/ProfitCalculation.java
+++ b/src/main/java/edu/brown/cs/student/term/ProfitCalculation.java
@@ -92,7 +92,7 @@ public class ProfitCalculation {
while (rs.next()) {
String ticker = rs.getString("stock_name");
int shares = rs.getInt("number_of_shares");
- double price = rs.getDouble("trade_amount") / shares;
+ double price = rs.getDouble("price");
OrderTuple order = new OrderTuple(shares, price, rs.getDate("trade_timestamp"));
//one element list for first time ticker is seen.
@@ -223,7 +223,7 @@ public class ProfitCalculation {
}
}
- public double getCurrentPrice(String ticker) {
+ private double getCurrentPrice(String ticker) {
String PRICE_URL = BASE_URL + "/last/stocks/" + ticker;
HttpClient client = HttpClient.newHttpClient();
@@ -275,7 +275,7 @@ public class ProfitCalculation {
/**
* return percent change in SPY (SP 500) over the time period.
*/
- public double compareToSP500() {
+ private double compareToSP500() {
String url = "https://data.alpaca.markets/v1/bars/"
+ "day?"
+ "symbols=SPY"