xmaker: fix price initialization

This commit is contained in:
c9s 2024-09-16 00:29:08 +08:00
parent 80430fec46
commit 26b1fd2ae7
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -480,8 +480,13 @@ func (s *Strategy) getLayerPrice(
}
}
sideBook := sourceBook.SideBook(side)
if pv, ok := sideBook.First(); ok {
price = pv.Price
}
if requiredDepth.Sign() > 0 {
price = aggregatePrice(sourceBook.SideBook(side), requiredDepth)
price = aggregatePrice(sideBook, requiredDepth)
price = price.Mul(fixedpoint.One.Add(delta))
if i > 0 {
price = price.Add(pips.Mul(s.makerMarket.TickSize))