Skip to content

Commit

Permalink
Merge pull request #11253 from vegaprotocol/11252-no-position-means-zero
Browse files Browse the repository at this point in the history
fix: treat no position as zero position when calculating stop order o…
  • Loading branch information
jeremyletang authored May 9, 2024
2 parents adb87b0 + a239fdb commit 476bb1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions core/execution/future/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 476bb1f

Please sign in to comment.