"""测试转债策略收益概览 - 验证是否返回全0指标"""
import json
from ldnode.calculator.handlers.cb_glance_handler import handle_cb_glance

parameters = {
    "task_id": "test-glance-001",
    "strategy_config": {
        "pools": None,
        "hold_method": {
            "hold_range_type": 1,
            "hold_range_value": {"start": 1.0, "end": 5.0},
            "hold_threshold": 0.0,
            "hold_weight": 1,
            "max_hold_weight": 1.0,
        },
        "computed_factors": [],
        "filter_factors": {
            "relation": "OR",
            "conditions": [
                {"factor": "list_days", "type": 0, "operator": "le", "value": 3}
            ],
        },
        "rank_factors": [
            {"factor": "close", "type": 0, "ascending": False, "weight": 1.0, "neutralization_factor": None, "process_missing_data_method": None},
            {"factor": "dblow", "type": 0, "ascending": False, "weight": 1.0, "neutralization_factor": None, "process_missing_data_method": None},
            {"factor": "remain_cap", "type": 0, "ascending": False, "weight": 1.0, "neutralization_factor": None, "process_missing_data_method": None},
        ],
        "stop_method": {"stop_type": 1, "stop_value": 0.06},
        "rotation_type": 0,
        "rebalance_method": {"rebalance_type": 0, "rebalance_value": 1},
        "backtest_type": 1,
        "date_range": {"start_date": "2025-03-31", "end_date": "2026-03-31"},
        "capital": 10000.0,
        "commission": 0.001,
        "benchmark": "cb_avg",
        "exclude_call": ["已满足强赎条件", "公告提示强赎", "公告实施强赎", "公告到期强赎", "已公告强赎"],
        "exclude_list_days": 3,
        "exclude_st": True,
        "exclude_market": None,
        "exclude_first_industries": [],
        "exclude_second_industries": [],
        "exclude_third_industries": [],
        "exclude_orgform": [],
        "exclude_area": [],
        "exclude_rating": [],
        "exclude_yy_rating": [],
        "exclude_ignore_list": [],
        "created_date": "2026-03-01",
    },
}

if __name__ == "__main__":
    result = handle_cb_glance(parameters)
    print(json.dumps(result, indent=2, default=str))
