Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: treat no position as zero position when calculating stop order o… #11253

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading