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
When there is remaining limit order and collateral on orderMarginAccountBalance and user will try to place limit order in opposite direction collateralIncreaseEstimate is wrongly calculated.
Before placing order - additional margin required is 5.00
After placing order - no additional collateral was needed
Observed behaviour
Sum of pending orders is used to calculate collateral increase
Expected behaviour
Maximal risk exposure should be used to calculate collateral increase
Steps to reproduce
query EstimatePosition(
$marketId: ID!$openVolume: String!$averageEntryPrice: String!$orders: [OrderInfo!]
$marginAccountBalance: String!$generalAccountBalance: String!$orderMarginAccountBalance: String!$marginMode: MarginMode!$marginFactor: String
$includeRequiredPositionMarginInAvailableCollateral: Boolean
) {
estimatePosition(
marketId: $marketId
openVolume: $openVolume
averageEntryPrice: $averageEntryPrice
orders: $orders
marginAccountBalance: $marginAccountBalance
generalAccountBalance: $generalAccountBalance
orderMarginAccountBalance: $orderMarginAccountBalance
marginMode: $marginMode
marginFactor: $marginFactor
includeRequiredPositionMarginInAvailableCollateral: $includeRequiredPositionMarginInAvailableCollateral# Everywhere in the codebase we expect price values of the underlying to have the right# number of digits for formatting with market.decimalPlaces. By default the estimatePosition# query will return a full value requiring formatting using asset.decimals. For consistency# we can set this variable to true so that we can format with market.decimalPlaces
scaleLiquidationPriceToMarketDecimals: true
) {
collateralIncreaseEstimate {
worstCase
bestCase
}
}
}
{
"marketId": "ac7fc86bddf26748c6ba32a67037fe13c623cd4b53480aac4eaf29fbbd22ac31",
"openVolume": "0",
"averageEntryPrice": "357417",
"orders": [
{
"isMarketOrder": false,
"price": "500000",
"remaining": "10",
"side": "SIDE_SELL"
},
{
"isMarketOrder": false,
"price": "250000",
"remaining": "20",
"side": "SIDE_BUY"
}
],
"marginAccountBalance": "0",
"generalAccountBalance": "95000000",
"orderMarginAccountBalance": "5000000",
"marginFactor": "0.1",
"marginMode": "MARGIN_MODE_ISOLATED_MARGIN",
"includeRequiredPositionMarginInAvailableCollateral": true
}
Software version
v0.75.0-preview.8
Failing test
No response
Jenkins run
No response
Configuration used
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered:
Which is totally wrong. Open orders collateral is covered by orderMarginAccountBalance, openVolume collateral is covered by marginAccountBalance. We should get estimate only for last tiny market order and we get also for remaining limit orders.
Problem encountered
When there is remaining limit order and collateral on orderMarginAccountBalance and user will try to place limit order in opposite direction collateralIncreaseEstimate is wrongly calculated.
Before placing order - additional margin required is 5.00
After placing order - no additional collateral was needed
Observed behaviour
Sum of pending orders is used to calculate collateral increase
Expected behaviour
Maximal risk exposure should be used to calculate collateral increase
Steps to reproduce
Software version
v0.75.0-preview.8
Failing test
No response
Jenkins run
No response
Configuration used
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: