Skip to content

fix: support conditional UM algo order types without breaking compatibility - #95

Closed
techleadevelopers wants to merge 1 commit into
binance:mainfrom
techleadevelopers:fix/um-algo-order-type-enum
Closed

fix: support conditional UM algo order types without breaking compatibility#95
techleadevelopers wants to merge 1 commit into
binance:mainfrom
techleadevelopers:fix/um-algo-order-type-enum

Conversation

@techleadevelopers

Copy link
Copy Markdown

Summary

Refactors NewUmAlgoOrderTypeEnum to support the conditional algo order types actually accepted by the Binance API for portfolio margin UM algo orders, while preserving backwards compatibility.

Changes

  • keeps existing LIMIT and MARKET variants
  • marks both as deprecated instead of removing them
  • adds:
    • Stop
    • StopMarket
    • TakeProfit
    • TakeProfitMarket
    • TrailingStopMarket
  • updates as_str() mappings
  • updates FromStr mappings

Why

The Binance API accepts the following conditional algo order types for these orders:

  • STOP
  • STOP_MARKET
  • TAKE_PROFIT
  • TAKE_PROFIT_MARKET
  • TRAILING_STOP_MARKET

Using LIMIT or MARKET for these conditional algo orders results in -1130.

This patch fixes the enum without introducing a breaking change for existing SDK users.

Compatibility

LIMIT and MARKET are intentionally preserved and marked as deprecated:

Binance API returns -1130 for LIMIT/MARKET in conditional algo orders. Use Stop or StopMarket instead.

Notes

This is intentionally narrower than replacing the old variants outright. The goal is to correct API behavior while maintaining source compatibility for downstream users.

Related: #94

This patch takes the same issue in a backwards-compatible direction by preserving the old variants as deprecated instead of removing them.

@dimitrisn442

Copy link
Copy Markdown
Contributor

Hi @techleadevelopers, thanks for bringing this up. The NewUmAlgoOrderTypeEnum has been fixed in v61.0.0 release and now includes the right values. Feel free to test it and raise another issue/PR if anything else seems off.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants