diff --git a/README.md b/README.md index a6d21126..6c8e87dd 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,12 @@ Name | Description | Status [web-socket-streams.md](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md) | Details on available streams and payloads | Implemented [user-data-stream.md](https://github.com/binance/binance-spot-api-docs/blob/master/user-data-stream.md) | Details on the dedicated account stream | Implemented [margin-api.md](https://binance-docs.github.io/apidocs/spot/en) | Details on the Margin API (/sapi) | Implemented -[futures-api.md](https://binance-docs.github.io/apidocs/futures/en/#general-info) | Details on the Futures API (/fapi) | Partially Implemented -[delivery-api.md](https://binance-docs.github.io/apidocs/delivery/en/#general-info) | Details on the Coin-M Futures API (/dapi) | Partially Implemented +[futures-api.md](https://binance-docs.github.io/apidocs/futures/en/#general-info) | Details on the Futures API (/fapi) | Implemented +[delivery-api.md](https://binance-docs.github.io/apidocs/delivery/en/#general-info) | Details on the Coin-M Futures API (/dapi) | Implemented +[eoptions-api.md](https://binance-docs.github.io/apidocs/voptions/en/#general-info) | Detains on the European Options API(/eapi) | Implemented + + +Found an unimplemented interface, please submit a issue. ### Installation @@ -40,7 +44,12 @@ go get github.com/adshao/go-binance/v1 ```golang import ( + // for spot and other interface contained in https://binance-docs.github.io/apidocs/spot/en/#change-log "github.com/adshao/go-binance/v2" + + "github.com/adshao/go-binance/v2/futures" // optional package + "github.com/adshao/go-binance/v2/delivery" // optional package + "github.com/adshao/go-binance/v2/eoptions" // optional package ) ``` @@ -72,6 +81,14 @@ Following are some simple examples, please refer to [godoc](https://godoc.org/gi If you have any questions, please refer to the specific version of the code for specific reference definitions or usage methods +##### Proxy Client + +``` +proxyUrl := "http://127.0.0.1:7890" // for example, please replace as your exact proxy url. +client := binance.NewProxiedClient(apiKey, apiSecret, proxyUrl) +``` + + #### Create Order ```golang @@ -219,8 +236,10 @@ fmt.Println(res) You don't need Client in websocket API. Just call binance.WsXxxServe(args, handler, errHandler). -> For delivery API you can use `delivery.WsXxxServe(args, handler, errHandler)`. +> For delivery API you can use `delivery.WsXxxServe(args, handler, errHandler)`. +If you wanna use proxy, you can set `HTTP_PROXY` or `HTTP_PROXY` in environment variable. + #### Depth ```golang diff --git a/v2/client.go b/v2/client.go index 57848d34..01d6b19f 100644 --- a/v2/client.go +++ b/v2/client.go @@ -19,8 +19,8 @@ import ( "github.com/adshao/go-binance/v2/common" "github.com/adshao/go-binance/v2/delivery" + "github.com/adshao/go-binance/v2/eoptions" "github.com/adshao/go-binance/v2/futures" - "github.com/adshao/go-binance/v2/options" ) // SideType define side type of order @@ -362,9 +362,9 @@ func NewDeliveryClient(apiKey, secretKey string) *delivery.Client { return delivery.NewClient(apiKey, secretKey) } -// NewOptionsClient initialize client for options API -func NewOptionsClient(apiKey, secretKey string) *options.Client { - return options.NewClient(apiKey, secretKey) +// NewOptionsClient initialize client for eoptions API +func NewOptionsClient(apiKey, secretKey string) *eoptions.Client { + return eoptions.NewClient(apiKey, secretKey) } type doFunc func(req *http.Request) (*http.Response, error) diff --git a/v2/options/account_service.go b/v2/eoptions/account_service.go similarity index 98% rename from v2/options/account_service.go rename to v2/eoptions/account_service.go index 4797754e..6dcdec88 100644 --- a/v2/options/account_service.go +++ b/v2/eoptions/account_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/account_service_test.go b/v2/eoptions/account_service_test.go similarity index 99% rename from v2/options/account_service_test.go rename to v2/eoptions/account_service_test.go index 8efc473e..fe215d96 100644 --- a/v2/options/account_service_test.go +++ b/v2/eoptions/account_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/client.go b/v2/eoptions/client.go similarity index 99% rename from v2/options/client.go rename to v2/eoptions/client.go index f7e1dc77..a8b868ab 100644 --- a/v2/options/client.go +++ b/v2/eoptions/client.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "bytes" diff --git a/v2/options/client_test.go b/v2/eoptions/client_test.go similarity index 99% rename from v2/options/client_test.go rename to v2/eoptions/client_test.go index f9711cfc..77e13892 100644 --- a/v2/options/client_test.go +++ b/v2/eoptions/client_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "bytes" diff --git a/v2/options/depth_service.go b/v2/eoptions/depth_service.go similarity index 99% rename from v2/options/depth_service.go rename to v2/eoptions/depth_service.go index f515cc13..45c770c8 100644 --- a/v2/options/depth_service.go +++ b/v2/eoptions/depth_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/depth_service_test.go b/v2/eoptions/depth_service_test.go similarity index 99% rename from v2/options/depth_service_test.go rename to v2/eoptions/depth_service_test.go index 995557a7..2ec2e735 100644 --- a/v2/options/depth_service_test.go +++ b/v2/eoptions/depth_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/exchange_info_service.go b/v2/eoptions/exchange_info_service.go similarity index 99% rename from v2/options/exchange_info_service.go rename to v2/eoptions/exchange_info_service.go index 43832989..82ea0c28 100644 --- a/v2/options/exchange_info_service.go +++ b/v2/eoptions/exchange_info_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/exchange_info_service_test.go b/v2/eoptions/exchange_info_service_test.go similarity index 99% rename from v2/options/exchange_info_service_test.go rename to v2/eoptions/exchange_info_service_test.go index ab86bbf0..e18070ab 100644 --- a/v2/options/exchange_info_service_test.go +++ b/v2/eoptions/exchange_info_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/exercise_history_service.go b/v2/eoptions/exercise_history_service.go similarity index 99% rename from v2/options/exercise_history_service.go rename to v2/eoptions/exercise_history_service.go index 7943227c..cdb15c22 100644 --- a/v2/options/exercise_history_service.go +++ b/v2/eoptions/exercise_history_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/exercise_history_service_test.go b/v2/eoptions/exercise_history_service_test.go similarity index 98% rename from v2/options/exercise_history_service_test.go rename to v2/eoptions/exercise_history_service_test.go index 4d609be5..d224b5be 100644 --- a/v2/options/exercise_history_service_test.go +++ b/v2/eoptions/exercise_history_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/index_service.go b/v2/eoptions/index_service.go similarity index 98% rename from v2/options/index_service.go rename to v2/eoptions/index_service.go index d11c7ce1..e6ed5275 100644 --- a/v2/options/index_service.go +++ b/v2/eoptions/index_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/index_service_test.go b/v2/eoptions/index_service_test.go similarity index 97% rename from v2/options/index_service_test.go rename to v2/eoptions/index_service_test.go index eff3c05f..7ebc4abb 100644 --- a/v2/options/index_service_test.go +++ b/v2/eoptions/index_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/kline_service.go b/v2/eoptions/kline_service.go similarity index 99% rename from v2/options/kline_service.go rename to v2/eoptions/kline_service.go index 8e0550e7..666661c3 100644 --- a/v2/options/kline_service.go +++ b/v2/eoptions/kline_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/kline_service_test.go b/v2/eoptions/kline_service_test.go similarity index 99% rename from v2/options/kline_service_test.go rename to v2/eoptions/kline_service_test.go index c8977e4d..d4eb5ca3 100644 --- a/v2/options/kline_service_test.go +++ b/v2/eoptions/kline_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/mark_service.go b/v2/eoptions/mark_service.go similarity index 98% rename from v2/options/mark_service.go rename to v2/eoptions/mark_service.go index eab656fd..26d0a400 100644 --- a/v2/options/mark_service.go +++ b/v2/eoptions/mark_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/mark_service_test.go b/v2/eoptions/mark_service_test.go similarity index 99% rename from v2/options/mark_service_test.go rename to v2/eoptions/mark_service_test.go index 66da6052..899f260d 100644 --- a/v2/options/mark_service_test.go +++ b/v2/eoptions/mark_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/open_interest_service.go b/v2/eoptions/open_interest_service.go similarity index 98% rename from v2/options/open_interest_service.go rename to v2/eoptions/open_interest_service.go index f75930fb..92545a4b 100644 --- a/v2/options/open_interest_service.go +++ b/v2/eoptions/open_interest_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/open_interest_service_test.go b/v2/eoptions/open_interest_service_test.go similarity index 98% rename from v2/options/open_interest_service_test.go rename to v2/eoptions/open_interest_service_test.go index 03767dfc..618dba3c 100644 --- a/v2/options/open_interest_service_test.go +++ b/v2/eoptions/open_interest_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/order_service.go b/v2/eoptions/order_service.go similarity index 99% rename from v2/options/order_service.go rename to v2/eoptions/order_service.go index eab0009f..8421609a 100644 --- a/v2/options/order_service.go +++ b/v2/eoptions/order_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/order_service_test.go b/v2/eoptions/order_service_test.go similarity index 99% rename from v2/options/order_service_test.go rename to v2/eoptions/order_service_test.go index d67b3467..c0e2e042 100644 --- a/v2/options/order_service_test.go +++ b/v2/eoptions/order_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "encoding/json" diff --git a/v2/options/request.go b/v2/eoptions/request.go similarity index 99% rename from v2/options/request.go rename to v2/eoptions/request.go index c9e96eef..9c2f4d15 100644 --- a/v2/options/request.go +++ b/v2/eoptions/request.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "fmt" diff --git a/v2/options/server_service.go b/v2/eoptions/server_service.go similarity index 98% rename from v2/options/server_service.go rename to v2/eoptions/server_service.go index b279ba04..70a57605 100644 --- a/v2/options/server_service.go +++ b/v2/eoptions/server_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/server_service_test.go b/v2/eoptions/server_service_test.go similarity index 97% rename from v2/options/server_service_test.go rename to v2/eoptions/server_service_test.go index f0bb90c1..bc0faf84 100644 --- a/v2/options/server_service_test.go +++ b/v2/eoptions/server_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/ticker_service.go b/v2/eoptions/ticker_service.go similarity index 98% rename from v2/options/ticker_service.go rename to v2/eoptions/ticker_service.go index 1ae67a05..5e98df3a 100644 --- a/v2/options/ticker_service.go +++ b/v2/eoptions/ticker_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/ticker_service_test.go b/v2/eoptions/ticker_service_test.go similarity index 99% rename from v2/options/ticker_service_test.go rename to v2/eoptions/ticker_service_test.go index 69b415cc..e05fa462 100644 --- a/v2/options/ticker_service_test.go +++ b/v2/eoptions/ticker_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/trade_service_test.go b/v2/eoptions/trade_service_test.go similarity index 99% rename from v2/options/trade_service_test.go rename to v2/eoptions/trade_service_test.go index f9ba2401..5bf81d3f 100644 --- a/v2/options/trade_service_test.go +++ b/v2/eoptions/trade_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/trades_service.go b/v2/eoptions/trades_service.go similarity index 99% rename from v2/options/trades_service.go rename to v2/eoptions/trades_service.go index 59b219c6..07b2192a 100644 --- a/v2/options/trades_service.go +++ b/v2/eoptions/trades_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/user_stream_service.go b/v2/eoptions/user_stream_service.go similarity index 99% rename from v2/options/user_stream_service.go rename to v2/eoptions/user_stream_service.go index 128848c0..90ead4e7 100644 --- a/v2/options/user_stream_service.go +++ b/v2/eoptions/user_stream_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "context" diff --git a/v2/options/user_stream_service_test.go b/v2/eoptions/user_stream_service_test.go similarity index 97% rename from v2/options/user_stream_service_test.go rename to v2/eoptions/user_stream_service_test.go index 6e1a39f6..1d1d44d4 100644 --- a/v2/options/user_stream_service_test.go +++ b/v2/eoptions/user_stream_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "testing" diff --git a/v2/options/websocket.go b/v2/eoptions/websocket.go similarity index 99% rename from v2/options/websocket.go rename to v2/eoptions/websocket.go index 00c1abf1..3bb3237b 100644 --- a/v2/options/websocket.go +++ b/v2/eoptions/websocket.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "net/http" diff --git a/v2/options/websocket_service.go b/v2/eoptions/websocket_service.go similarity index 99% rename from v2/options/websocket_service.go rename to v2/eoptions/websocket_service.go index fb562408..4370befd 100644 --- a/v2/options/websocket_service.go +++ b/v2/eoptions/websocket_service.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "encoding/json" diff --git a/v2/options/websocket_service_test.go b/v2/eoptions/websocket_service_test.go similarity index 99% rename from v2/options/websocket_service_test.go rename to v2/eoptions/websocket_service_test.go index 49109001..0b2ff78e 100644 --- a/v2/options/websocket_service_test.go +++ b/v2/eoptions/websocket_service_test.go @@ -1,4 +1,4 @@ -package options +package eoptions import ( "errors"