xmaker: remove book copy

This commit is contained in:
c9s 2024-10-22 11:45:13 +08:00
parent 5878fd8aed
commit 3ba5cbe262
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1213,16 +1213,13 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) {
}
lastPrice := s.lastPrice.Get()
sourceBook := s.sourceBook.CopyDepth(1)
switch side {
case types.SideTypeBuy:
if bestAsk, ok := sourceBook.BestAsk(); ok {
bestBid, bestAsk, ok := s.sourceBook.BestBidAndAsk()
if ok {
switch side {
case types.SideTypeBuy:
lastPrice = bestAsk.Price
}
case types.SideTypeSell:
if bestBid, ok := sourceBook.BestBid(); ok {
case types.SideTypeSell:
lastPrice = bestBid.Price
}
}