Skip to content
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

Verify all possible parameters are sent in POST body, keeping querystring usage minimal #12

Closed
tiagosiebler opened this issue Sep 12, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@tiagosiebler
Copy link
Owner

Pretty sure order ID etc shouldn't be in query string, but instead as post body.

{
  "ret_code": 10004,
  "ext_code": "",
  "result": null,
  "ext_info": null,
  "time_now": "1599924774.101266",
  "message": "error sign! origin_string[api_key=xxxxxxxxxx&order_id=5e9b4517-860d-4c60-b797-825afed28ff2&p_r_price=10369.5&p_r_qty=&recv_window=15000&symbol=BTCUSD&timestamp=1599924773483]"
}

@tiagosiebler tiagosiebler added the bug Something isn't working label Sep 12, 2020
@beppu
Copy link
Contributor

beppu commented Sep 15, 2020

Which endpoint caused this error?
EDIT: I guess this affects every API call that does a POST request.

@tiagosiebler
Copy link
Owner Author

I think in this instance it was placing and moving limit orders (quite a few requests saw errors at once). Not quite sure yet why it only started happening recently, but in the api telegram group I saw a number of times that others saw this when putting unnecessary params into the URL instead of the POST request body. I think params like price and qty can all go in the body, if I'm remembering right.

@beppu
Copy link
Contributor

beppu commented Sep 17, 2020

I tried replicating this bug by calling both replaceActiveOrder and replaceConditionalOrder since they both use the parameters p_r_price and p_r_qty as seen in the original error message. However, I wasn't able to get it to fail in the way you showed. I'm not sure how those parameters got into the query string, because there's code in request.js starting from line 70 which should put the parameters in the request body if it's a POST request.

https://github.com/tiagosiebler/bybit-api/blob/master/lib/request.js#L70-L77

Initially, I wanted to fix this issue before sending you a PR to bump the version so that you could cut a release, but now I think a release should be made with the API endpoints I added while this is being investigated further. I'll send that PR shortly.

@tiagosiebler
Copy link
Owner Author

I agree & thank you for spending time on this! I'll get more logs the next time I see this.

Oddly enough, I think this only seems to happen when I trigger order events via a slack connector I have, and only sometimes. I haven't seen other order sources have an impact so it may just be a bad parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants