diff --git a/CHANGELOG.md b/CHANGELOG.md index ee3f901383..03eb1a1d07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ - [10950](https://github.com/vegaprotocol/vega/issues/10950) - Fix bug that caused cancelled liquidity provisions to stick around after opening auction. - [10975](https://github.com/vegaprotocol/vega/issues/10975) - Fix marshaller for stop order rejection error. - [10973](https://github.com/vegaprotocol/vega/issues/10973) - Avoid entering an auction or doing mark-to-market before market entered opening auction or after it is in a terminal state. +- [11252](https://github.com/vegaprotocol/vega/issues/11252) - Treat no position as zero position when calculating stop order overrides. - [10969](https://github.com/vegaprotocol/vega/issues/10969) - Ensure teams statistics are computed from team rewards. - [10962](https://github.com/vegaprotocol/vega/issues/10962) - Fix `lastFeeDistribution` time in snapshot. - [10974](https://github.com/vegaprotocol/vega/issues/10974) - Target stake for spot should not consider position factor. diff --git a/core/execution/future/market.go b/core/execution/future/market.go index d5327ec2e0..5bb8a65dce 100644 --- a/core/execution/future/market.go +++ b/core/execution/future/market.go @@ -4145,10 +4145,13 @@ func (m *Market) submitStopOrders( if v.Status == status { if v.SizeOverrideSetting == types.StopOrderSizeOverrideSettingPosition { // Update the order size to match that of the party's position - pos, _ := m.position.GetPositionByPartyID(v.Party) + var pos int64 + if position, ok := m.position.GetPositionByPartyID(v.Party); ok { + pos = position.Size() + } // Scale this size if required - scaledPos := num.DecimalFromInt64(pos.Size()) + scaledPos := num.DecimalFromInt64(pos) if v.SizeOverrideValue != nil { scaledPos = scaledPos.Mul(v.SizeOverrideValue.PercentageSize) scaledPos = scaledPos.Round(0)