You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In isolated margin mode: open a position so that open volume is non-zero and there are some open orders. Query the EstimatePosition with the details of that position. The collateral increase estimate should be 0. No query the EstimatePosition with a higher margin factor. The collateral increase estimate should be positive and equal to the decrease in the general account balance after margin factor is updated for the party. Now lower the margin factor below the value the test originally started with and repeat. The collateral increase estimate should be negative and equal to the decrease in the general account balance (the balance should increase). (0013-NP-POSE-010)
The test requests for 3 estimates
base estimate
increase margin_factor
decrease margin_factor
and at each estimate the test updates the traders margin_factor and compares actual general account diffs with the estimate
Last part of this ac is to check the collateral increase estimate equals the decrease in the general account balance however this is where there is a divergence
Observed behaviour
the estimate returned from api and the actual diff between general account balance is significantly different
assert gen_acc_diff2 == int(
best_case3
), f"diff of {updated_gen_acc2} - {gen_acc} does not match collateral increase estimate"
E AssertionError: diff of 99997066940000000000000000 - 99998435940000000000000000 does not match collateral increase estimate
E assert -1369000000000000000000 == -392000000000000000000
Expected behaviour
api estimate and actual diff should be the same
Steps to reproduce
1. run the test`test_collateral_estimate_isolated_margin` on branch `est-margin-ac`
More fundamentally, it doesn't seem to be possible (at least not via the UI) to ever lower the per-market margin account balance in isolated mode (except for cancelling the order), going back an forth between say 40x and 20x leverage only keeps increasing the margin account balance.
Problem encountered
slack conversation
https://vegaprotocol.slack.com/archives/CAHA5EX0F/p1709906805588419
Ac
The test requests for 3 estimates
and at each estimate the test updates the traders
margin_factor
and compares actual general account diffs with the estimateLast part of this ac is to check the collateral increase estimate equals the decrease in the general account balance however this is where there is a divergence
Observed behaviour
the estimate returned from api and the actual diff between general account balance is significantly different
Expected behaviour
api estimate and actual diff should be the same
Steps to reproduce
Software version
dev branch
Failing test
test_collateral_estimate_isolated_margin
Jenkins run
https://jenkins.vega.rocks/job/common/job/system-tests-wrapper/48220/testReport/junit/tests.margins/margins_test/test_collateral_estimate_isolated_margin/
Configuration used
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: