- Trading skills (OKX, dividend, lottery, quantitative) - Creative skills (ASCII art, diagrams, video) - Development skills (GitHub, debugging, TDD) - Research skills (arXiv, blog monitoring) - Productivity skills (email, documents, notes) - MCP integration skills - Custom user skills
28 lines
601 B
Python
28 lines
601 B
Python
#!/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)
|