Skip to content

Commit

Permalink
fix: pnl sorting (#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleroooo authored Sep 26, 2024
1 parent f5cf7d9 commit fc49316
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ allprojects {
}

group = "exchange.dydx.abacus"
version = "1.12.1"
version = "1.12.2"

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ object VaultCalculator {
}

val vaultOfVaultsPnl =
historical!!.megavaultPnl!!.sortedByDescending { parser.asDouble(it.createdAt) }
historical!!.megavaultPnl!!.sortedByDescending { parser.asDatetime(it.createdAt)?.toEpochMilliseconds() ?: 0 }

val history = vaultOfVaultsPnl.mapNotNull { entry ->
parser.asDatetime(entry.createdAt)?.toEpochMilliseconds()?.toDouble()?.let { createdAt ->
Expand Down Expand Up @@ -265,7 +265,7 @@ object VaultCalculator {
return null
}

val sortedPnl = historicalPnl.sortedByDescending { it.createdAt }
val sortedPnl = historicalPnl.sortedByDescending { parser.asDatetime(it.createdAt)?.toEpochMilliseconds() ?: 0 }
val latestEntry = sortedPnl.first()
val latestTime = parser.asDatetime(latestEntry.createdAt)?.toEpochMilliseconds() ?: Clock.System.now().toEpochMilliseconds()
val thirtyDaysAgoTime = latestTime - 30.days.inWholeMilliseconds
Expand Down
2 changes: 1 addition & 1 deletion v4_abacus.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'v4_abacus'
spec.version = '1.12.1'
spec.version = '1.12.2'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down

0 comments on commit fc49316

Please sign in to comment.