mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
add ftx, okex to the public exchange factory for backtest
This commit is contained in:
parent
914b170204
commit
2223ef088c
|
@ -33,6 +33,8 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/c9s/bbgo/pkg/exchange/ftx"
|
||||||
|
"github.com/c9s/bbgo/pkg/exchange/okex"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/c9s/bbgo/pkg/bbgo"
|
"github.com/c9s/bbgo/pkg/bbgo"
|
||||||
|
@ -313,6 +315,10 @@ func newPublicExchange(sourceExchange types.ExchangeName) (types.Exchange, error
|
||||||
return binance.New("", ""), nil
|
return binance.New("", ""), nil
|
||||||
case types.ExchangeMax:
|
case types.ExchangeMax:
|
||||||
return max.New("", ""), nil
|
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)
|
return nil, fmt.Errorf("exchange %s is not supported", sourceExchange)
|
||||||
|
|
|
@ -28,7 +28,10 @@ type Exchange struct {
|
||||||
|
|
||||||
func New(key, secret, passphrase string) *Exchange {
|
func New(key, secret, passphrase string) *Exchange {
|
||||||
client := okexapi.NewClient()
|
client := okexapi.NewClient()
|
||||||
client.Auth(key, secret, passphrase)
|
|
||||||
|
if len(key) > 0 && len(secret) > 0 {
|
||||||
|
client.Auth(key, secret, passphrase)
|
||||||
|
}
|
||||||
|
|
||||||
return &Exchange{
|
return &Exchange{
|
||||||
key: key,
|
key: key,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user