Skip to content

Commit

Permalink
feat: megavault cutoff time (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleroooo authored Nov 13, 2024
1 parent 137d3ee commit a8099e8
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.13.26"
version = "1.13.27"

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ object VaultCalculator {
return parser.asTypedObject<IndexerMegavaultPositionResponse>(apiResponse)
}

fun calculateVaultSummary(historicals: Array<IndexerMegavaultHistoricalPnlResponse>?): VaultDetails? {
fun calculateVaultSummary(historicals: Array<IndexerMegavaultHistoricalPnlResponse>?, dataCutoffMs: Double = 0.0): VaultDetails? {
val combinedPnls = historicals?.flatMap { it.megavaultPnl?.toList() ?: emptyList() } // Convert Array to List

if (combinedPnls.isNullOrEmpty()) {
Expand All @@ -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()
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.13.26'
spec.version = '1.13.27'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down

0 comments on commit a8099e8

Please sign in to comment.