Skip to content

Commit 13f2bca

Browse files
committed
refactor: remove obsolete backend code paths
1 parent aa5f491 commit 13f2bca

62 files changed

Lines changed: 41 additions & 650 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎backend_api_python/app/commands/strategy_capacity_probe.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from app.events.dispatcher import StrategyDueDispatcher
1717
from app.events.evaluator import StrategyEvaluationBatchHandler
18-
from app.events.protocol import MarketBarClosedV1, StrategyEvaluationBatchV1
18+
from app.events.protocol import MarketBarClosedV1
1919
from app.services.event_inbox import InboxClaim
2020
from app.services.strategy_event_subscriptions import strategy_shard
2121
from app.services.strategy_runtime.scheduler import CooperativeRuntimeScheduler

‎backend_api_python/app/data/market_symbols_seed.py‎

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -271,43 +271,3 @@ def get_symbol_name(market: str, symbol: str) -> Optional[str]:
271271
logger.debug(f"get_symbol_name from DB failed: {e}")
272272

273273
return None
274-
275-
276-
def get_all_symbols(market: str = None) -> List[Dict]:
277-
"""
278-
Get all active symbols, optionally filtered by market.
279-
280-
Args:
281-
market: Optional market filter
282-
283-
Returns:
284-
List of symbol records
285-
"""
286-
try:
287-
with _get_db_connection() as db:
288-
cur = db.cursor()
289-
if market:
290-
cur.execute(
291-
"""
292-
SELECT market, symbol, name, exchange, currency, is_hot, sort_order
293-
FROM qd_market_symbols
294-
WHERE market = ? AND is_active = 1
295-
ORDER BY sort_order DESC
296-
""",
297-
(market.strip(),)
298-
)
299-
else:
300-
cur.execute(
301-
"""
302-
SELECT market, symbol, name, exchange, currency, is_hot, sort_order
303-
FROM qd_market_symbols
304-
WHERE is_active = 1
305-
ORDER BY market, sort_order DESC
306-
"""
307-
)
308-
rows = cur.fetchall() or []
309-
cur.close()
310-
return [dict(r) for r in rows]
311-
except Exception as e:
312-
logger.debug(f"get_all_symbols from DB failed: {e}")
313-
return []

‎backend_api_python/app/data_sources/base.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66
from abc import ABC, abstractmethod
77
from typing import Dict, List, Any, Optional
8-
from datetime import datetime, timedelta, timezone
8+
from datetime import datetime, timezone
99

1010
from app.utils.logger import get_logger
1111

‎backend_api_python/app/data_sources/cache_manager.py‎

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
import time
1616
import logging
17-
from typing import Dict, Any, Optional, List
17+
from typing import Dict, Any, Optional
1818
from collections import OrderedDict
19-
from dataclasses import dataclass, field
20-
from datetime import datetime
19+
from dataclasses import dataclass
2120
import threading
2221

2322
logger = logging.getLogger(__name__)
@@ -204,20 +203,3 @@ def get_kline_cache() -> DataCache:
204203
def get_stock_info_cache() -> DataCache:
205204
"""Return the stock info cache."""
206205
return _stock_info_cache
207-
208-
209-
def generate_kline_cache_key(
210-
symbol: str,
211-
timeframe: str,
212-
limit: int,
213-
before_time: Optional[int] = None
214-
) -> str:
215-
"""
216-
Generate a K-line cache key.
217-
218-
Format: symbol:timeframe:limit[:before_time]
219-
"""
220-
key = f"{symbol}:{timeframe}:{limit}"
221-
if before_time:
222-
key += f":{before_time}"
223-
return key

‎backend_api_python/app/data_sources/crypto.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
normalize_market_type,
1515
)
1616
from app.utils.logger import get_logger
17-
from app.config import CryptoPublicConfig, APIKeys
17+
from app.config import CryptoPublicConfig
1818

1919
logger = get_logger(__name__)
2020

@@ -394,8 +394,6 @@ def _normalize_symbol_for_exchange(self, symbol: str) -> str:
394394
if not normalized or not base:
395395
return symbol
396396

397-
exchange_id = getattr(self.exchange, 'id', '').lower()
398-
399397
if self._ensure_markets_loaded():
400398
valid_symbol = self._find_valid_symbol(base, normalized.split('/')[1] if '/' in normalized else 'USDT')
401399
if valid_symbol:
@@ -451,7 +449,6 @@ def get_ticker(self, symbol: str) -> Dict[str, Any]:
451449
if ticker and isinstance(ticker, dict):
452450
return ticker
453451
except Exception as e:
454-
error_msg = str(e).lower()
455452
is_symbol_error = _is_symbol_not_found_error(e)
456453

457454
if is_symbol_error:

‎backend_api_python/app/data_sources/futures.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from typing import Dict, List, Any, Optional
88
from datetime import datetime, timedelta
99
import os
10-
import time
1110
import requests
1211
import yfinance as yf
1312

‎backend_api_python/app/data_sources/rate_limiter.py‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,9 @@ def wrapper(*args, **kwargs) -> Any:
177177
return decorator
178178

179179

180-
_eastmoney_limiter = RateLimiter(min_interval=2.0, jitter_min=1.0, jitter_max=3.0)
181180
_tencent_limiter = RateLimiter(min_interval=1.0, jitter_min=0.5, jitter_max=1.5)
182-
_akshare_limiter = RateLimiter(min_interval=2.0, jitter_min=1.5, jitter_max=3.5)
183-
184-
185-
def get_eastmoney_limiter() -> RateLimiter:
186-
"""Return the Eastmoney rate limiter."""
187-
return _eastmoney_limiter
188181

189182

190183
def get_tencent_limiter() -> RateLimiter:
191184
"""Return the Tencent rate limiter."""
192185
return _tencent_limiter
193-
194-
195-
def get_akshare_limiter() -> RateLimiter:
196-
"""Return the AkShare rate limiter."""
197-
return _akshare_limiter

‎backend_api_python/app/data_sources/tencent.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from __future__ import annotations
1212

1313
from datetime import datetime
14-
from typing import Any, Dict, List, Optional, Tuple
14+
from typing import Any, Dict, List, Optional
1515

1616
import requests
1717

‎backend_api_python/app/data_sources/us_stock.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from app.data_sources.base import BaseDataSource
1616
from app.utils.logger import get_logger
17-
from app.config import APIKeys, YFinanceConfig
17+
from app.config import APIKeys
1818

1919
logger = get_logger(__name__)
2020

‎backend_api_python/app/openapi/helpers.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
from __future__ import annotations
55

6-
from typing import Any, Tuple
6+
from typing import Any
77

88
from flask import jsonify
99

@@ -16,8 +16,3 @@ def ok(data: Any = None, msg: str = "success") -> dict:
1616
def fail(msg: str, *, code: int = 0, data: Any = None, http_status: int = 400):
1717
"""Human API error envelope. Returns (body, status) for Flask views."""
1818
return jsonify({"code": code, "msg": msg, "data": data}), http_status
19-
20-
21-
def visibility_doc(level: str) -> dict:
22-
"""OpenAPI extension for Public / Internal / Private tiers."""
23-
return {"x-visibility": level}

0 commit comments

Comments
 (0)