Skip to content

Commit

Permalink
fix: remove duplicate mid-price func
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Van Ootegem <[email protected]>
  • Loading branch information
EVODelavega committed Apr 18, 2024
1 parent cf3a644 commit 0b5c5d9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
2 changes: 1 addition & 1 deletion core/execution/future/liquidation.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (m *Market) checkNetwork(ctx context.Context, now time.Time) error {
return nil
}
// this only returns an error if we couldn't get the price range, incidating no orders on book
order, _ := m.liquidation.OnTick(ctx, now, m.getMarketMidPrice())
order, _ := m.liquidation.OnTick(ctx, now, m.midPrice())
if order == nil {
return nil
}
Expand Down
15 changes: 0 additions & 15 deletions core/execution/future/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,21 +709,6 @@ func (m *Market) midPrice() *num.Uint {
return midPrice
}

func (m *Market) getMarketMidPrice() *num.Uint {
mp := num.UintZero()
if m.as.InAuction() {
return mp
}
bb, _, _ := m.matching.BestBidPriceAndVolume()
if bb.IsZero() {
return mp
}
if bo, _, _ := m.matching.BestOfferPriceAndVolume(); !bo.IsZero() {
return mp.Div(num.Sum(bb, bo), num.NewUint(2))
}
return mp
}

func (m *Market) GetMarketData() types.MarketData {
bestBidPrice, bestBidVolume, _ := m.matching.BestBidPriceAndVolume()
bestOfferPrice, bestOfferVolume, _ := m.matching.BestOfferPriceAndVolume()
Expand Down

0 comments on commit 0b5c5d9

Please sign in to comment.