Updated on 2026-08-14
This commit is contained in:
parent
72dfa81fcf
commit
9957e986e1
4 changed files with 11 additions and 11 deletions
|
|
@ -20,7 +20,7 @@ data class TokenMarketListResponse(
|
||||||
@Json(name = "name") val name: String,
|
@Json(name = "name") val name: String,
|
||||||
@Json(name = "symbol") val symbol: String,
|
@Json(name = "symbol") val symbol: String,
|
||||||
@Json(name = "current_price") val currentPrice: BigDecimal,
|
@Json(name = "current_price") val currentPrice: BigDecimal,
|
||||||
@Json(name = "price_change_percentage") val priceChangePercentage: PriceChangePercentage,
|
@Json(name = "price_change_percentage") val priceChangePercentage: PriceChangePercentage?,
|
||||||
@Json(name = "market_rating") val marketRating: Int?,
|
@Json(name = "market_rating") val marketRating: Int?,
|
||||||
@Json(name = "market_cap") val marketCap: BigDecimal?,
|
@Json(name = "market_cap") val marketCap: BigDecimal?,
|
||||||
@Json(name = "is_under_market_cap_limit") val isUnderMarketCapLimit: Boolean?,
|
@Json(name = "is_under_market_cap_limit") val isUnderMarketCapLimit: Boolean?,
|
||||||
|
|
@ -28,9 +28,9 @@ data class TokenMarketListResponse(
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class PriceChangePercentage(
|
data class PriceChangePercentage(
|
||||||
@Json(name = "24h") val h24: BigDecimal,
|
@Json(name = "24h") val h24: BigDecimal?,
|
||||||
@Json(name = "1w") val week1: BigDecimal,
|
@Json(name = "1w") val week1: BigDecimal?,
|
||||||
@Json(name = "30d") val day30: BigDecimal,
|
@Json(name = "30d") val day30: BigDecimal?,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -28,9 +28,9 @@ internal object TokenMarketListConverter : Converter<TokenMarketListResponse, Li
|
||||||
imageHost = imageHost,
|
imageHost = imageHost,
|
||||||
tokenQuotesShort = TokenQuotesShort(
|
tokenQuotesShort = TokenQuotesShort(
|
||||||
currentPrice = token.currentPrice,
|
currentPrice = token.currentPrice,
|
||||||
h24ChangePercent = token.priceChangePercentage.h24.movePointLeft(2),
|
h24ChangePercent = token.priceChangePercentage?.h24?.movePointLeft(2),
|
||||||
weekChangePercent = token.priceChangePercentage.week1.movePointLeft(2),
|
weekChangePercent = token.priceChangePercentage?.week1?.movePointLeft(2),
|
||||||
monthChangePercent = token.priceChangePercentage.day30.movePointLeft(2),
|
monthChangePercent = token.priceChangePercentage?.day30?.movePointLeft(2),
|
||||||
),
|
),
|
||||||
tokenCharts = TokenMarket.Charts(h24 = null, week = null, month = null),
|
tokenCharts = TokenMarket.Charts(h24 = null, week = null, month = null),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import java.math.BigDecimal
|
||||||
|
|
||||||
data class TokenQuotesShort(
|
data class TokenQuotesShort(
|
||||||
val currentPrice: BigDecimal,
|
val currentPrice: BigDecimal,
|
||||||
val h24ChangePercent: BigDecimal,
|
val h24ChangePercent: BigDecimal?,
|
||||||
val weekChangePercent: BigDecimal,
|
val weekChangePercent: BigDecimal?,
|
||||||
val monthChangePercent: BigDecimal,
|
val monthChangePercent: BigDecimal?,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun TokenQuotesShort.toFull() = TokenQuotes(
|
fun TokenQuotesShort.toFull() = TokenQuotes(
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ internal class MarketsTokenItemConverter(
|
||||||
TrendInterval.D7 -> tokenQuotesShort.weekChangePercent
|
TrendInterval.D7 -> tokenQuotesShort.weekChangePercent
|
||||||
TrendInterval.M1 -> tokenQuotesShort.monthChangePercent
|
TrendInterval.M1 -> tokenQuotesShort.monthChangePercent
|
||||||
}
|
}
|
||||||
val scaled = percent.setScale(4, RoundingMode.HALF_UP)
|
val scaled = percent?.setScale(4, RoundingMode.HALF_UP)
|
||||||
return when {
|
return when {
|
||||||
scaled == null -> PriceChangeType.NEUTRAL
|
scaled == null -> PriceChangeType.NEUTRAL
|
||||||
scaled > BigDecimal.ZERO -> PriceChangeType.UP
|
scaled > BigDecimal.ZERO -> PriceChangeType.UP
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue