#!/usr/bin/env python3
"""
Trading config loader
从 config.json 读取所有交易参数，消除硬编码
"""

import json, os

CONFIG_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'config.json')

def load_config():
    with open(CONFIG_PATH) as f:
        return json.load(f)

# Singleton
_config = None

def get_config():
    global _config
    if _config is None:
        _config = load_config()
    return _config

def get(section, key, default=None):
    """获取配置值: get('atr', 'multiplier')"""
    cfg = get_config()
    return cfg.get(section, {}).get(key, default)
