override binance default http client timeout instead of zero timeout

This commit is contained in:
c9s 2021-11-23 10:54:31 +08:00
parent 513a799ced
commit 4bde40f2db

View File

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/adshao/go-binance/v2/futures"
"golang.org/x/time/rate"
"net/http"
"os"
"strconv"
"strings"
@ -50,6 +51,8 @@ type Exchange struct {
func New(key, secret string) *Exchange {
var client = binance.NewClient(key, secret)
client.HTTPClient = &http.Client{Timeout: 15 * time.Second}
_, _ = client.NewSetServerTimeService().Do(context.Background())
return &Exchange{
key: key,