|
|
|
@ -216,6 +216,10 @@ def get_kline_data(symbol: str, period: str = "15", db: Session = Depends(get_db
|
|
|
|
|
|
|
|
|
|
|
|
def _get_futures_name(symbol: str) -> str:
|
|
|
|
def _get_futures_name(symbol: str) -> str:
|
|
|
|
"""根据合约代码获取品种名称"""
|
|
|
|
"""根据合约代码获取品种名称"""
|
|
|
|
|
|
|
|
# 从合约代码中提取品种代码(去除数字部分)
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
symbol_base = re.sub(r'\d+', '', symbol).upper()
|
|
|
|
|
|
|
|
|
|
|
|
name_map = {
|
|
|
|
name_map = {
|
|
|
|
"AU": "黄金", "AG": "白银", "CU": "铜", "AL": "铝",
|
|
|
|
"AU": "黄金", "AG": "白银", "CU": "铜", "AL": "铝",
|
|
|
|
"ZN": "锌", "NI": "镍", "SN": "锡", "PB": "铅",
|
|
|
|
"ZN": "锌", "NI": "镍", "SN": "锡", "PB": "铅",
|
|
|
|
@ -232,7 +236,7 @@ def _get_futures_name(symbol: str) -> str:
|
|
|
|
"IF": "沪深300", "IC": "中证500", "IH": "上证50", "IM": "中证1000",
|
|
|
|
"IF": "沪深300", "IC": "中证500", "IH": "上证50", "IM": "中证1000",
|
|
|
|
"T": "10年期国债", "TF": "5年期国债", "TS": "2年期国债", "TL": "30年期国债",
|
|
|
|
"T": "10年期国债", "TF": "5年期国债", "TS": "2年期国债", "TL": "30年期国债",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return name_map.get(symbol, symbol)
|
|
|
|
return name_map.get(symbol_base, symbol)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _get_suggestion(close: float, open: float, change_pct: float) -> str:
|
|
|
|
def _get_suggestion(close: float, open: float, change_pct: float) -> str:
|
|
|
|
|