Skip to content

Commit

Permalink
MOB462 Expose marginUsage from isolated positions
Browse files Browse the repository at this point in the history
  • Loading branch information
johnqh committed Apr 29, 2024
1 parent 7d3a873 commit 04f53b6
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 116 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ allprojects {
}

group = "exchange.dydx.abacus"
version = "1.6.50"
version = "1.6.51"

repositories {
google()
Expand Down
208 changes: 94 additions & 114 deletions integration/iOS/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ class AccountCalculator(val parser: ParserProtocol, private val useParentSubacco
"freeCollateral",
childSubaccount["freeCollateral"],
)
modifiedChildOpenPosition?.safeSet(
"marginUsage",
childSubaccount["marginUsage"],
)
modifiedChildOpenPosition?.safeSet("equity", childSubaccount["equity"])
modifiedOpenPositions.safeSet(market, modifiedChildOpenPosition)
}
Expand Down
8 changes: 8 additions & 0 deletions src/commonMain/kotlin/exchange.dydx.abacus/output/Account.kt
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ data class SubaccountPosition(
val resources: SubaccountPositionResources,
val childSubaccountNumber: Int?,
val freeCollateral: TradeStatesWithDoubleValues?,
val marginUsage: TradeStatesWithDoubleValues?,
val quoteBalance: TradeStatesWithDoubleValues?, // available for isolated market position
val equity: TradeStatesWithDoubleValues?, // available for isolated market position
) {
Expand Down Expand Up @@ -365,6 +366,11 @@ data class SubaccountPosition(
parser,
parser.asMap(data["freeCollateral"]),
)
val marginUsage = TradeStatesWithDoubleValues.create(
null,
parser,
parser.asMap(data["marginUsage"]),
)
val quoteBalance = TradeStatesWithDoubleValues.create(
null,
parser,
Expand Down Expand Up @@ -400,6 +406,7 @@ data class SubaccountPosition(
existing.resources !== resources ||
existing.childSubaccountNumber !== childSubaccountNumber ||
existing.freeCollateral !== freeCollateral ||
existing.marginUsage !== marginUsage ||
existing.quoteBalance !== quoteBalance ||
existing.equity !== equity
) {
Expand Down Expand Up @@ -430,6 +437,7 @@ data class SubaccountPosition(
resources,
childSubaccountNumber,
freeCollateral,
marginUsage,
quoteBalance,
equity,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ class V4ParentSubaccountTests : V4BaseTests(true) {
},
"freeCollateral": {
"current": 796.244
},
"marginUsage": {
"current": 0.0397
}
}
},
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.6.50'
spec.version = '1.6.51'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down

0 comments on commit 04f53b6

Please sign in to comment.