From 49ed4b2929a44ba7f5bc643222f0e5e21cb45126 Mon Sep 17 00:00:00 2001 From: zhengtao Date: Sun, 19 Jun 2022 18:20:40 +0800 Subject: [PATCH] add some feture --- v2/futures/client.go | 1 + v2/futures/websocket.go | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/v2/futures/client.go b/v2/futures/client.go index 6236930..56c83f5 100644 --- a/v2/futures/client.go +++ b/v2/futures/client.go @@ -92,6 +92,7 @@ const ( OrderTypeTakeProfit OrderType = "TAKE_PROFIT" OrderTypeTakeProfitMarket OrderType = "TAKE_PROFIT_MARKET" OrderTypeTrailingStopMarket OrderType = "TRAILING_STOP_MARKET" + OrderTypeOnlyMaker OrderType = "LIMIT_MAKER" TimeInForceTypeGTC TimeInForceType = "GTC" // Good Till Cancel TimeInForceTypeIOC TimeInForceType = "IOC" // Immediate or Cancel diff --git a/v2/futures/websocket.go b/v2/futures/websocket.go index 483f3b4..7d39a6f 100644 --- a/v2/futures/websocket.go +++ b/v2/futures/websocket.go @@ -1,6 +1,9 @@ package futures import ( + "fmt" + "net/http" + "net/url" "time" "github.com/gorilla/websocket" @@ -24,7 +27,12 @@ func newWsConfig(endpoint string) *WsConfig { } var wsServe = func(cfg *WsConfig, handler WsHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error) { - c, _, err := websocket.DefaultDialer.Dial(cfg.Endpoint, nil) + proxyURL, _ := url.Parse("http://127.0.0.1:11000") + dialer := websocket.Dialer{ + Proxy: http.ProxyURL(proxyURL), + } + fmt.Println("add proxy") + c, _, err := dialer.Dial(cfg.Endpoint, nil) if err != nil { return nil, nil, err }