diff --git a/src/main/java/com/mapofzones/tokenmatcher/domain/tokenprice/OsmosisTokenPrice.java b/src/main/java/com/mapofzones/tokenmatcher/domain/tokenprice/OsmosisTokenPrice.java index 9d95520..fc64ab1 100644 --- a/src/main/java/com/mapofzones/tokenmatcher/domain/tokenprice/OsmosisTokenPrice.java +++ b/src/main/java/com/mapofzones/tokenmatcher/domain/tokenprice/OsmosisTokenPrice.java @@ -30,12 +30,14 @@ public OsmosisTokenPrice tokenPriceFromPriceInTime(TokenPriceDto.PriceInTime pri OsmosisTokenPrice tokenPrice = new OsmosisTokenPrice(tokenPriceId); tokenPrice.setOsmosisSymbolPriceInUsd(priceInTime.getPrice()); + tokenPrice.setOsmosisSymbolTotalVolumesInUsd(priceInTime.getTotalVolumes()); return tokenPrice; } @Override public void setPriceInUsd(BigDecimal tokenPrice, BigDecimal marketCap, BigDecimal totalVolumes) { this.setOsmosisSymbolPriceInUsd(tokenPrice); + this.setOsmosisSymbolTotalVolumesInUsd(totalVolumes); } @Override diff --git a/src/main/java/com/mapofzones/tokenmatcher/domain/tokenprice/TokenPrice.java b/src/main/java/com/mapofzones/tokenmatcher/domain/tokenprice/TokenPrice.java index 8610563..40325dd 100644 --- a/src/main/java/com/mapofzones/tokenmatcher/domain/tokenprice/TokenPrice.java +++ b/src/main/java/com/mapofzones/tokenmatcher/domain/tokenprice/TokenPrice.java @@ -32,6 +32,9 @@ public abstract class TokenPrice> { @Column(name = "COINGECKO_SYMBOL_TOTAL_VOLUMES_IN_USD") private BigDecimal coingeckoSymbolTotalVolumesInUsd; + @Column(name = "OSMOSIS_SYMBOL_TOTAL_VOLUMES_IN_USD") + private BigDecimal osmosisSymbolTotalVolumesInUsd; + @Column(name = "SYMBOL_SUPPLY") private BigDecimal symbolSupply; diff --git a/src/main/java/com/mapofzones/tokenmatcher/service/tokenprice/client/dto/OsmosisTokenPriceDto.java b/src/main/java/com/mapofzones/tokenmatcher/service/tokenprice/client/dto/OsmosisTokenPriceDto.java index 7f0c08d..ec15ee5 100644 --- a/src/main/java/com/mapofzones/tokenmatcher/service/tokenprice/client/dto/OsmosisTokenPriceDto.java +++ b/src/main/java/com/mapofzones/tokenmatcher/service/tokenprice/client/dto/OsmosisTokenPriceDto.java @@ -30,7 +30,14 @@ public OsmosisTokenPriceDto(List osmosisTokenPriceList) { @Override public TokenPriceDto toTokenPrice() { List priceInTimeList = new ArrayList<>(); - osmosisTokenPriceList.forEach(osmosisTokenPrice -> priceInTimeList.add(new TokenPriceDto.PriceInTime(TimeHelper.millisToLocalDateTime(osmosisTokenPrice.getTime() * 1000), setOsmosisSymbolPriceInUsdFromDto(osmosisTokenPrice)))); + osmosisTokenPriceList.forEach(osmosisTokenPrice -> priceInTimeList.add( + new TokenPriceDto.PriceInTime( + TimeHelper.millisToLocalDateTime(osmosisTokenPrice.getTime() * 1000), + setOsmosisSymbolPriceInUsdFromDto(osmosisTokenPrice), + setOsmosisSymbolTotalVolumesInUsd(osmosisTokenPrice) + ) + ) + ); return new TokenPriceDto(priceInTimeList); } @@ -38,6 +45,10 @@ private BigDecimal setOsmosisSymbolPriceInUsdFromDto(OsmosisTokenPrice osmosisTo return osmosisTokenPrice.getClose().add(osmosisTokenPrice.getOpen()).add(osmosisTokenPrice.getHigh()).add(osmosisTokenPrice.getLow()).divide(BigDecimal.valueOf(4), RoundingMode.DOWN); } + private BigDecimal setOsmosisSymbolTotalVolumesInUsd(OsmosisTokenPrice osmosisTokenPrice) { + return osmosisTokenPrice.getVolume(); + } + @Data public static class OsmosisTokenPrice { @JsonProperty("time") diff --git a/src/main/java/com/mapofzones/tokenmatcher/service/tokenprice/services/pricefindservices/dto/TokenPriceDto.java b/src/main/java/com/mapofzones/tokenmatcher/service/tokenprice/services/pricefindservices/dto/TokenPriceDto.java index 74fcc9d..2855106 100644 --- a/src/main/java/com/mapofzones/tokenmatcher/service/tokenprice/services/pricefindservices/dto/TokenPriceDto.java +++ b/src/main/java/com/mapofzones/tokenmatcher/service/tokenprice/services/pricefindservices/dto/TokenPriceDto.java @@ -47,6 +47,12 @@ public PriceInTime(LocalDateTime time, BigDecimal price) { this.price = price; } + public PriceInTime(LocalDateTime time, BigDecimal price, BigDecimal totalVolumes) { + this.time = time; + this.price = price; + this.totalVolumes = totalVolumes; + } + public PriceInTime(LocalDateTime time, BigDecimal price, BigDecimal marketCap, BigDecimal totalVolumes) { this.time = time; this.price = price;