Skip to content

UnifiedApi (UTA v3): history-strategy-orders fails to deserialize (cursor is a number) + a few serialization/missing-parameter issues #111

Closed

Description

@dante1989

Hi, thanks for the library. While migrating a futures bot from the Classic V2 API to the Unified Account (V3) API with JK.Bitget.Net 4.5.0 (.NET Framework 4.7.2 and .NET 10) I ran into the following. Item 1 is a hard bug, the rest are smaller issues / missing pieces.

1. UnifiedApi.Trading.GetClosedStrategyOrdersAsync — deserialization error (bug)

GET /api/v3/trade/history-strategy-orders returns data.cursor as a JSON number, but BitgetUaStrategyOrders.Cursor is declared as string?, so every call fails as soon as the account has at least one historical strategy order:

Json deserialization failed: The JSON value could not be converted to System.String.
Path: $.data.cursor | LineNumber: 0 | BytePositionInLine: 694

Suggested fix: read cursor with a number-or-string converter (same for other UTA paging models if Bitget does the same there).

2. UnifiedApi.Trading.PlaceStrategyOrderAsync — two parameters serialized in V2 format

  • reduceOnly is added with BoolSerialization.String → sends "true"/"false". The V3 doc for place-strategy-order expects "yes"/"no" (the regular PlaceOrderAsync already sends yes/no correctly).
  • triggerBy, tpTriggerBy, slTriggerBy are typed as Enums.V2.TriggerPriceType, which maps to fill_price / mark_price. The V3 endpoint expects market / mark.

Workaround today: omit these parameters (only possible in hedge mode with the default trigger source).

3. UnifiedApi.Account.SetLeverageAsync — missing parameters

The method only has leverage and positionSide. POST /api/v3/account/set-leverage also accepts marginMode, longLeverage, shortLeverage. In hedge mode + isolated margin the API rejects the request without them:

25200: ... DOUBLE_SIDE_HOLD afterShortLeverage and afterLongLeverage none

Related: BitgetUaAccountInfoSymbol (GetAccountConfigAsync -> symbolConfigList) only maps category, symbol, marginMode, leverage. The API also returns longLeverage and shortLeverage per symbol, which are the values that matter in hedge mode + isolated margin (currently only readable from OriginalData).

4. Missing endpoints / parameters (would be nice to have)

  • POST /api/v3/account/set-margin (add / remove isolated position margin)
  • POST /api/v3/account/upgrade and GET /api/v3/account/upgrade-status (switch Classic → Unified)
  • GET /api/v3/trade/strategy-sub-orders (child orders of a triggered strategy order)
  • GET /api/v3/account/funding-financial-records
  • GetClosedOrdersAsync: the API has a symbol filter, the method has no such parameter
  • ProductCategory has no OTHER value, which GET /api/v3/account/financial-records accepts as category

5. Minor

  • GetPositionsAsync returns Success = true with Data = null when the account has no positions (API sends "list": null); an empty array would be easier to consume.

Happy to test a pre-release build. Thanks!

Activity

  1. erenemrearik commented on Oct 7, 2026

    @erenemrearik
    Contributor

    Thanks for the detailed report. I'd like to pick up items 1 and 2:

    • cursor in history-strategy-orders is documented as a string, but I can reproduce your exact error when it comes back as a number. I'll read it with NumberStringConverter so both forms work.
    • PlaceStrategyOrderAsync will send reduceOnly as yes/no, and tpTriggerBy/slTriggerBy/triggerBy on PlaceStrategyOrderAsync and EditStrategyOrderAsync will use the UTA PriceTriggerType enum (market/mark), matching the docs.

    On current main, several other points already seem covered: SetLeverageAsync has marginMode/longLeverage/shortLeverage, GetClosedOrdersAsync has symbol, ProductCategory.Other and GetFundingFinancialRecordsAsync exist. I'm leaving the new endpoints, the longLeverage/shortLeverage fields on the account config model and the GetPositionsAsync null list out of this change.

  2. JKorf commented on Oct 12, 2026

    @JKorf
    Owner

    Hi, all parts of this should now be fixed/added with version 4.8.0.

    The Upgrade/UpgradeStatus endpoints are in the SpotApiV2 since it's not part of the new Unified API.
    Let me know if you have any other requests or issues.

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