Skip to content

Shared API: GetPositionsAsync validation requires undocumented SettleAsset parameter when symbol is null #294

Description

@ypsik

Description:
When using the IFuturesOrderRestClient.GetPositionsAsync shared interface for Bybit, the request fails with an ArgumentError if no Symbol is provided, even if valid Bybit V5 parameters like settleCoin or category are passed via ExchangeParameters.

The internal validation logic specifically checks for an ExchangeParameter named "SettleAsset":

C#
var symbol = request.Symbol?.GetSymbol(FormatSymbol);
if (symbol == null && ExchangeParameters.GetValue<string?>(request.ExchangeParameters, Exchange, "SettleAsset") == null)
return new ExchangeWebResult<SharedPosition[]>(Exchange, ArgumentError.Invalid("SettleAsset", "Either the Symbol request parameter or the SettleAsset exchange parameter is required"));

The Issues:

Image

Inconsistent Naming: The Bybit V5 API documentation explicitly states that settleCoin is used. However, passing settleCoin into ExchangeParameters fails the shared API's validation because the wrapper explicitly looks for the hardcoded string "SettleAsset".

Hidden Requirement: Since category is derived from TradingMode internally, the user has to guess that "SettleAsset" (and not settleCoin) needs to be supplied when querying all positions for a specific margin asset.

Suggested Improvement:

Map settleCoin from the official API parameters or accept both "settleCoin" and "SettleAsset" in the ExchangeParameters validation.

Document these mandatory wrapper-specific keys in the Shared API documentation/XML comments.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions