New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Order Rate Limit #320
Order Rate Limit #320
Conversation
Codecov Report
@@ Coverage Diff @@
## master #320 +/- ##
==========================================
- Coverage 74.51% 74.48% -0.04%
==========================================
Files 58 58
Lines 5482 5487 +5
==========================================
+ Hits 4085 4087 +2
- Misses 1024 1025 +1
- Partials 373 375 +2
Continue to review full report at Codecov.
|
v2/futures/client.go
Outdated
@@ -333,6 +337,20 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption) | |||
} | |||
return nil, apiErr | |||
} | |||
|
|||
err = json.Unmarshal(data, &t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all the API response are map, for example, maybe array, so it will fail here.
It's not a good idea to mix response headers with response body, maybe we need a dedicated return value for headers:
func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption) (data []byte, headers Headers, err error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And there will be performance issue to Unmarshal
& Marshal
to add headers for every API call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok let me change the codes adding a return. In that case we've to modify all the others functions but it's more clean
Hi adshao, did you have the chance to check the changes? |
Yes, I'm reviewing this pr, sorry for the late reply. |
It's a first tentative version to manage rate limit info from Binance. In this version I've extended the Order Response structure including 10s and 1m order trade limit from header response.