优化相关设备的格式显示

This commit is contained in:
Coldin04 2025-08-13 22:48:17 +08:00
parent b18805aa26
commit 4a3eaf87e8
6 changed files with 67 additions and 142 deletions

View file

@ -2,6 +2,7 @@ from typing import Dict, Any, Optional
import logging
from okx import OkxRestClient
from .base_service import BaseService
from config import Config # 导入配置
logger = logging.getLogger(__name__)
@ -13,7 +14,7 @@ class CryptoService(BaseService):
# 对于公共数据不需要API密钥
self.client = OkxRestClient(api_key, secret_key, passphrase) if api_key else OkxRestClient()
def get_data(self, pair: str = "ETH-USDT") -> Optional[Dict[str, Any]]:
def get_data(self, pair: str = Config.DEFAULT_CRYPTO_PAIR) -> Optional[Dict[str, Any]]:
"""获取指定交易对的价格数据"""
try:
# 使用正确的marketdata属性获取ticker数据