JKorf / Bybit.Net

A C# .netstandard client library for the Bybit REST and Websocket V5 API focusing on clear usage and models
https://jkorf.github.io/Bybit.Net/
91 stars 61 forks source link

WebSocket V5PrivateApi SubscribeToOrderUpdatesAsync missing enum #211

Open pgrimstrup opened 1 month ago

pgrimstrup commented 1 month ago

Hi. I am using V5PrivateApi.SubscribeToOrderUpdatesAsync to listen for changes to orders, and noticed a log error message:

Cannot map enum value. EnumType: StopLossTakeProfitMode, Value: UNKNOWN, Known values: Full, Partial. If you think UNKNOWN should added please open an issue on the Github repo

I had my program listening for orders, while I placed an order without any SL/TP using the ByBit website. However if a place an order with a SL/TP, the error does not show.

Note that the order is still received via web socket, with the TpSlMode property set to null. The message is just a logged warning and doesn't impact the API in any way (low priority).

pgrimstrup commented 4 weeks ago

Started using Trailing Stops via the SetTradingStop() method and I am also receiving this error message;

Cannot map enum value. EnumType: StopOrderType, Value: TrailingProfit, Known values: TakeProfit, StopLoss, TrailingStop, Stop, PartialStopLoss, PartialTakeProfit, tpslOrder, OcoOrder, MmRateClose, BidirectionalTpslOrder. If you think TrailingProfit should added please open an issue on the Github repo

It appears to be pseudonym for TrailingStop, or just a typo from the API itself. It appears in the websocket feed for orders when a trailing stop is entered. As a result, the order is received as a Market Sell order as the StopOrderType field cannot be parsed.

A workaround appears to be to check the CreateType field for "CreateByTrailingProfit" to identify the order as a Take Profit order.