mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
etf: use break instead of return
This commit is contained in:
parent
291a2edbaa
commit
99f97df43b
|
@ -65,7 +65,9 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
|
|
||||||
ticker, err := session.Exchange.QueryTicker(ctx, symbol)
|
ticker, err := session.Exchange.QueryTicker(ctx, symbol)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
s.Notifiability.Notify("query ticker error: %s", err.Error())
|
||||||
log.WithError(err).Error("query ticker error")
|
log.WithError(err).Error("query ticker error")
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
askPrice := fixedpoint.NewFromFloat(ticker.Sell)
|
askPrice := fixedpoint.NewFromFloat(ticker.Sell)
|
||||||
|
@ -74,11 +76,11 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
// execute orders
|
// execute orders
|
||||||
quoteBalance, ok := session.Account.Balance(s.Market.QuoteCurrency)
|
quoteBalance, ok := session.Account.Balance(s.Market.QuoteCurrency)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
break
|
||||||
}
|
}
|
||||||
if quoteBalance.Available < amount {
|
if quoteBalance.Available < amount {
|
||||||
s.Notifiability.Notify("Quote balance %s is not enough: %f < %f", s.Market.QuoteCurrency, quoteBalance.Available.Float64(), amount.Float64())
|
s.Notifiability.Notify("Quote balance %s is not enough: %f < %f", s.Market.QuoteCurrency, quoteBalance.Available.Float64(), amount.Float64())
|
||||||
return
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
s.Notifiability.Notify("Submitting etf order %s quantity %f at price %f (index ratio %f %%)",
|
s.Notifiability.Notify("Submitting etf order %s quantity %f at price %f (index ratio %f %%)",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user