knowm / XChange

XChange is a Java library providing a streamlined API for interacting with 60+ Bitcoin and Altcoin exchanges providing a consistent interface for trading and accessing market data.
http://knowm.org/open-source/xchange/
MIT License
3.85k stars 1.94k forks source link

Invalid Symbol Error with ByBit v5 API Integration #4822

Closed marcelv3612 closed 5 months ago

marcelv3612 commented 7 months ago

Description: The recent integration of ByBit v5 API support, as introduced in Pull Request #4771, appears to have a critical bug affecting symbol validation. Despite following the symbol format guidelines provided in ByBit's official API documentation, requests to create orders are failing with a "params error: symbol invalid" message. This issue has been identified and corroborated by multiple users, including @damiano1996.

Steps to Reproduce:

Implement a call to ByBit's v5 API for creating an order using the XChange library post-integration of PR #4771. Ensure the symbol format adheres to the specifications in ByBit's official documentation. Execute the call. Expected Result: The order is successfully created without errors, recognizing the symbol as valid.

Actual Result: The call fails with the following error message: "params error: symbol invalid". This error persists even when using symbols that are clearly valid according to ByBit's official documentation.

Screenshots:

Screenshot demonstrating the error message:

image

Screenshot showing the attempted API call with the recommended symbol format:

image

Thanks!

rizer1980 commented 7 months ago

Hello again.

First of all, please post full code simple example for rerpoduce this error. Java, not kotlin of course.

marcelv3612 commented 7 months ago

Hello, and thank you for your response.

To clarify, the issue with the bybitAuthenticated.placeLimitOrder() method in the ByBitTradeServiceRaw.java file persists regardless of the specific parameters provided in the call. This has been thoroughly tested across all possible combinations of user-input parameters, including category, symbol, side, type, qty, limitPrice, and orderIdLink, without success. The error occurs consistently, indicating that the problem might not be tied to the way parameters are being passed but potentially to the underlying implementation or integration of the API.

I appreciate your assistance in investigating this matter further.

pozheg commented 6 months ago

I have the same issue, but I don't use XChange, so it looks like something is wrong on the ByBit side. I try to call V5 API directly for the linear category and constantly have this error message. But if I use the same call but try to create a spot order (use category "spot") - it works fine.

image
pozheg commented 6 months ago

Finally, I've resolved this issue. The root cause is that V5 API POST requests require JSON as params. The issue is not related to the symbol format.

rizer1980 commented 5 months ago

please check and close.