From 43e4425dadd87aad27199adf0ab58c4b3949930d Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 18 Nov 2024 16:21:01 -0500 Subject: [PATCH 1/4] use-today-tvl --- .../kotlin/exchange.dydx.abacus/functional/vault/Vault.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 1f9bedb95..17a0835f9 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/Vault.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/Vault.kt @@ -133,9 +133,8 @@ object VaultCalculator { } else { 0.0 } - val thirtyDaysAgoEquity = thirtyDaysAgoEntry.equity ?: 0.0 - val thirtyDayReturnPercent = if (thirtyDaysAgoEquity != 0.0) { - (pnlDifference / thirtyDaysAgoEquity) + val thirtyDayReturnPercent = if (totalValue != 0.0) { + (pnlDifference / totalValue) } else { 0.0 } From 0bec96dabb4f55376265c7c4ace764019b2ddbf6 Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 18 Nov 2024 16:21:18 -0500 Subject: [PATCH 2/4] fix --- build.gradle.kts | 2 +- v4_abacus.podspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index cd609a10e..c437aaf2a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -52,7 +52,7 @@ allprojects { } group = "exchange.dydx.abacus" -version = "1.13.31" +version = "1.13.32" repositories { google() diff --git a/v4_abacus.podspec b/v4_abacus.podspec index 16515ebbd..ff24f26e4 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.31' + spec.version = '1.13.32' spec.homepage = 'https://github.com/dydxprotocol/v4-abacus' spec.source = { :http=> ''} spec.authors = '' From f58cb71cf2a85dc363b9d607baeeb3f2da966239 Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 18 Nov 2024 16:28:29 -0500 Subject: [PATCH 3/4] fix --- .../exchange.dydx.abacus/functional/vault/VaultTests.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commonTest/kotlin/exchange.dydx.abacus/functional/vault/VaultTests.kt b/src/commonTest/kotlin/exchange.dydx.abacus/functional/vault/VaultTests.kt index 7386bf52c..8886559ad 100644 --- a/src/commonTest/kotlin/exchange.dydx.abacus/functional/vault/VaultTests.kt +++ b/src/commonTest/kotlin/exchange.dydx.abacus/functional/vault/VaultTests.kt @@ -65,7 +65,7 @@ class VaultTests { val expectedVaultDetails = VaultDetails( totalValue = 10000.0, - thirtyDayReturnPercent = 0.1 * 365, + thirtyDayReturnPercent = 0.05 * 365, history = iListOf( VaultHistoryEntry( date = 1659465600000.0, @@ -150,7 +150,7 @@ class VaultTests { val vaultDetails = calculateVaultSummary(arrayOf(historicalPnl)) assertNotNull(vaultDetails) - assertEquals(0.6403508771929824, vaultDetails.thirtyDayReturnPercent) + assertEquals(0.6083333333333333, vaultDetails.thirtyDayReturnPercent) } @Test From 96b42351df5e6455f7e540e7115237c2ffb5b1d4 Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 18 Nov 2024 16:36:40 -0500 Subject: [PATCH 4/4] fix --- .../kotlin/exchange.dydx.abacus/payload/v4/V4VaultTests.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commonTest/kotlin/exchange.dydx.abacus/payload/v4/V4VaultTests.kt b/src/commonTest/kotlin/exchange.dydx.abacus/payload/v4/V4VaultTests.kt index 36a91fe5f..638074501 100644 --- a/src/commonTest/kotlin/exchange.dydx.abacus/payload/v4/V4VaultTests.kt +++ b/src/commonTest/kotlin/exchange.dydx.abacus/payload/v4/V4VaultTests.kt @@ -27,7 +27,7 @@ class V4VaultTests : V4BaseTests() { val vaultDetails = vault?.details assertEquals(10000.0, vaultDetails?.totalValue) - assertEquals(0.1 * 365, vaultDetails?.thirtyDayReturnPercent) + assertEquals(18.25, vaultDetails?.thirtyDayReturnPercent) assertEquals(2, vaultDetails?.history?.size) assertEquals(1000.0, vaultDetails?.history?.get(0)?.totalPnl) assertEquals(500.0, vaultDetails?.history?.get(1)?.totalPnl) @@ -50,7 +50,7 @@ class V4VaultTests : V4BaseTests() { val vault = perp.internalState.vault assertEquals(10000.0, vault?.details?.totalValue) - assertEquals(0.1 * 365, vault?.details?.thirtyDayReturnPercent) + assertEquals(18.25, vault?.details?.thirtyDayReturnPercent) assertEquals(2, vault?.details?.history?.size) assertEquals(1000.0, vault?.details?.history?.get(0)?.totalPnl) assertEquals(500.0, vault?.details?.history?.get(1)?.totalPnl)