mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
adjust max query limiter and sync before running trader
This commit is contained in:
parent
e93b5a1868
commit
21a4669905
|
@ -108,6 +108,10 @@ func runConfig(basectx context.Context, userConfig *bbgo.Config, enableApiServer
|
|||
return err
|
||||
}
|
||||
|
||||
if err := environ.Sync(ctx) ; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
trader := bbgo.NewTrader(environ)
|
||||
if err := trader.Configure(userConfig); err != nil {
|
||||
return err
|
||||
|
|
|
@ -19,9 +19,9 @@ import (
|
|||
"github.com/c9s/bbgo/pkg/util"
|
||||
)
|
||||
|
||||
var closedOrderQueryLimiter = rate.NewLimiter(rate.Every(10*time.Second), 1)
|
||||
var tradeQuerylimiter = rate.NewLimiter(rate.Every(5*time.Second), 1)
|
||||
var accountQuerylimiter = rate.NewLimiter(rate.Every(5*time.Second), 1)
|
||||
var closedOrderQueryLimiter = rate.NewLimiter(rate.Every(6*time.Second), 1)
|
||||
var tradeQueryLimiter = rate.NewLimiter(rate.Every(4*time.Second), 1)
|
||||
var accountQueryLimiter = rate.NewLimiter(rate.Every(5*time.Second), 1)
|
||||
var marketDataLimiter = rate.NewLimiter(rate.Every(5*time.Second), 1)
|
||||
|
||||
var log = logrus.WithField("exchange", "max")
|
||||
|
@ -376,7 +376,7 @@ func (e *Exchange) PlatformFeeCurrency() string {
|
|||
}
|
||||
|
||||
func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) {
|
||||
if err := accountQuerylimiter.Wait(ctx) ; err != nil {
|
||||
if err := accountQueryLimiter.Wait(ctx) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ func (e *Exchange) QueryDepositHistory(ctx context.Context, asset string, since,
|
|||
}
|
||||
|
||||
func (e *Exchange) QueryAccountBalances(ctx context.Context) (types.BalanceMap, error) {
|
||||
if err := accountQuerylimiter.Wait(ctx) ; err != nil {
|
||||
if err := accountQueryLimiter.Wait(ctx) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ func (e *Exchange) QueryAccountBalances(ctx context.Context) (types.BalanceMap,
|
|||
}
|
||||
|
||||
func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *types.TradeQueryOptions) (trades []types.Trade, err error) {
|
||||
if err := tradeQuerylimiter.Wait(ctx) ; err != nil {
|
||||
if err := tradeQueryLimiter.Wait(ctx) ; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ func (s *Strategy) generateGridBuyOrders(session *bbgo.ExchangeSession) ([]types
|
|||
}
|
||||
|
||||
if currentPrice > upBand || currentPrice < downBand {
|
||||
return nil, fmt.Errorf("current price exceed the bollinger band")
|
||||
return nil, fmt.Errorf("current price %f exceed the bollinger band %f <> %f", currentPrice, upBand, downBand)
|
||||
}
|
||||
|
||||
ema99 := s.StandardIndicatorSet.EWMA(types.IntervalWindow{Interval: s.Interval, Window: 99})
|
||||
|
|
Loading…
Reference in New Issue
Block a user