From a8099e869e8736db817a5a4ff48e5a6ab5b46f43 Mon Sep 17 00:00:00 2001 From: tyleroooo Date: Wed, 13 Nov 2024 17:57:26 -0500 Subject: [PATCH] feat: megavault cutoff time (#751) --- build.gradle.kts | 2 +- .../kotlin/exchange.dydx.abacus/functional/vault/Vault.kt | 4 ++-- v4_abacus.podspec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b899f9a0b..8316b4889 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -52,7 +52,7 @@ allprojects { } group = "exchange.dydx.abacus" -version = "1.13.26" +version = "1.13.27" repositories { google() diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/Vault.kt b/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/Vault.kt index aa0d2fb86..d04c7f08e 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/Vault.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/Vault.kt @@ -94,7 +94,7 @@ object VaultCalculator { return parser.asTypedObject(apiResponse) } - fun calculateVaultSummary(historicals: Array?): VaultDetails? { + fun calculateVaultSummary(historicals: Array?, dataCutoffMs: Double = 0.0): VaultDetails? { val combinedPnls = historicals?.flatMap { it.megavaultPnl?.toList() ?: emptyList() } // Convert Array to List if (combinedPnls.isNullOrEmpty()) { @@ -112,7 +112,7 @@ object VaultCalculator { totalPnl = parser.asDouble(entry.totalPnl) ?: 0.0, ) } - } + }.filter { entry -> entry.date != null && entry.date >= dataCutoffMs } val latestEntry = history.first() val latestTime = latestEntry.date ?: Clock.System.now().toEpochMilliseconds().toDouble() diff --git a/v4_abacus.podspec b/v4_abacus.podspec index d0ed9efa2..593cc35b8 100644 --- a/v4_abacus.podspec +++ b/v4_abacus.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'v4_abacus' - spec.version = '1.13.26' + spec.version = '1.13.27' spec.homepage = 'https://github.com/dydxprotocol/v4-abacus' spec.source = { :http=> ''} spec.authors = ''