From 0508b076ac948a11bde14cfa9f5261796d890ef2 Mon Sep 17 00:00:00 2001 From: clarkohw Date: Mon, 19 Apr 2021 03:01:48 -0400 Subject: caching of prices profit --- src/main/java/edu/brown/cs/student/term/profit/ProfitCalculation.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java') diff --git a/src/main/java/edu/brown/cs/student/term/profit/ProfitCalculation.java b/src/main/java/edu/brown/cs/student/term/profit/ProfitCalculation.java index fe12612..77c1c3a 100644 --- a/src/main/java/edu/brown/cs/student/term/profit/ProfitCalculation.java +++ b/src/main/java/edu/brown/cs/student/term/profit/ProfitCalculation.java @@ -251,6 +251,7 @@ public class ProfitCalculation { JSONArray object = new JSONObject(response.body()).getJSONArray(ticker); try { double endPrice = object.getJSONObject(object.length() - 1).getDouble("c"); + currentStockPrices.put(ticker, endPrice); return endPrice; } catch (JSONException e) { currentStockPrices.put(ticker, -1.0); -- cgit v1.2.3-70-g09d2