if (tradeJson.has("premiumDate")) {
LocalDate premiumDate = LocalDate.parse(tradeJson.getString("premiumDate"));
trade.setPremiumDate(premiumDate);
if (tradeJson.has("premiumTime")) {
LocalTime premiumTime = LocalTime.parse(tradeJson.getString("premiumTime"));
ZoneOffset premiumOffset = getOffset(tradeJson, "premiumOffset");
ZonedDateTime zonedDateTime = premiumDate.atTime(premiumTime).atZone(premiumOffset);
trade.setPremiumTime(zonedDateTime.toOffsetDateTime().toOffsetTime());
}
}
if (tradeJson.has("quantity")) {
trade.setQuantity(new BigDecimal(tradeJson.getString("quantity")));
}
if (tradeJson.has("tradeDate")) {
LocalDate tradeDate = LocalDate.parse(tradeJson.getString("tradeDate"));
trade.setTradeDate(tradeDate);
if (tradeJson.has("tradeTime")) {
LocalTime tradeTime = LocalTime.parse(tradeJson.getString("tradeTime"));
ZoneOffset tradeOffset = getOffset(tradeJson, "tradeOffset");
ZonedDateTime zonedDateTime = tradeDate.atTime(tradeTime).atZone(tradeOffset);
trade.setTradeTime(zonedDateTime.toOffsetDateTime().toOffsetTime());
}
}
addTradeAttributes(trade, tradeJson);