add ftx, okex to the public exchange factory for backtest

This commit is contained in:
c9s 2021-12-08 23:27:01 +08:00
parent 914b170204
commit 2223ef088c
2 changed files with 10 additions and 1 deletions

View File

@ -33,6 +33,8 @@ import (
"sync"
"time"
"github.com/c9s/bbgo/pkg/exchange/ftx"
"github.com/c9s/bbgo/pkg/exchange/okex"
"github.com/pkg/errors"
"github.com/c9s/bbgo/pkg/bbgo"
@ -313,6 +315,10 @@ func newPublicExchange(sourceExchange types.ExchangeName) (types.Exchange, error
return binance.New("", ""), nil
case types.ExchangeMax:
return max.New("", ""), nil
case types.ExchangeFTX:
return ftx.NewExchange("", "", ""), nil
case types.ExchangeOKEx:
return okex.New("", "", ""), nil
}
return nil, fmt.Errorf("exchange %s is not supported", sourceExchange)

View File

@ -28,7 +28,10 @@ type Exchange struct {
func New(key, secret, passphrase string) *Exchange {
client := okexapi.NewClient()
client.Auth(key, secret, passphrase)
if len(key) > 0 && len(secret) > 0 {
client.Auth(key, secret, passphrase)
}
return &Exchange{
key: key,