这是indexloc提供的服务,不要输入任何密码
Skip to content

Add support for limit orders for stop loss in PositionExecutor #7712

@sairus2k

Description

@sairus2k

Feature Suggestion

Currently, the PositionExecutor class only supports market orders for stop loss execution. This means stop loss orders are always filled as taker orders, which generally incur higher exchange fees and provide less control over execution price.

It would be highly beneficial to add support for limit orders for stop loss, similar to how take profit orders can be configured. This would give users more control over fees and execution.

Impact

The desired behavior allows to:

  • Reduce trading fees by utilizing maker (limit) orders for stop loss.
  • Gain more control over stop loss execution price, especially on volatile or illiquid markets.
  • Use the same flexible order type configuration for both take profit and stop loss, making position management more consistent and customizable.

Additional context

Currently, the following code in PositionExecutor.__init__ enforces only market orders for stop loss:

if config.triple_barrier_config.time_limit_order_type != OrderType.MARKET or \
        config.triple_barrier_config.stop_loss_order_type != OrderType.MARKET:
    error = "Only market orders are supported for time_limit and stop_loss"
    self.logger().error(error)
    raise ValueError(error)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementUpgrade or improvement to an existing hummingbot feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions