`TriggerDirection` enum missing value `0` (None/NotApplicable) — warns on every non-trigger order fetch
TriggerDirection enum missing value 0 (None/NotApplicable) — warns on every non-trigger order fetch
Library: JKorf/Bybit.Net (via CryptoExchange.Net EnumConverter)
Version: Bybit.Net latest as of 2026-03-18 (CryptoExchange.Net SystemTextJson EnumConverter)
Severity: Low/Enhancement — cosmetic log noise, no functional impact
Discovered: 2026-03-18
Related internal task: TASK-FIXW12B-MAIN-003
Describe the bug
When fetching order status via /v5/order/realtime for non-trigger orders (e.g., plain market orders), Bybit's API returns "triggerDirection": 0. The EnumConverter in CryptoExchange.Net only maps values 1: Rise and 2: Fall for Bybit.Net.Enums.TriggerDirection. Value 0 is unmapped, producing a WARN log on every fetch:
WARN|CryptoExchange.Net.Converters.SystemTextJson.EnumConverter`1.ReadNullable| Cannot map enum value. EnumType: Bybit.Net.Enums.TriggerDirection, Value: 0, Known values: [1: Rise, 2: Fall]. If you think 0 should added please open an issue on the Github repo
This warning fires for every non-trigger order status fetch, creating significant log noise.
To Reproduce
var client = new BybitRestClient(options =>
{
options.ApiCredentials = new ApiCredentials(key, secret);
// Any environment (demo, testnet, or live)
});
// Place a plain market order (no trigger)
var placeResult = await client.V5Api.Trading.PlaceOrderAsync(
Category.Linear, "BTCUSDT", OrderSide.Buy, NewOrderType.Market,
quantity: 0.001m,
timeInForce: TimeInForce.ImmediateOrCancel,
clientOrderId: "test_order_001");
// Fetch the order status — this triggers the warning
var orderResult = await client.V5Api.Trading.GetOrdersAsync(
Category.Linear,
symbol: "BTCUSDT",
orderLinkId: "test_order_001");
The response from Bybit includes "triggerDirection": 0 for the market order, which the SDK cannot map.
Expected behavior
Value 0 should be handled gracefully. Two possible approaches:
-
Add
None = 0to theTriggerDirectionenum — This is the simplest fix. Value0means "not applicable" (the order is not a conditional/trigger order). -
Treat unmapped
0asnull— TheEnumConverter.ReadNullablecould treat0as a valid "no value" response without emitting a warning.
Option 1 is preferred as it's explicit and self-documenting.
Root cause
In Bybit.Net/Enums/TriggerDirection.cs, the enum only defines:
public enum TriggerDirection
{
Rise = 1,
Fall = 2
}
Bybit's API returns triggerDirection: 0 for all non-trigger orders (market orders, limit orders without triggers, etc.). This is Bybit's way of saying "not applicable".
The EnumConverter<TriggerDirection>.ReadNullable() in CryptoExchange.Net attempts to map value 0 and fails because it's not defined, producing the warning.
Proposed fix
public enum TriggerDirection
{
None = 0, // Not applicable — order is not a conditional/trigger order
Rise = 1,
Fall = 2
}
Additional info
Endpoint
- REST:
GET /v5/order/realtime
Raw API response (relevant fields)
{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"symbol": "BTCUSDT",
"orderType": "Market",
"orderLinkId": "BUY_BASE_0000000000000001",
"orderStatus": "Filled",
"triggerDirection": 0,
"triggerPrice": "",
"triggerBy": "",
"...": "..."
}
]
}
}
Note: triggerDirection: 0 is consistently returned for all non-trigger orders. For conditional orders, it correctly returns 1 (Rise) or 2 (Fall).
Environment
- Tested on: Bybit Demo Trading (
BybitEnvironment.DemoTrading) - Also expected to occur on: Testnet and Live (same API behavior)
Impact
- Functional: None — the SDK falls back to null/default which is correct
- Operational: Significant log noise in systems that poll order status frequently
Our workaround
We classify this warning as known noise in our audit knowledge base and filter it during log analysis. No local code changes applied — waiting for upstream fix.
While creating a PR for this, we discovered it was already fixed in Bybit.Net 6.7.0. Closing the issue.