Skip to content

Commit

Permalink
Fix subaccount data issue with websocket reconnect (#753)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang authored Nov 14, 2024
1 parent 4d4e1fb commit b4025ff
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 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.28"
version = "1.13.29"

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ internal class OrderbookProcessor(
): InternalMarketState {
this.groupingMultiplier = groupingMultiplier
existing.groupedOrderbook = calculator.calculate(
rawOrderbook = existing.rawOrderbook,
rawOrderbook = existing.consolidatedOrderbook,
tickSize = tickSize ?: defaultTickSize,
groupingMultiplier = groupingMultiplier,
)
Expand Down Expand Up @@ -105,7 +105,7 @@ internal class OrderbookProcessor(
rawOrderbook = existing.rawOrderbook,
)
existing.groupedOrderbook = calculator.calculate(
rawOrderbook = existing.rawOrderbook,
rawOrderbook = existing.consolidatedOrderbook,
tickSize = tickSize ?: defaultTickSize,
groupingMultiplier = groupingMultiplier,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal class V4SubaccountsProcessor(
payload: List<Any>?,
): MutableMap<Int, InternalSubaccountState> {
return if (payload != null) {
internalState.clear()
val modifiedSubaccountNumbers = mutableListOf<Int>()
for (item in payload) {
val data = parser.asNativeMap(item)
if (data != null) {
Expand All @@ -62,9 +62,16 @@ internal class V4SubaccountsProcessor(
firstTime = true,
)
internalState[subaccountNumber] = subaccount
modifiedSubaccountNumbers.add(subaccountNumber)
}
}
}
val keys = internalState.keys.toSet()
for (key in keys) {
if (!modifiedSubaccountNumbers.contains(key)) {
internalState.remove(key)
}
}
internalState
} else {
internalState
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.28'
spec.version = '1.13.29'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down

0 comments on commit b4025ff

Please sign in to comment.