ccxt icon indicating copy to clipboard operation
ccxt copied to clipboard

Bybit: tpslMode="Full" incorrectly requires market entry order type

Open oryusan opened this issue 4 weeks ago • 3 comments

Operating System

Linux Mint

Programming Language

Python

CCXT Version

4.5.22

Description

CCXT Bug Report: Bybit tpslMode="Full" incorrectly requires market entry order

Summary

CCXT incorrectly validates that the entry order type must be market when using tpslMode=Full for Bybit. However, Bybit API documentation only requires tpOrderType/slOrderType to be Market, not the entry order itself.

CCXT Version

4.5.22 (latest as of 2025-12-01)

Bug Location

File: ccxt/bybit.py lines 3921-3922

if isLimit and isFullTpsl:
    raise InvalidOrder(self.id + ' tpsl orders with "full" tpslMode only support "market" type')

The isLimit variable checks if the entry order is a limit order, but per Bybit docs, only tpOrderType/slOrderType need to be Market for Full mode.

Expected Behavior

  • When tpslMode=Full, CCXT should allow limit entry orders
  • CCXT should only validate that tpOrderType and slOrderType are Market (which it already sets correctly)

Actual Behavior

CCXT raises InvalidOrder when trying to place a limit entry order with tpslMode=Full, even though Bybit API supports this.

Bybit Documentation Reference

From Bybit V5 Place Order API:

tpslMode (string):

  • Full: entire position for TP/SL. Then, tpOrderType or slOrderType must be Market
  • Partial: partial position tp/sl. Limit TP/SL order are supported.

tpOrderType (string): The order type when take profit is triggered

  • For tpslMode=Full, it only supports tpOrderType=Market

The docs clearly state that tpOrderType (the TP trigger order) must be Market, NOT the entry orderType.

Reproduction Steps

import ccxt

bybit = ccxt.bybit({
    'apiKey': 'YOUR_API_KEY',
    'secret': 'YOUR_SECRET',
})

# This SHOULD work per Bybit docs, but CCXT raises InvalidOrder
order = bybit.create_order(
    symbol='BTC/USDT:USDT',
    type='limit',  # Entry order type - should be allowed
    side='buy',
    amount=0.001,
    price=50000,
    params={
        'takeProfitPrice': 55000,
        'tpslMode': 'Full',  # This triggers the incorrect validation
    }
)

oryusan avatar Dec 01 '25 14:12 oryusan

@oryusan Thanks for reporting it, we will take a look as soon as possible.

carlosmiei avatar Dec 01 '25 18:12 carlosmiei

I'll post an update about this issue

ttodua avatar Dec 01 '25 20:12 ttodua

@oryusan the above linked PR would solve this issue. note, after new version gets released, you will be able to use it, but you will no longer be required to pass tpslMode, because our implementation will choose either Partial or Full automatically

ttodua avatar Dec 03 '25 07:12 ttodua

Is this now implemented in the latest Version 4.5.26?

oryusan avatar Dec 11 '25 09:12 oryusan

@oryusan Sorry not yet we haven't reached a final decision yet

carlosmiei avatar Dec 11 '25 09:12 carlosmiei