check dust quantity by taker price

This commit is contained in:
narumi 2024-02-06 17:21:26 +08:00
parent 541d19d826
commit 502685f5d8

View File

@ -119,20 +119,17 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
position := s.Strategy.OrderExecutor.Position()
log.Infof("position: %+v", position)
if !position.IsDust() {
side := types.SideTypeBuy
takerPrice := ticker.Sell
if position.IsLong() {
side = types.SideTypeSell
takerPrice = ticker.Buy
}
if !position.IsDust(takerPrice) {
log.Infof("%s position is not dust", s.Symbol)
side := types.SideTypeSell
takerPrice := fixedpoint.Zero
if position.IsShort() {
side = types.SideTypeBuy
takerPrice = ticker.Sell
} else if position.IsLong() {
side = types.SideTypeSell
takerPrice = ticker.Buy
}
orderForms = append(orderForms, types.SubmitOrder{
Symbol: s.Symbol,
Type: types.OrderTypeLimit,