diff options
author | clarkohw <clark_oh-willeke@brown.edu> | 2021-04-19 02:59:57 -0400 |
---|---|---|
committer | clarkohw <clark_oh-willeke@brown.edu> | 2021-04-19 02:59:57 -0400 |
commit | 8e76bf15c53c540a72a273ec560a624dfb7e11df (patch) | |
tree | 41c2679481ba3ff1e7bafda71f702e0c09fe69d8 /src/test/java/edu/brown/cs/student/ProfitCalculationTest.java | |
parent | 26827e5631cc7c0d5d24fa5459a6abbe9e4c60a5 (diff) |
efficiency for profit calc + tests
Diffstat (limited to 'src/test/java/edu/brown/cs/student/ProfitCalculationTest.java')
-rw-r--r-- | src/test/java/edu/brown/cs/student/ProfitCalculationTest.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java b/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java index d1fc9be..f435c7c 100644 --- a/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java +++ b/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java @@ -12,6 +12,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import java.time.LocalDate; import java.util.List; import java.sql.Date; import java.time.Instant; @@ -55,7 +56,14 @@ public class ProfitCalculationTest { //price of GME at end time is 154.69 List<StockHolding> trade = profitCalculation.getHoldingsList(); //buy with no sell - assertEquals(3842.25, trade.get(0).getUnrealizedGain(),6); + assertEquals(trade.get(0).getUnrealizedGain(), 3842.25,.25); + assertEquals(trade.get(0).getRealizedGain(), 0, .01); + + + profitCalculation = new ProfitCalculation(DatabaseQuerier.getConn(), "Don", new Date(1618234200000l), + new Date(1618814264000l)); + + assertEquals(profitCalculation.compareToSP500(), .01464, .001); } |