From a611ee3fb6aab63cdcf00dfcc2eb7c53715c8552 Mon Sep 17 00:00:00 2001 From: jeremy lee Date: Thu, 2 May 2024 12:21:02 -0400 Subject: [PATCH 1/4] feat: add new properties to market --- src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt | 6 ++++++ .../processor/markets/MarketProcessor.kt | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt b/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt index 814a227be..0ee3e0e80 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt @@ -289,6 +289,8 @@ data class MarketPerpetual( val nextFundingAtMilliseconds: Double? = null, val openInterest: Double, val openInterestUSDC: Double, + val openInterestLowerCap: Double? = null, + val openInterestUpperCap: Double? = null, val line: IList?, ) { companion object { @@ -303,6 +305,8 @@ data class MarketPerpetual( val nextFundingRate = parser.asDouble(data["nextFundingRate"]) val nextFundingAtMilliseconds = parser.asDatetime(data["nextFundingAt"])?.toEpochMilliseconds()?.toDouble() + val openInterestLowerCap = parser.asDouble(data["openInterestLowerCap"]) + val openInterestUpperCap = parser.asDouble(data["openInterestUpperCap"]) val openInterest = parser.asDouble(data["openInterest"]) val openInterestUSDC = parser.asDouble(data["openInterestUSDC"]) @@ -324,6 +328,8 @@ data class MarketPerpetual( nextFundingAtMilliseconds, openInterest, openInterestUSDC ?: 0.0, + openInterestLowerCap, + openInterestUpperCap, line, ) } else { diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/processor/markets/MarketProcessor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/processor/markets/MarketProcessor.kt index 8c7fd9b2e..c2bbc8a74 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/processor/markets/MarketProcessor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/processor/markets/MarketProcessor.kt @@ -7,6 +7,7 @@ import exchange.dydx.abacus.utils.Numeric import exchange.dydx.abacus.utils.ServerTime import exchange.dydx.abacus.utils.mutable import exchange.dydx.abacus.utils.safeSet +import exchange.dydx.abacus.utils.Logger import kotlin.time.Duration.Companion.seconds @Suppress("UNCHECKED_CAST") @@ -111,6 +112,8 @@ internal class MarketProcessor(parser: ParserProtocol, private val calculateSpar "double" to mapOf( "volume24H" to "volume24H", "openInterest" to "openInterest", + "openInterestLowerCap" to "openInterestLowerCap", + "openInterestUpperCap" to "openInterestUpperCap", "nextFundingRate" to "nextFundingRate", ), "datetime" to mapOf( From 3b145b91b9a7b89041618dbe25df2b81824aa447 Mon Sep 17 00:00:00 2001 From: jeremy lee Date: Thu, 2 May 2024 13:15:22 -0400 Subject: [PATCH 2/4] spotless apply --- .../exchange.dydx.abacus/processor/markets/MarketProcessor.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/processor/markets/MarketProcessor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/processor/markets/MarketProcessor.kt index c2bbc8a74..0910989e1 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/processor/markets/MarketProcessor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/processor/markets/MarketProcessor.kt @@ -7,7 +7,6 @@ import exchange.dydx.abacus.utils.Numeric import exchange.dydx.abacus.utils.ServerTime import exchange.dydx.abacus.utils.mutable import exchange.dydx.abacus.utils.safeSet -import exchange.dydx.abacus.utils.Logger import kotlin.time.Duration.Companion.seconds @Suppress("UNCHECKED_CAST") From 837f5254b048891e0c9b1f6d38ef4afc86c29de0 Mon Sep 17 00:00:00 2001 From: jeremy lee Date: Thu, 2 May 2024 13:22:35 -0400 Subject: [PATCH 3/4] named args! --- .../exchange.dydx.abacus/output/Market.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt b/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt index 0ee3e0e80..05d225572 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt @@ -321,16 +321,16 @@ data class MarketPerpetual( existing.line != line ) { MarketPerpetual( - volume24H, - trades24H, - null, - nextFundingRate, - nextFundingAtMilliseconds, - openInterest, - openInterestUSDC ?: 0.0, - openInterestLowerCap, - openInterestUpperCap, - line, + volume24H=volume24H, + trades24H=trades24H, + volume24HUSDC=null, + nextFundingRate=nextFundingRate, + nextFundingAtMilliseconds=nextFundingAtMilliseconds, + openInterest=openInterest, + openInterestUSDC=openInterestUSDC ?: 0.0, + openInterestLowerCap=openInterestLowerCap, + openInterestUpperCap=openInterestUpperCap, + line=line, ) } else { existing From 7cb2da46713aa0dbaa31829de67804600e1d66de Mon Sep 17 00:00:00 2001 From: jeremy lee Date: Thu, 2 May 2024 13:22:49 -0400 Subject: [PATCH 4/4] spotless apply --- .../exchange.dydx.abacus/output/Market.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt b/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt index 05d225572..10f7aad9c 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt @@ -321,16 +321,16 @@ data class MarketPerpetual( existing.line != line ) { MarketPerpetual( - volume24H=volume24H, - trades24H=trades24H, - volume24HUSDC=null, - nextFundingRate=nextFundingRate, - nextFundingAtMilliseconds=nextFundingAtMilliseconds, - openInterest=openInterest, - openInterestUSDC=openInterestUSDC ?: 0.0, - openInterestLowerCap=openInterestLowerCap, - openInterestUpperCap=openInterestUpperCap, - line=line, + volume24H = volume24H, + trades24H = trades24H, + volume24HUSDC = null, + nextFundingRate = nextFundingRate, + nextFundingAtMilliseconds = nextFundingAtMilliseconds, + openInterest = openInterest, + openInterestUSDC = openInterestUSDC ?: 0.0, + openInterestLowerCap = openInterestLowerCap, + openInterestUpperCap = openInterestUpperCap, + line = line, ) } else { existing