From 5aecb0401ba22167a8121f092ef6b8262cfc6f58 Mon Sep 17 00:00:00 2001 From: wwestgarth Date: Wed, 3 Jul 2024 09:17:17 +0100 Subject: [PATCH] fix: do not enter long block auction if market is terminated --- core/execution/future/market.go | 4 ++++ core/execution/spot/market.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/core/execution/future/market.go b/core/execution/future/market.go index 0602a6b168c..babf57f7b3f 100644 --- a/core/execution/future/market.go +++ b/core/execution/future/market.go @@ -1499,6 +1499,10 @@ func (m *Market) uncrossOrderAtAuctionEnd(ctx context.Context) { } func (m *Market) EnterLongBlockAuction(ctx context.Context, duration int64) { + if !m.canTrade() { + return + } + m.mkt.State = types.MarketStateSuspended m.mkt.TradingMode = types.MarketTradingModelLongBlockAuction if m.as.InAuction() { diff --git a/core/execution/spot/market.go b/core/execution/spot/market.go index 911e6153e80..d44f2b922ab 100644 --- a/core/execution/spot/market.go +++ b/core/execution/spot/market.go @@ -488,6 +488,10 @@ func (m *Market) uncrossOrderAtAuctionEnd(ctx context.Context) { } func (m *Market) EnterLongBlockAuction(ctx context.Context, duration int64) { + if !m.canTrade() { + return + } + m.mkt.State = types.MarketStateSuspended m.mkt.TradingMode = types.MarketTradingModelLongBlockAuction if m.as.InAuction() {