diff --git a/.gitignore b/.gitignore index 0e6c2db..85c4dcb 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ hs_err_pid* /.settings/ /.classpath /.project +/nbproject/ diff --git a/src/main/java/com/cf/data/map/poloniex/PoloniexDataMapper.java b/src/main/java/com/cf/data/map/poloniex/PoloniexDataMapper.java index f97312d..c705d4f 100644 --- a/src/main/java/com/cf/data/map/poloniex/PoloniexDataMapper.java +++ b/src/main/java/com/cf/data/map/poloniex/PoloniexDataMapper.java @@ -43,7 +43,7 @@ public class PoloniexDataMapper { private final Gson gson; private final static Logger LOGGER = LogManager.getLogger(); - private final static DateTimeFormatter DTF = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneOffset.UTC); + private final static DateTimeFormatter DTF = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss[.n]").withZone(ZoneOffset.UTC); private final static String EMPTY_RESULTS = "[]"; private final static String INVALID_CHART_DATA_DATE_RANGE_RESULT = "[{\"date\":0,\"high\":0,\"low\":0,\"open\":0,\"close\":0,\"volume\":0,\"quoteVolume\":0,\"weightedAverage\":0}]"; private final static String INVALID_CHART_DATA_CURRENCY_PAIR_RESULT = "{\"error\":\"Invalid currency pair.\"}"; diff --git a/src/test/java/com/cf/data/map/poloniex/PoloniexDataMapperTest.java b/src/test/java/com/cf/data/map/poloniex/PoloniexDataMapperTest.java index c789e34..2a0d2c9 100644 --- a/src/test/java/com/cf/data/map/poloniex/PoloniexDataMapperTest.java +++ b/src/test/java/com/cf/data/map/poloniex/PoloniexDataMapperTest.java @@ -142,12 +142,12 @@ public void mapCancelOrderFailureReturnsFalse() { @Test public void mapBuyTradeOrder() { - String data = "{\"orderNumber\":31226040,\"resultingTrades\":[{\"amount\":\"338.8732\",\"date\":\"2014-10-18 23:03:21\",\"rate\":\"0.00000173\",\"total\":\"0.00058625\",\"tradeID\":\"16164\",\"type\":\"buy\"}]}"; + String data = "{\"orderNumber\":31226040,\"resultingTrades\":[{\"amount\":\"338.8732\",\"date\":\"2021-10-23 19:32:05.000000\",\"rate\":\"0.00000173\",\"total\":\"0.00058625\",\"tradeID\":\"16164\",\"type\":\"buy\"}]}"; PoloniexOrderResult orderResult = mapper.mapTradeOrder(data); assertEquals(31226040L, orderResult.orderNumber.longValue()); assertEquals(1, orderResult.resultingTrades.size()); assertEquals(BigDecimal.valueOf(338.8732), orderResult.resultingTrades.get(0).amount); - assertEquals("2014-10-18T23:03:21Z", orderResult.resultingTrades.get(0).date.toString()); + assertEquals("2021-10-23T19:32:05Z", orderResult.resultingTrades.get(0).date.toString()); assertEquals(BigDecimal.valueOf(0.00000173), orderResult.resultingTrades.get(0).rate); assertEquals(BigDecimal.valueOf(0.00058625), orderResult.resultingTrades.get(0).total); assertEquals("16164", orderResult.resultingTrades.get(0).tradeID);