Fix opportunity ignore_dust handling
This commit is contained in:
@@ -90,6 +90,7 @@ def get_positions(
|
||||
config: dict[str, Any],
|
||||
*,
|
||||
spot_client: Any,
|
||||
ignore_dust: bool = True,
|
||||
) -> dict[str, Any]:
|
||||
quote = str(config.get("market", {}).get("default_quote", "USDT")).upper()
|
||||
dust = float(config.get("trading", {}).get("dust_usdt_threshold", 0.0))
|
||||
@@ -102,7 +103,7 @@ def get_positions(
|
||||
asset = item["asset"]
|
||||
mark_price = price_map.get(asset, 1.0 if asset == quote else 0.0)
|
||||
notional = quantity * mark_price
|
||||
if notional < dust:
|
||||
if ignore_dust and notional < dust:
|
||||
continue
|
||||
rows.append(
|
||||
asdict(
|
||||
|
||||
@@ -48,13 +48,14 @@ def scan_opportunities(
|
||||
symbols: list[str] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
opportunity_config = config.get("opportunity", {})
|
||||
ignore_dust = bool(opportunity_config.get("ignore_dust", True))
|
||||
signal_weights = get_signal_weights(config)
|
||||
interval = get_signal_interval(config)
|
||||
thresholds = _opportunity_thresholds(config)
|
||||
scan_limit = int(opportunity_config.get("scan_limit", 50))
|
||||
top_n = int(opportunity_config.get("top_n", 10))
|
||||
quote = str(config.get("market", {}).get("default_quote", "USDT")).upper()
|
||||
held_positions = get_positions(config, spot_client=spot_client)["positions"]
|
||||
held_positions = get_positions(config, spot_client=spot_client, ignore_dust=ignore_dust)["positions"]
|
||||
concentration_map = {normalize_symbol(item["symbol"]): float(item["notional_usdt"]) for item in held_positions}
|
||||
total_held = sum(concentration_map.values()) or 1.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user