Skip to content

[Bug] TypeError in _emergency_liquidate 方法 #59

@Daren-star

Description

@Daren-star

🐛 Bug描述

_emergency_liquidate 方法执行时出现类型错误:

TypeError: '<' not supported between instances of 'str' and 'float'
    if base_balance < min_amount:
  File "/root/GridBNB-USDT/src/core/trader.py", line 2767, in _emergency_liquidate

🔍 问题原因

_adjust_amount_precision 方法在调用 exchange.exchange.amount_to_precision() 后返回字符串类型,导致后续的数值比较操作失败。

问题代码 (src/core/trader.py:1623):

# CCXT的amount_to_precision返回字符串
return self.exchange.exchange.amount_to_precision(self.symbol, amount)

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