mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45: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
|
orderPrice := ticker.Sell
|
||||||
orderQuantity := diffQuantity
|
orderQuantity := diffQuantity
|
||||||
b, ok := s.spotSession.Account.Balance(s.spotMarket.BaseCurrency)
|
b, ok := s.spotSession.Account.Balance(s.spotMarket.BaseCurrency)
|
||||||
|
if !ok {
|
||||||
if ok {
|
log.Warnf("%s balance not found, can not sync spot position", s.spotMarket.BaseCurrency)
|
||||||
orderQuantity = fixedpoint.Min(b.Available, orderQuantity)
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
orderQuantity = fixedpoint.Min(b.Available, orderQuantity)
|
||||||
|
|
||||||
// avoid increase the order size
|
// avoid increase the order size
|
||||||
if s.spotMarket.IsDustQuantity(orderQuantity, orderPrice) {
|
if s.spotMarket.IsDustQuantity(orderQuantity, orderPrice) {
|
||||||
log.Infof("skip spot order with dust quantity %s, market=%+v balance=%+v", orderQuantity.String(), s.spotMarket, b)
|
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