mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-13 02:23:51 +00:00
36 lines
678 B
Go
36 lines
678 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"syscall"
|
|
"time"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"github.com/c9s/bbgo/pkg/cmd/cmdutil"
|
|
"github.com/c9s/bbgo/pkg/exchange/binance"
|
|
)
|
|
|
|
func main() {
|
|
log.SetLevel(log.DebugLevel)
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
// gobinance.NewClient(os.Getenv("BINANCE_API_KEY"), os.Getenv("BINANCE_API_SECRET"))
|
|
|
|
ex := binance.New(os.Getenv("BINANCE_API_KEY"), os.Getenv("BINANCE_API_SECRET"))
|
|
ex.UseMargin(true)
|
|
stream := ex.NewStream()
|
|
|
|
if err := stream.Connect(ctx); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
cmdutil.WaitForSignal(ctx, syscall.SIGINT, syscall.SIGTERM)
|
|
cancel()
|
|
time.Sleep(5 * time.Second)
|
|
|
|
return
|
|
}
|