exchange/binance/binance.go

29 lines
699 B
Go
Raw Permalink Normal View History

2024-06-25 16:59:56 +00:00
package binance
import (
"fmt"
"git.qtrade.icu/coin-quant/exchange"
"git.qtrade.icu/coin-quant/exchange/binance/common"
mfutures "git.qtrade.icu/coin-quant/exchange/binance/features"
)
func init() {
exchange.RegisterExchange("binance", NewBinance)
}
func NewBinance(cfg exchange.Config, cltName string) (e exchange.Exchange, err error) {
var eCfg common.BinanceConfig
err = cfg.UnmarshalKey(fmt.Sprintf("exchanges.%s", cltName), &eCfg)
if err != nil {
return
}
clientProxy := cfg.GetString("proxy")
switch eCfg.Kind {
case "futures":
e, err = mfutures.NewBinanceTrader(eCfg, cltName, clientProxy)
default:
err = fmt.Errorf("binance unsupport kind %s", &eCfg.Kind)
}
return
}