Skip to content

Commit

Permalink
remove tier id
Browse files Browse the repository at this point in the history
  • Loading branch information
aforaleka committed May 28, 2024
1 parent c9e59ca commit 9ceda36
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/commonMain/kotlin/exchange.dydx.abacus/output/Configs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import exchange.dydx.abacus.utils.Logger
import kollections.JsExport
import kollections.iListOf
import kollections.iMutableListOf
import kollections.toIList
import kotlinx.serialization.Serializable

@JsExport
Expand Down Expand Up @@ -263,11 +262,11 @@ data class EquityTiers(
): EquityTiers? {
data?.let {
val shortTermOrderEquityTiers = parser.asNativeList(data["shortTermOrderEquityTiers"])?.let { tiers ->
create(existing?.shortTermOrderEquityTiers?.toIList(), parser, tiers)
create(existing?.shortTermOrderEquityTiers, parser, tiers)
} ?: iListOf()

val statefulOrderEquityTiers = parser.asNativeList(data["statefulOrderEquityTiers"])?.let { tiers ->
create(existing?.statefulOrderEquityTiers?.toIList(), parser, tiers)
create(existing?.statefulOrderEquityTiers, parser, tiers)
} ?: iListOf()

return EquityTiers(shortTermOrderEquityTiers, statefulOrderEquityTiers)
Expand All @@ -290,14 +289,14 @@ data class EquityTiers(
parser.asMap(item)?.let {
val tier = existing?.getOrNull(i)
val nextTierData = parser.asMap(nextItem)
EquityTier.create(tier, parser, it, i + 1, nextTierData)?.let { equityTier ->
EquityTier.create(tier, parser, it, nextTierData)?.let { equityTier ->
equityTiers.add(equityTier)
}
}
}
return equityTiers
}
Logger.d { "Equity Tiers values not valid" }
Logger.d { "Equity Tiers not valid" }
return null
}
}
Expand All @@ -306,7 +305,6 @@ data class EquityTiers(
@JsExport
@Serializable
data class EquityTier(
val tierId: Int,
val requiredTotalNetCollateralUSD: Double,
val nextLevelRequiredTotalNetCollateralUSD: Double?,
val maxOrders: Int,
Expand All @@ -316,7 +314,6 @@ data class EquityTier(
existing: EquityTier?,
parser: ParserProtocol,
data: Map<*, *>?,
tierId: Int,
nextTierData: Map<*, *>?
): EquityTier? {
data?.let {
Expand All @@ -327,13 +324,12 @@ data class EquityTier(
val maxOrders = parser.asInt(data["maxOrders"])

if (requiredTotalNetCollateralUSD != null && maxOrders != null) {
return if (existing?.tierId != tierId ||
return if (
existing?.requiredTotalNetCollateralUSD != requiredTotalNetCollateralUSD ||
existing?.nextLevelRequiredTotalNetCollateralUSD != nextLevelRequiredTotalNetCollateralUSD ||
existing?.maxOrders != maxOrders
) {
EquityTier(
tierId,
requiredTotalNetCollateralUSD,
nextLevelRequiredTotalNetCollateralUSD,
maxOrders,
Expand Down

0 comments on commit 9ceda36

Please sign in to comment.