mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
risk: return quantity directly if it's not zero
This commit is contained in:
parent
578e4b2801
commit
076f196621
|
@ -164,6 +164,7 @@ func CalculateBaseQuantity(session *bbgo.ExchangeSession, market types.Market, p
|
|||
leverage = fixedpoint.NewFromInt(3)
|
||||
}
|
||||
|
||||
|
||||
baseBalance, _ := session.Account.Balance(market.BaseCurrency)
|
||||
quoteBalance, _ := session.Account.Balance(market.QuoteCurrency)
|
||||
|
||||
|
@ -185,11 +186,11 @@ func CalculateBaseQuantity(session *bbgo.ExchangeSession, market types.Market, p
|
|||
return quantity, fmt.Errorf("quantity is zero, can not submit sell order, please check your quantity settings")
|
||||
}
|
||||
|
||||
// using leverage -- starts from here
|
||||
if !quantity.IsZero() {
|
||||
return quantity, nil
|
||||
}
|
||||
|
||||
// using leverage -- starts from here
|
||||
logrus.Infof("calculating available leveraged base quantity: base balance = %+v, quote balance = %+v", baseBalance, quoteBalance)
|
||||
|
||||
// calculate the quantity automatically
|
||||
|
|
Loading…
Reference in New Issue
Block a user