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

leave auction do not trigger leave auction #3363

Merged
merged 3 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion execution/liquidity_provision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,6 @@ func TestParkOrderPanicOrderNotFoundInBook(t *testing.T) {

tm.events = nil
t.Run("party place a new order which should unpark the pegged order", func(t *testing.T) {
tm.market.OnChainTimeUpdate(ctx, auctionEnd.Add(10*time.Second))
o := getMarketOrder(tm, now, types.Order_TYPE_LIMIT, types.Order_TIME_IN_FORCE_GTC, "Order02", types.Side_SIDE_SELL, party4, 10, 2400)
conf, err := tm.market.SubmitOrder(ctx, o)
assert.NoError(t, err)
Expand All @@ -1945,6 +1944,7 @@ func TestParkOrderPanicOrderNotFoundInBook(t *testing.T) {
conf2, err := tm.market.SubmitOrder(ctx, o2)
assert.NoError(t, err)
assert.NotNil(t, conf2)
tm.market.OnChainTimeUpdate(ctx, auctionEnd.Add(10*time.Second))
})

t.Run("pegged order is REJECTED", func(t *testing.T) {
Expand Down
10 changes: 6 additions & 4 deletions execution/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,9 @@ func (m *Market) LeaveAuction(ctx context.Context, now time.Time) {
for _, order := range ordersToCancel {
_, err := m.cancelOrder(ctx, order.PartyId, order.Id)
if err != nil {
m.log.Error("Failed to cancel order", logging.String("OrderID", order.Id))
m.log.Panic("Failed to cancel order",
logging.Error(err),
logging.String("OrderID", order.Id))
}
}

Expand Down Expand Up @@ -1374,6 +1376,7 @@ func (m *Market) checkPriceAndGetTrades(ctx context.Context, order *types.Order)
logging.Error(merr))
}
}

if evt := m.as.AuctionExtended(ctx); evt != nil {
m.broker.Send(evt)
}
Expand Down Expand Up @@ -2232,6 +2235,7 @@ func (m *Market) cancelOrder(ctx context.Context, partyID, orderID string) (*typ
m.log.Debug("liquidity update error", logging.Error(err))
}
}

m.checkLiquidity(ctx, nil)
m.commandLiquidityAuction(ctx)

Expand Down Expand Up @@ -3522,9 +3526,7 @@ func (m *Market) commandLiquidityAuction(ctx context.Context) {
// TODO: Need to also get indicative trades and check how they'd impact target stake,
// see https://github.com/vegaprotocol/vega/issues/3047
// If price monitoring doesn't trigger auction than leave it
if m.as.AuctionEnd() && m.matching.BidAndAskPresentAfterAuction() {
m.LeaveAuction(ctx, m.currentTime)
} else if evt := m.as.AuctionExtended(ctx); evt != nil {
if evt := m.as.AuctionExtended(ctx); evt != nil {
m.broker.Send(evt)
}
}
Expand Down