mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
xfunding: fix balance check
This commit is contained in:
parent
017278826b
commit
a766d88d60
|
@ -866,11 +866,13 @@ func (s *Strategy) syncSpotPosition(ctx context.Context) {
|
|||
orderPrice := ticker.Sell
|
||||
orderQuantity := diffQuantity
|
||||
b, ok := s.spotSession.Account.Balance(s.spotMarket.BaseCurrency)
|
||||
|
||||
if ok {
|
||||
orderQuantity = fixedpoint.Min(b.Available, orderQuantity)
|
||||
if !ok {
|
||||
log.Warnf("%s balance not found, can not sync spot position", s.spotMarket.BaseCurrency)
|
||||
return
|
||||
}
|
||||
|
||||
orderQuantity = fixedpoint.Min(b.Available, orderQuantity)
|
||||
|
||||
// avoid increase the order size
|
||||
if s.spotMarket.IsDustQuantity(orderQuantity, orderPrice) {
|
||||
log.Infof("skip spot order with dust quantity %s, market=%+v balance=%+v", orderQuantity.String(), s.spotMarket, b)
|
||||
|
|
Loading…
Reference in New Issue
Block a user