Skip to content

Commit 80be8d7

Browse files
authored
Adding asset marketCaps to launched markets (#784)
1 parent 49de3c0 commit 80be8d7

File tree

3 files changed

+30
-22
lines changed

3 files changed

+30
-22
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ allprojects {
5252
}
5353

5454
group = "exchange.dydx.abacus"
55-
version = "1.13.57"
55+
version = "1.13.58"
5656

5757
repositories {
5858
google()

src/commonMain/kotlin/exchange.dydx.abacus/output/Market.kt

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -972,29 +972,37 @@ data class PerpetualMarketSummary(
972972
for ((assetId, asset) in internalState.assets) {
973973
val price = marketSummaryState.launchableMarketPrices[assetId]
974974
val marketId = "$assetId-USD"
975-
if (markets.keys.contains(marketId) || price == null) {
975+
if (price == null) {
976976
continue
977977
}
978978

979-
val market = PerpetualMarket(
980-
id = marketId,
981-
assetId = asset.id,
982-
market = asset.name,
983-
displayId = asset.displayableAssetId,
984-
oraclePrice = price.price,
985-
marketCaps = price.market_cap,
986-
priceChange24H = price.percent_change_24h,
987-
priceChange24HPercent = price.percent_change_24h,
988-
spot24hVolume = price.volume_24h,
989-
status = MarketStatus(
990-
canTrade = false,
991-
canReduce = false,
992-
),
993-
configs = null,
994-
perpetual = null,
995-
isLaunched = false,
996-
)
997-
markets[marketId] = market
979+
val existingMarket = markets[marketId]
980+
if (existingMarket != null) {
981+
markets[marketId] = existingMarket.copy(
982+
marketCaps = price.market_cap,
983+
spot24hVolume = price.volume_24h,
984+
)
985+
} else {
986+
val market = PerpetualMarket(
987+
id = marketId,
988+
assetId = asset.id,
989+
market = asset.name,
990+
displayId = asset.displayableAssetId,
991+
oraclePrice = price.price,
992+
marketCaps = price.market_cap,
993+
priceChange24H = price.percent_change_24h,
994+
priceChange24HPercent = price.percent_change_24h,
995+
spot24hVolume = price.volume_24h,
996+
status = MarketStatus(
997+
canTrade = false,
998+
canReduce = false,
999+
),
1000+
configs = null,
1001+
perpetual = null,
1002+
isLaunched = false,
1003+
)
1004+
markets[marketId] = market
1005+
}
9981006
}
9991007

10001008
return PerpetualMarketSummary(

v4_abacus.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'v4_abacus'
3-
spec.version = '1.13.57'
3+
spec.version = '1.13.58'
44
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
55
spec.source = { :http=> ''}
66
spec.authors = ''

0 commit comments

Comments
 (0)