xmaker: fix order submission

This commit is contained in:
c9s 2021-05-17 21:33:55 +08:00
parent f6f1226bd0
commit 1c19c02206

View File

@ -19,7 +19,7 @@ import (
"github.com/c9s/bbgo/pkg/types"
)
var defaultMargin = fixedpoint.NewFromFloat(0.01)
var defaultMargin = fixedpoint.NewFromFloat(0.003)
var localTimeZone *time.Location
@ -130,6 +130,12 @@ func (s *Strategy) CrossSubscribe(sessions map[string]*bbgo.ExchangeSession) {
sourceSession.Subscribe(types.BookChannel, s.Symbol, types.SubscribeOptions{})
sourceSession.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: "1m"})
makerSession, ok := sessions[s.MakerExchange]
if !ok {
panic(fmt.Errorf("maker session %s is not defined", s.MakerExchange))
}
makerSession.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: "1m"})
}
func aggregatePrice(pvs types.PriceVolumeSlice, requiredQuantity fixedpoint.Value) (price fixedpoint.Value) {
@ -255,7 +261,7 @@ func (s *Strategy) updateQuote(ctx context.Context, orderExecutionRouter bbgo.Or
}
if disableMakerAsk && disableMakerBid {
log.Warn("bid/ask maker is disabled due to insufficient balances")
log.Warnf("%s bid/ask maker is disabled due to insufficient balances", s.Symbol)
return
}
@ -403,6 +409,7 @@ func (s *Strategy) updateQuote(ctx context.Context, orderExecutionRouter bbgo.Or
}
if len(submitOrders) == 0 {
log.Warnf("no orders generated")
return
}