xdepthmaker: clean up duplicated code

This commit is contained in:
c9s 2023-11-28 16:15:35 +08:00
parent 6b28910139
commit e0686d11c8
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -302,31 +302,12 @@ func (s *Strategy) CrossRun(
}
}
if s.makerSession.MakerFeeRate.Sign() > 0 || s.makerSession.TakerFeeRate.Sign() > 0 {
s.Position.SetExchangeFeeRate(types.ExchangeName(s.MakerExchange), types.ExchangeFee{
MakerFeeRate: s.makerSession.MakerFeeRate,
TakerFeeRate: s.makerSession.TakerFeeRate,
})
}
if s.hedgeSession.MakerFeeRate.Sign() > 0 || s.hedgeSession.TakerFeeRate.Sign() > 0 {
s.Position.SetExchangeFeeRate(types.ExchangeName(s.HedgeExchange), types.ExchangeFee{
MakerFeeRate: s.hedgeSession.MakerFeeRate,
TakerFeeRate: s.hedgeSession.TakerFeeRate,
})
}
s.pricingBook = types.NewStreamBook(s.Symbol)
s.pricingBook.BindStream(s.hedgeSession.MarketDataStream)
s.activeMakerOrders = bbgo.NewActiveOrderBook(s.Symbol)
s.activeMakerOrders.BindStream(s.makerSession.UserDataStream)
s.orderStore = core.NewOrderStore(s.Symbol)
s.orderStore.BindStream(s.hedgeSession.UserDataStream)
s.orderStore.BindStream(s.makerSession.UserDataStream)
s.tradeCollector = core.NewTradeCollector(s.Symbol, s.Position, s.orderStore)
if s.NotifyTrade {
s.tradeCollector.OnTrade(notifyTrade)
}