adshao / go-binance

A Go SDK for Binance API
MIT License
1.48k stars 663 forks source link

Issue in NewExchangeInfoService().Symbols() #477

Closed sebastianmacias closed 2 weeks ago

sebastianmacias commented 1 year ago

This issues had already been reported and closed in #267. When I call NewExchangeInfoService().Symbols().Do(context.Background()) I'm getting the following error:

Binance-golang 2023/03/25 12:22:17 full url: https://api.binance.com/api/v3/exchangeInfo?symbols=%5B%5D, body:
Binance-golang 2023/03/25 12:22:17 request: &http.Request{Method:"GET", URL:(*url.URL)(0xc000118ab0), Proto:"HTTP/1.1", ProtoMajor:1, ProtoMinor:1, Header:http.Header{}, Body:http.noBody{}, GetBody:(func() (io.ReadCloser, error))(0x12e0720), ContentLength:0, TransferEncoding:[]string(nil), Close:false, Host:"api.binance.com", Form:url.Values(nil), PostForm:url.Values(nil), MultipartForm:(*multipart.Form)(nil), Trailer:http.Header(nil), RemoteAddr:"", RequestURI:"", TLS:(*tls.ConnectionState)(nil), Cancel:(<-chan struct {})(nil), Response:(*http.Response)(nil), ctx:(*context.emptyCtx)(0xc00002c080)}
Binance-golang 2023/03/25 12:22:17 response: &http.Response{Status:"400 Bad Request", StatusCode:400, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Cache-Control":[]string{"no-cache, no-store, must-revalidate"}, "Content-Length":[]string{"154"}, "Content-Security-Policy":[]string{"default-src 'self'"}, "Content-Type":[]string{"application/json;charset=UTF-8"}, "Date":[]string{"Sat, 25 Mar 2023 17:22:17 GMT"}, "Expires":[]string{"0"}, "Pragma":[]string{"no-cache"}, "Server":[]string{"nginx"}, "Strict-Transport-Security":[]string{"max-age=31536000; includeSubdomains"}, "Via":[]string{"1.1 2d421cb55f565ff4c38cbaaf0ba2f1a2.cloudfront.net (CloudFront)"}, "X-Amz-Cf-Id":[]string{"RL2irD2Z_mN_eOJf25k6DxGvtGF3vaSRuvjttYWcXTwovYROmUATiA=="}, "X-Amz-Cf-Pop":[]string{"BOG50-P1"}, "X-Cache":[]string{"Error from cloudfront"}, "X-Content-Security-Policy":[]string{"default-src 'self'"}, "X-Content-Type-Options":[]string{"nosniff"}, "X-Frame-Options":[]string{"SAMEORIGIN"}, "X-Mbx-Used-Weight":[]string{"10"}, "X-Mbx-Used-Weight-1m":[]string{"10"}, "X-Mbx-Uuid":[]string{"3bcd51d7-6d2c-4527-a0a5-1b5ba89e5e27"}, "X-Webkit-Csp":[]string{"default-src 'self'"}, "X-Xss-Protection":[]string{"1; mode=block"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc000188300)}, ContentLength:154, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00015ae00), TLS:(*tls.ConnectionState)(0xc0001e20b0)}
Binance-golang 2023/03/25 12:22:17 response body: {"code":-1100,"msg":"Illegal characters found in parameter 'symbols'; legal range is '^\\[(\"[A-Z0-9-_.]{1,20}\"(,\"[A-Z0-9-_.]{1,20}\"){0,}){0,1}\\]$'."}
Binance-golang 2023/03/25 12:22:17 response status code: 400
2023-03-25T12:22:17.868-0500    ERROR   binance/binance.go:36   <APIError> code=-1100, msg=Illegal characters found in parameter 'symbols'; legal range is '^\[("[A-Z0-9-_.]{1,20}"(,"[A-Z0-9-_.]{1,20}"){0,}){0,1}\]$'.
rickstaa commented 1 year ago

This issues had already been reported and closed in #267. When I call NewExchangeInfoService().Symbols().Do(context.Background()) I'm getting the following error:

Binance-golang 2023/03/25 12:22:17 full url: https://api.binance.com/api/v3/exchangeInfo?symbols=%5B%5D, body:
Binance-golang 2023/03/25 12:22:17 request: &http.Request{Method:"GET", URL:(*url.URL)(0xc000118ab0), Proto:"HTTP/1.1", ProtoMajor:1, ProtoMinor:1, Header:http.Header{}, Body:http.noBody{}, GetBody:(func() (io.ReadCloser, error))(0x12e0720), ContentLength:0, TransferEncoding:[]string(nil), Close:false, Host:"api.binance.com", Form:url.Values(nil), PostForm:url.Values(nil), MultipartForm:(*multipart.Form)(nil), Trailer:http.Header(nil), RemoteAddr:"", RequestURI:"", TLS:(*tls.ConnectionState)(nil), Cancel:(<-chan struct {})(nil), Response:(*http.Response)(nil), ctx:(*context.emptyCtx)(0xc00002c080)}
Binance-golang 2023/03/25 12:22:17 response: &http.Response{Status:"400 Bad Request", StatusCode:400, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Cache-Control":[]string{"no-cache, no-store, must-revalidate"}, "Content-Length":[]string{"154"}, "Content-Security-Policy":[]string{"default-src 'self'"}, "Content-Type":[]string{"application/json;charset=UTF-8"}, "Date":[]string{"Sat, 25 Mar 2023 17:22:17 GMT"}, "Expires":[]string{"0"}, "Pragma":[]string{"no-cache"}, "Server":[]string{"nginx"}, "Strict-Transport-Security":[]string{"max-age=31536000; includeSubdomains"}, "Via":[]string{"1.1 2d421cb55f565ff4c38cbaaf0ba2f1a2.cloudfront.net (CloudFront)"}, "X-Amz-Cf-Id":[]string{"RL2irD2Z_mN_eOJf25k6DxGvtGF3vaSRuvjttYWcXTwovYROmUATiA=="}, "X-Amz-Cf-Pop":[]string{"BOG50-P1"}, "X-Cache":[]string{"Error from cloudfront"}, "X-Content-Security-Policy":[]string{"default-src 'self'"}, "X-Content-Type-Options":[]string{"nosniff"}, "X-Frame-Options":[]string{"SAMEORIGIN"}, "X-Mbx-Used-Weight":[]string{"10"}, "X-Mbx-Used-Weight-1m":[]string{"10"}, "X-Mbx-Uuid":[]string{"3bcd51d7-6d2c-4527-a0a5-1b5ba89e5e27"}, "X-Webkit-Csp":[]string{"default-src 'self'"}, "X-Xss-Protection":[]string{"1; mode=block"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc000188300)}, ContentLength:154, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00015ae00), TLS:(*tls.ConnectionState)(0xc0001e20b0)}
Binance-golang 2023/03/25 12:22:17 response body: {"code":-1100,"msg":"Illegal characters found in parameter 'symbols'; legal range is '^\\[(\"[A-Z0-9-_.]{1,20}\"(,\"[A-Z0-9-_.]{1,20}\"){0,}){0,1}\\]$'."}
Binance-golang 2023/03/25 12:22:17 response status code: 400
2023-03-25T12:22:17.868-0500  ERROR   binance/binance.go:36   <APIError> code=-1100, msg=Illegal characters found in parameter 'symbols'; legal range is '^\[("[A-Z0-9-_.]{1,20}"(,"[A-Z0-9-_.]{1,20}"){0,}){0,1}\]$'.

The following seems to work for me 🤔:

     exchangeInfoService := binanceClient.NewExchangeInfoService()
    exchangeInfo, err := exchangeInfoService.Do(context.Background())
    exchangeSymbols := exchangeInfo.Symbols
xyq-c-cpp commented 2 weeks ago

No response for a long time, close this issue