Spaces:
Running
Running
Update data_manager.py
Browse files- data_manager.py +220 -270
data_manager.py
CHANGED
|
@@ -9,7 +9,6 @@ import ccxt.pro as ccxt
|
|
| 9 |
import numpy as np
|
| 10 |
import logging
|
| 11 |
from typing import List, Dict, Any
|
| 12 |
-
from concurrent.futures import ThreadPoolExecutor
|
| 13 |
|
| 14 |
logging.getLogger("httpx").setLevel(logging.WARNING)
|
| 15 |
logging.getLogger("httpcore").setLevel(logging.WARNING)
|
|
@@ -20,18 +19,17 @@ class DataManager:
|
|
| 20 |
self.whale_monitor = whale_monitor
|
| 21 |
|
| 22 |
# إعدادات الأداء المحسنة
|
| 23 |
-
self.batch_size =
|
| 24 |
-
self.
|
| 25 |
-
self.cache_duration = 300 # تخزين النتائج لمدة 5 دقائق
|
| 26 |
|
| 27 |
try:
|
| 28 |
self.exchange = ccxt.kucoin({
|
| 29 |
'sandbox': False,
|
| 30 |
'enableRateLimit': True,
|
| 31 |
-
'timeout':
|
| 32 |
-
'verbose': False
|
|
|
|
| 33 |
})
|
| 34 |
-
self.exchange.rateLimit = 500 # زيادة معدل الطلبات
|
| 35 |
print("✅ تم تهيئة اتصال KuCoin بنجاح")
|
| 36 |
except Exception as e:
|
| 37 |
print(f"❌ فشل تهيئة اتصال KuCoin: {e}")
|
|
@@ -44,9 +42,9 @@ class DataManager:
|
|
| 44 |
self.cache_timestamp = {}
|
| 45 |
|
| 46 |
async def initialize(self):
|
| 47 |
-
self.http_client = httpx.AsyncClient(timeout=
|
| 48 |
await self._load_markets()
|
| 49 |
-
print("✅ DataManager initialized - Optimized for
|
| 50 |
|
| 51 |
async def _load_markets(self):
|
| 52 |
try:
|
|
@@ -71,11 +69,8 @@ class DataManager:
|
|
| 71 |
async def get_market_context_async(self):
|
| 72 |
"""جلب سياق السوق الأساسي فقط"""
|
| 73 |
try:
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
price_task = asyncio.create_task(self._get_prices_with_fallback())
|
| 77 |
-
|
| 78 |
-
sentiment_data, price_data = await asyncio.gather(sentiment_task, price_task)
|
| 79 |
|
| 80 |
bitcoin_price = price_data.get('bitcoin')
|
| 81 |
ethereum_price = price_data.get('ethereum')
|
|
@@ -100,7 +95,7 @@ class DataManager:
|
|
| 100 |
async def get_sentiment_safe_async(self):
|
| 101 |
"""جلب بيانات المشاعر"""
|
| 102 |
try:
|
| 103 |
-
async with httpx.AsyncClient(timeout=
|
| 104 |
response = await client.get("https://api.alternative.me/fng/")
|
| 105 |
response.raise_for_status()
|
| 106 |
data = response.json()
|
|
@@ -120,14 +115,26 @@ class DataManager:
|
|
| 120 |
return None
|
| 121 |
|
| 122 |
def _determine_market_trend(self, bitcoin_price, sentiment_data):
|
| 123 |
-
"""تحديد اتجاه السوق
|
| 124 |
if bitcoin_price is None:
|
| 125 |
return "UNKNOWN"
|
| 126 |
|
| 127 |
-
|
| 128 |
if bitcoin_price > 60000:
|
| 129 |
-
|
| 130 |
elif bitcoin_price < 55000:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
return "bear_market"
|
| 132 |
else:
|
| 133 |
return "sideways_market"
|
|
@@ -145,31 +152,10 @@ class DataManager:
|
|
| 145 |
async def _get_prices_with_fallback(self):
|
| 146 |
"""جلب أسعار البيتكوين والإيثيريوم"""
|
| 147 |
try:
|
| 148 |
-
# محاولة KuCoin أولاً
|
| 149 |
prices = await self._get_prices_from_kucoin_safe()
|
| 150 |
if prices.get('bitcoin') and prices.get('ethereum'):
|
| 151 |
return prices
|
| 152 |
-
|
| 153 |
-
# استخدام المهام المتوازية للبدائل
|
| 154 |
-
coingecko_task = asyncio.create_task(self._get_prices_from_coingecko())
|
| 155 |
-
binance_task = asyncio.create_task(self._get_prices_from_binance())
|
| 156 |
-
|
| 157 |
-
done, pending = await asyncio.wait(
|
| 158 |
-
[coingecko_task, binance_task],
|
| 159 |
-
timeout=3,
|
| 160 |
-
return_when=asyncio.FIRST_COMPLETED
|
| 161 |
-
)
|
| 162 |
-
|
| 163 |
-
for task in done:
|
| 164 |
-
result = task.result()
|
| 165 |
-
if result.get('bitcoin') and result.get('ethereum'):
|
| 166 |
-
# إلغاء المهام المعلقة
|
| 167 |
-
for pending_task in pending:
|
| 168 |
-
pending_task.cancel()
|
| 169 |
-
return result
|
| 170 |
-
|
| 171 |
-
return {'bitcoin': None, 'ethereum': None}
|
| 172 |
-
|
| 173 |
except Exception as e:
|
| 174 |
print(f"❌ فشل جلب الأسعار: {e}")
|
| 175 |
return {'bitcoin': None, 'ethereum': None}
|
|
@@ -179,19 +165,17 @@ class DataManager:
|
|
| 179 |
return {'bitcoin': None, 'ethereum': None}
|
| 180 |
|
| 181 |
try:
|
| 182 |
-
# استخدام المهام المتوازية لجلب الأسعار
|
| 183 |
-
btc_task = asyncio.create_task(self.exchange.fetch_ticker('BTC/USDT'))
|
| 184 |
-
eth_task = asyncio.create_task(self.exchange.fetch_ticker('ETH/USDT'))
|
| 185 |
-
|
| 186 |
-
btc_ticker, eth_ticker = await asyncio.gather(btc_task, eth_task, return_exceptions=True)
|
| 187 |
-
|
| 188 |
prices = {'bitcoin': None, 'ethereum': None}
|
| 189 |
|
| 190 |
-
|
| 191 |
-
|
|
|
|
|
|
|
| 192 |
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
| 195 |
|
| 196 |
return prices
|
| 197 |
|
|
@@ -202,9 +186,10 @@ class DataManager:
|
|
| 202 |
async def _get_prices_from_coingecko(self):
|
| 203 |
"""الاحتياطي: جلب الأسعار من CoinGecko"""
|
| 204 |
try:
|
|
|
|
| 205 |
url = "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd"
|
| 206 |
async with httpx.AsyncClient() as client:
|
| 207 |
-
response = await client.get(url, timeout=
|
| 208 |
response.raise_for_status()
|
| 209 |
data = response.json()
|
| 210 |
|
|
@@ -220,30 +205,6 @@ class DataManager:
|
|
| 220 |
print(f"❌ فشل جلب الأسعار من CoinGecko: {e}")
|
| 221 |
return {'bitcoin': None, 'ethereum': None}
|
| 222 |
|
| 223 |
-
async def _get_prices_from_binance(self):
|
| 224 |
-
"""الاحتياطي: جلب الأسعار من Binance"""
|
| 225 |
-
try:
|
| 226 |
-
url = "https://api.binance.com/api/v3/ticker/price"
|
| 227 |
-
async with httpx.AsyncClient() as client:
|
| 228 |
-
response = await client.get(url, timeout=5)
|
| 229 |
-
response.raise_for_status()
|
| 230 |
-
data = response.json()
|
| 231 |
-
|
| 232 |
-
btc_price = None
|
| 233 |
-
eth_price = None
|
| 234 |
-
|
| 235 |
-
for ticker in data:
|
| 236 |
-
if ticker['symbol'] == 'BTCUSDT':
|
| 237 |
-
btc_price = float(ticker['price'])
|
| 238 |
-
elif ticker['symbol'] == 'ETHUSDT':
|
| 239 |
-
eth_price = float(ticker['price'])
|
| 240 |
-
|
| 241 |
-
return {'bitcoin': btc_price, 'ethereum': eth_price}
|
| 242 |
-
|
| 243 |
-
except Exception as e:
|
| 244 |
-
print(f"❌ فشل جلب الأسعار من Binance: {e}")
|
| 245 |
-
return {'bitcoin': None, 'ethereum': None}
|
| 246 |
-
|
| 247 |
def _get_minimal_market_context(self):
|
| 248 |
"""سياق سوق بدائي عند الفشل"""
|
| 249 |
return {
|
|
@@ -256,7 +217,8 @@ class DataManager:
|
|
| 256 |
|
| 257 |
async def layer1_rapid_screening(self) -> List[Dict[str, Any]]:
|
| 258 |
"""
|
| 259 |
-
الطبقة 1: فحص سريع
|
|
|
|
| 260 |
"""
|
| 261 |
candidates = []
|
| 262 |
|
|
@@ -266,39 +228,26 @@ class DataManager:
|
|
| 266 |
if symbol.endswith('/USDT') and self.market_cache[symbol].get('active', False)
|
| 267 |
]
|
| 268 |
|
| 269 |
-
print(f"📊 الطبقة 1: فحص سريع
|
| 270 |
|
| 271 |
-
#
|
| 272 |
-
for i in range(0, len(usdt_symbols),
|
| 273 |
-
batch = usdt_symbols[i:i +
|
| 274 |
-
print(f" 🔍 معالجة مجموعة {i//
|
| 275 |
|
| 276 |
-
batch_candidates = await self.
|
| 277 |
candidates.extend(batch_candidates)
|
| 278 |
|
| 279 |
-
#
|
| 280 |
-
if i + self.batch_size < len(usdt_symbols):
|
| 281 |
-
await asyncio.sleep(0.1) # تقليل وقت الانتظار
|
| 282 |
-
|
| 283 |
-
print(f"📊 تم جمع {len(candidates)} مرشح مؤهل من الطبقة 1")
|
| 284 |
-
|
| 285 |
-
if not candidates:
|
| 286 |
-
print("❌ لم يتم العثور على أي مرشح مؤهل")
|
| 287 |
-
return []
|
| 288 |
|
| 289 |
# ترتيب المرشحين حسب قوة الأساسيات
|
| 290 |
candidates.sort(key=lambda x: x.get('layer1_score', 0), reverse=True)
|
| 291 |
|
| 292 |
-
#
|
| 293 |
-
target_count = min(max(
|
| 294 |
-
|
| 295 |
-
# إذا كان لدينا عدد قليل من المرشحين، نأخذ نسبة أكبر
|
| 296 |
-
if len(candidates) < 100:
|
| 297 |
-
target_count = min(len(candidates), 50) # تأخذ على الأقل 50 مرشح إذا كان العدد الإجمالي قليل
|
| 298 |
-
|
| 299 |
final_candidates = candidates[:target_count]
|
| 300 |
|
| 301 |
-
print(f"✅ تم اختيار {len(final_candidates)} عملة من
|
| 302 |
|
| 303 |
# عرض أفضل 10 مرشحين
|
| 304 |
print(" 🏆 أفضل 10 مرشحين من الطبقة 1:")
|
|
@@ -310,131 +259,144 @@ class DataManager:
|
|
| 310 |
|
| 311 |
return final_candidates
|
| 312 |
|
| 313 |
-
async def
|
| 314 |
-
"""معالجة دفعة من الرموز في الطبقة 1
|
| 315 |
candidates = []
|
| 316 |
|
| 317 |
-
# استخدام asyncio.gather للمعالجة المتوازية
|
| 318 |
-
tasks = []
|
| 319 |
for symbol in symbols_batch:
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
|
| 330 |
return candidates
|
| 331 |
|
| 332 |
-
|
| 333 |
-
"""
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
current_price = ticker.get('last', 0)
|
| 345 |
-
volume_24h = ticker.get('baseVolume', 0)
|
| 346 |
-
dollar_volume = volume_24h * current_price
|
| 347 |
-
price_change_24h = ticker.get('percentage', 0)
|
| 348 |
-
high_24h = ticker.get('high', 0)
|
| 349 |
-
low_24h = ticker.get('low', 0)
|
| 350 |
-
|
| 351 |
-
# فحص سريع للمعايير الأساسية - تخفيف الشروط
|
| 352 |
-
if not self._quick_validation(current_price, dollar_volume, high_24h, low_24h):
|
| 353 |
-
return None
|
| 354 |
-
|
| 355 |
-
# حساب مؤشرات أساسية سريعة
|
| 356 |
-
layer1_score = self._calculate_fast_layer1_score(
|
| 357 |
-
dollar_volume, price_change_24h, current_price, high_24h, low_24h
|
| 358 |
-
)
|
| 359 |
-
|
| 360 |
-
# تخفيف عتبة القبول - تقليل من 0.3 إلى 0.1
|
| 361 |
-
if layer1_score >= 0.1: # كان 0.3
|
| 362 |
-
candidate_data = {
|
| 363 |
-
'symbol': symbol,
|
| 364 |
-
'current_price': current_price,
|
| 365 |
-
'volume_24h': volume_24h,
|
| 366 |
-
'dollar_volume': dollar_volume,
|
| 367 |
-
'price_change_24h': price_change_24h,
|
| 368 |
-
'high_24h': high_24h,
|
| 369 |
-
'low_24h': low_24h,
|
| 370 |
-
'layer1_score': layer1_score,
|
| 371 |
-
'reasons': self._generate_fast_reasons(dollar_volume, price_change_24h)
|
| 372 |
-
}
|
| 373 |
-
|
| 374 |
-
return candidate_data
|
| 375 |
-
else:
|
| 376 |
-
return None
|
| 377 |
-
|
| 378 |
-
except (asyncio.TimeoutError, Exception) as e:
|
| 379 |
-
# تجاهل الأخطاء والمتابعة
|
| 380 |
-
return None
|
| 381 |
|
| 382 |
-
def
|
| 383 |
-
"""
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
|
| 393 |
-
def
|
| 394 |
-
"""حساب
|
| 395 |
-
|
| 396 |
-
|
| 397 |
|
| 398 |
-
|
| 399 |
-
if price_change >= 10: # تخفيف من 15 إلى 10
|
| 400 |
-
momentum_score = 0.9
|
| 401 |
-
elif price_change >= 5: # تخفيف من 8 إلى 5
|
| 402 |
-
momentum_score = 0.7
|
| 403 |
-
elif price_change >= 2: # تخفيف من 3 إلى 2
|
| 404 |
-
momentum_score = 0.5
|
| 405 |
-
elif price_change <= -10: # تخفيف من -15 إلى -10
|
| 406 |
-
momentum_score = 0.8 # فرصة شراء في الانخفاض
|
| 407 |
-
elif price_change <= -5: # تخفيف من -8 إلى -5
|
| 408 |
-
momentum_score = 0.6
|
| 409 |
-
elif price_change <= -2: # تخفيف من -3 إلى -2
|
| 410 |
-
momentum_score = 0.4
|
| 411 |
-
else:
|
| 412 |
-
momentum_score = 0.3
|
| 413 |
|
| 414 |
-
#
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
position_score = 0.8
|
| 419 |
-
elif position > 0.8: # كان 0.7
|
| 420 |
-
position_score = 0.6
|
| 421 |
-
else:
|
| 422 |
-
position_score = 0.5
|
| 423 |
else:
|
| 424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
|
| 426 |
-
#
|
| 427 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 428 |
|
| 429 |
-
def
|
| 430 |
-
|
|
|
|
| 431 |
reasons = []
|
| 432 |
|
| 433 |
-
if
|
| 434 |
-
reasons.append('
|
| 435 |
-
elif
|
| 436 |
-
reasons.append('high_volume')
|
| 437 |
-
else:
|
| 438 |
reasons.append('good_liquidity')
|
| 439 |
|
| 440 |
if price_change >= 5: # تخفيف من 8 إلى 5
|
|
@@ -446,88 +408,84 @@ class DataManager:
|
|
| 446 |
elif price_change <= -2: # تخفيف من -3 إلى -2
|
| 447 |
reasons.append('dip_opportunity')
|
| 448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 449 |
return reasons
|
| 450 |
|
| 451 |
async def get_ohlcv_data_for_symbols(self, symbols: List[str]) -> List[Dict[str, Any]]:
|
| 452 |
"""
|
| 453 |
-
جلب بيانات OHLCV كاملة للرموز المحددة
|
|
|
|
| 454 |
"""
|
| 455 |
results = []
|
| 456 |
|
| 457 |
print(f"📊 جلب بيانات OHLCV لـ {len(symbols)} عملة...")
|
| 458 |
|
| 459 |
-
# استخدام المهام المتوازية لجلب ا��بيانات مع إعادة المحاولة
|
| 460 |
-
tasks = []
|
| 461 |
for symbol in symbols:
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
continue
|
| 471 |
-
results.append(result)
|
| 472 |
-
|
| 473 |
-
print(f"✅ تم تجميع بيانات OHLCV لـ {len(results)} عملة من أصل {len(symbols)}")
|
| 474 |
-
|
| 475 |
-
if len(results) < len(symbols):
|
| 476 |
-
print(f"⚠️ فشل جلب بيانات {len(symbols) - len(results)} عملة")
|
| 477 |
|
|
|
|
| 478 |
return results
|
| 479 |
|
| 480 |
-
async def
|
| 481 |
-
"""جلب بيانات OHLCV
|
| 482 |
-
for attempt in range(max_retries):
|
| 483 |
-
try:
|
| 484 |
-
result = await self._fetch_ohlcv_for_symbol(symbol)
|
| 485 |
-
if result:
|
| 486 |
-
return result
|
| 487 |
-
else:
|
| 488 |
-
await asyncio.sleep(1) # انتظار قبل إعادة المحاولة
|
| 489 |
-
except Exception as e:
|
| 490 |
-
if attempt < max_retries - 1:
|
| 491 |
-
await asyncio.sleep(1)
|
| 492 |
-
continue
|
| 493 |
-
else:
|
| 494 |
-
print(f"❌ فشل جلب بيانات {symbol} بعد {max_retries} محاولات: {e}")
|
| 495 |
-
return None
|
| 496 |
-
|
| 497 |
-
async def _fetch_ohlcv_for_symbol(self, symbol: str):
|
| 498 |
-
"""جلب بيانات OHLCV لرمز واحد"""
|
| 499 |
try:
|
| 500 |
ohlcv_data = {}
|
| 501 |
-
|
|
|
|
| 502 |
timeframes = [
|
| 503 |
-
('1h', 50), #
|
| 504 |
-
('4h',
|
| 505 |
-
('1d',
|
| 506 |
]
|
| 507 |
|
| 508 |
has_sufficient_data = True
|
|
|
|
| 509 |
for timeframe, limit in timeframes:
|
| 510 |
try:
|
|
|
|
| 511 |
ohlcv = await asyncio.wait_for(
|
| 512 |
self.exchange.fetch_ohlcv(symbol, timeframe, limit=limit),
|
| 513 |
-
timeout=
|
| 514 |
)
|
| 515 |
-
|
|
|
|
| 516 |
ohlcv_data[timeframe] = ohlcv
|
| 517 |
else:
|
|
|
|
| 518 |
has_sufficient_data = False
|
| 519 |
break
|
| 520 |
-
|
| 521 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 522 |
has_sufficient_data = False
|
| 523 |
break
|
| 524 |
|
| 525 |
-
if has_sufficient_data and ohlcv_data:
|
| 526 |
-
#
|
| 527 |
try:
|
| 528 |
ticker = await asyncio.wait_for(
|
| 529 |
self.exchange.fetch_ticker(symbol),
|
| 530 |
-
timeout=
|
| 531 |
)
|
| 532 |
current_price = ticker.get('last', 0) if ticker else 0
|
| 533 |
|
|
@@ -538,13 +496,13 @@ class DataManager:
|
|
| 538 |
'timestamp': datetime.now().isoformat()
|
| 539 |
}
|
| 540 |
except Exception as price_error:
|
| 541 |
-
print(f"⚠️ خطأ في جلب السعر لـ {symbol}: {price_error}")
|
| 542 |
return None
|
| 543 |
else:
|
| 544 |
return None
|
| 545 |
|
| 546 |
-
except Exception as
|
| 547 |
-
print(f"
|
| 548 |
return None
|
| 549 |
|
| 550 |
async def get_latest_price_async(self, symbol):
|
|
@@ -553,10 +511,7 @@ class DataManager:
|
|
| 553 |
if not self.exchange:
|
| 554 |
return None
|
| 555 |
|
| 556 |
-
ticker = await
|
| 557 |
-
self.exchange.fetch_ticker(symbol),
|
| 558 |
-
timeout=5
|
| 559 |
-
)
|
| 560 |
current_price = ticker.get('last')
|
| 561 |
|
| 562 |
if current_price:
|
|
@@ -565,6 +520,7 @@ class DataManager:
|
|
| 565 |
return None
|
| 566 |
|
| 567 |
except Exception as e:
|
|
|
|
| 568 |
return None
|
| 569 |
|
| 570 |
async def get_available_symbols(self):
|
|
@@ -602,10 +558,4 @@ class DataManager:
|
|
| 602 |
print(f"❌ خطأ في التحقق من الرمز {symbol}: {e}")
|
| 603 |
return False
|
| 604 |
|
| 605 |
-
|
| 606 |
-
"""مسح الذاكرة المؤقتة"""
|
| 607 |
-
self.symbol_cache.clear()
|
| 608 |
-
self.cache_timestamp.clear()
|
| 609 |
-
print("✅ تم مسح الذاكرة المؤقتة")
|
| 610 |
-
|
| 611 |
-
print("✅ DataManager loaded - Optimized for high performance screening")
|
|
|
|
| 9 |
import numpy as np
|
| 10 |
import logging
|
| 11 |
from typing import List, Dict, Any
|
|
|
|
| 12 |
|
| 13 |
logging.getLogger("httpx").setLevel(logging.WARNING)
|
| 14 |
logging.getLogger("httpcore").setLevel(logging.WARNING)
|
|
|
|
| 19 |
self.whale_monitor = whale_monitor
|
| 20 |
|
| 21 |
# إعدادات الأداء المحسنة
|
| 22 |
+
self.batch_size = 50 # تخفيض حجم الدفعة لتجنب rate limits
|
| 23 |
+
self.cache_duration = 300
|
|
|
|
| 24 |
|
| 25 |
try:
|
| 26 |
self.exchange = ccxt.kucoin({
|
| 27 |
'sandbox': False,
|
| 28 |
'enableRateLimit': True,
|
| 29 |
+
'timeout': 30000, # زيادة المهلة
|
| 30 |
+
'verbose': False,
|
| 31 |
+
'rateLimit': 1000, # زيادة معدل الطلبات
|
| 32 |
})
|
|
|
|
| 33 |
print("✅ تم تهيئة اتصال KuCoin بنجاح")
|
| 34 |
except Exception as e:
|
| 35 |
print(f"❌ فشل تهيئة اتصال KuCoin: {e}")
|
|
|
|
| 42 |
self.cache_timestamp = {}
|
| 43 |
|
| 44 |
async def initialize(self):
|
| 45 |
+
self.http_client = httpx.AsyncClient(timeout=30.0)
|
| 46 |
await self._load_markets()
|
| 47 |
+
print("✅ DataManager initialized - Optimized for OHLCV data retrieval")
|
| 48 |
|
| 49 |
async def _load_markets(self):
|
| 50 |
try:
|
|
|
|
| 69 |
async def get_market_context_async(self):
|
| 70 |
"""جلب سياق السوق الأساسي فقط"""
|
| 71 |
try:
|
| 72 |
+
sentiment_data = await self.get_sentiment_safe_async()
|
| 73 |
+
price_data = await self._get_prices_with_fallback()
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
bitcoin_price = price_data.get('bitcoin')
|
| 76 |
ethereum_price = price_data.get('ethereum')
|
|
|
|
| 95 |
async def get_sentiment_safe_async(self):
|
| 96 |
"""جلب بيانات المشاعر"""
|
| 97 |
try:
|
| 98 |
+
async with httpx.AsyncClient(timeout=10) as client:
|
| 99 |
response = await client.get("https://api.alternative.me/fng/")
|
| 100 |
response.raise_for_status()
|
| 101 |
data = response.json()
|
|
|
|
| 115 |
return None
|
| 116 |
|
| 117 |
def _determine_market_trend(self, bitcoin_price, sentiment_data):
|
| 118 |
+
"""تحديد اتجاه السوق"""
|
| 119 |
if bitcoin_price is None:
|
| 120 |
return "UNKNOWN"
|
| 121 |
|
| 122 |
+
score = 0
|
| 123 |
if bitcoin_price > 60000:
|
| 124 |
+
score += 1
|
| 125 |
elif bitcoin_price < 55000:
|
| 126 |
+
score -= 1
|
| 127 |
+
|
| 128 |
+
if sentiment_data and sentiment_data.get('feargreed_value') is not None:
|
| 129 |
+
fear_greed = sentiment_data.get('feargreed_value')
|
| 130 |
+
if fear_greed > 60:
|
| 131 |
+
score += 1
|
| 132 |
+
elif fear_greed < 40:
|
| 133 |
+
score -= 1
|
| 134 |
+
|
| 135 |
+
if score >= 1:
|
| 136 |
+
return "bull_market"
|
| 137 |
+
elif score <= -1:
|
| 138 |
return "bear_market"
|
| 139 |
else:
|
| 140 |
return "sideways_market"
|
|
|
|
| 152 |
async def _get_prices_with_fallback(self):
|
| 153 |
"""جلب أسعار البيتكوين والإيثيريوم"""
|
| 154 |
try:
|
|
|
|
| 155 |
prices = await self._get_prices_from_kucoin_safe()
|
| 156 |
if prices.get('bitcoin') and prices.get('ethereum'):
|
| 157 |
return prices
|
| 158 |
+
return await self._get_prices_from_coingecko()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
except Exception as e:
|
| 160 |
print(f"❌ فشل جلب الأسعار: {e}")
|
| 161 |
return {'bitcoin': None, 'ethereum': None}
|
|
|
|
| 165 |
return {'bitcoin': None, 'ethereum': None}
|
| 166 |
|
| 167 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
prices = {'bitcoin': None, 'ethereum': None}
|
| 169 |
|
| 170 |
+
btc_ticker = await self.exchange.fetch_ticker('BTC/USDT')
|
| 171 |
+
btc_price = float(btc_ticker.get('last', 0)) if btc_ticker.get('last') else None
|
| 172 |
+
if btc_price and btc_price > 0:
|
| 173 |
+
prices['bitcoin'] = btc_price
|
| 174 |
|
| 175 |
+
eth_ticker = await self.exchange.fetch_ticker('ETH/USDT')
|
| 176 |
+
eth_price = float(eth_ticker.get('last', 0)) if eth_ticker.get('last') else None
|
| 177 |
+
if eth_price and eth_price > 0:
|
| 178 |
+
prices['ethereum'] = eth_price
|
| 179 |
|
| 180 |
return prices
|
| 181 |
|
|
|
|
| 186 |
async def _get_prices_from_coingecko(self):
|
| 187 |
"""الاحتياطي: جلب الأسعار من CoinGecko"""
|
| 188 |
try:
|
| 189 |
+
await asyncio.sleep(0.5)
|
| 190 |
url = "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd"
|
| 191 |
async with httpx.AsyncClient() as client:
|
| 192 |
+
response = await client.get(url, timeout=10)
|
| 193 |
response.raise_for_status()
|
| 194 |
data = response.json()
|
| 195 |
|
|
|
|
| 205 |
print(f"❌ فشل جلب الأسعار من CoinGecko: {e}")
|
| 206 |
return {'bitcoin': None, 'ethereum': None}
|
| 207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
def _get_minimal_market_context(self):
|
| 209 |
"""سياق سوق بدائي عند الفشل"""
|
| 210 |
return {
|
|
|
|
| 217 |
|
| 218 |
async def layer1_rapid_screening(self) -> List[Dict[str, Any]]:
|
| 219 |
"""
|
| 220 |
+
الطبقة 1: فحص سريع لجميع عملات KuCoin
|
| 221 |
+
يركز فقط على جلب البيانات الأساسية بدون تحليل متقدم
|
| 222 |
"""
|
| 223 |
candidates = []
|
| 224 |
|
|
|
|
| 228 |
if symbol.endswith('/USDT') and self.market_cache[symbol].get('active', False)
|
| 229 |
]
|
| 230 |
|
| 231 |
+
print(f"📊 الطبقة 1: فحص سريع لـ {len(usdt_symbols)} عملة في KuCoin...")
|
| 232 |
|
| 233 |
+
batch_size = 20 # تخفيض حجم الدفعة لتجنب rate limits
|
| 234 |
+
for i in range(0, len(usdt_symbols), batch_size):
|
| 235 |
+
batch = usdt_symbols[i:i + batch_size]
|
| 236 |
+
print(f" 🔍 معالجة مجموعة {i//batch_size + 1}/{(len(usdt_symbols)//batch_size)+1}...")
|
| 237 |
|
| 238 |
+
batch_candidates = await self._process_batch_rapid_screening(batch)
|
| 239 |
candidates.extend(batch_candidates)
|
| 240 |
|
| 241 |
+
await asyncio.sleep(1) # زيادة وقت الانتظار بين الدفعات
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
|
| 243 |
# ترتيب المرشحين حسب قوة الأساسيات
|
| 244 |
candidates.sort(key=lambda x: x.get('layer1_score', 0), reverse=True)
|
| 245 |
|
| 246 |
+
# نأخذ أفضل 50-100 مرشح للطبقة 2
|
| 247 |
+
target_count = min(max(50, len(candidates) // 3), 100, len(candidates))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
final_candidates = candidates[:target_count]
|
| 249 |
|
| 250 |
+
print(f"✅ تم اختيار {len(final_candidates)} عملة من الطبقة 1")
|
| 251 |
|
| 252 |
# عرض أفضل 10 مرشحين
|
| 253 |
print(" 🏆 أفضل 10 مرشحين من الطبقة 1:")
|
|
|
|
| 259 |
|
| 260 |
return final_candidates
|
| 261 |
|
| 262 |
+
async def _process_batch_rapid_screening(self, symbols_batch: List[str]) -> List[Dict[str, Any]]:
|
| 263 |
+
"""معالجة دفعة من الرموز في الطبقة 1"""
|
| 264 |
candidates = []
|
| 265 |
|
|
|
|
|
|
|
| 266 |
for symbol in symbols_batch:
|
| 267 |
+
try:
|
| 268 |
+
# جلب بيانات التداول الأساسية فقط
|
| 269 |
+
ticker = await self.exchange.fetch_ticker(symbol)
|
| 270 |
+
if not ticker:
|
| 271 |
+
continue
|
| 272 |
+
|
| 273 |
+
current_price = ticker.get('last', 0)
|
| 274 |
+
volume_24h = ticker.get('baseVolume', 0)
|
| 275 |
+
dollar_volume = volume_24h * current_price
|
| 276 |
+
price_change_24h = ticker.get('percentage', 0)
|
| 277 |
+
high_24h = ticker.get('high', 0)
|
| 278 |
+
low_24h = ticker.get('low', 0)
|
| 279 |
+
|
| 280 |
+
# المعايير الأساسية المطلوبة - تخفيف الشروط
|
| 281 |
+
meets_criteria = all([
|
| 282 |
+
dollar_volume >= 500000, # تخفيف من 1M إلى 500K دولار
|
| 283 |
+
current_price > 0.00000001, # أي سعر مقبول
|
| 284 |
+
current_price <= 100000, # حد أقصى معقول
|
| 285 |
+
high_24h > 0, # بيانات سعر صالحة
|
| 286 |
+
low_24h > 0
|
| 287 |
+
])
|
| 288 |
+
|
| 289 |
+
if not meets_criteria:
|
| 290 |
+
continue
|
| 291 |
+
|
| 292 |
+
# حساب مؤشرات أساسية بسيطة فقط
|
| 293 |
+
volume_strength = self._calculate_volume_strength(dollar_volume)
|
| 294 |
+
price_momentum = self._calculate_price_momentum(price_change_24h)
|
| 295 |
+
price_position = self._calculate_price_position(current_price, high_24h, low_24h)
|
| 296 |
+
volatility = self._calculate_volatility(high_24h, low_24h, current_price)
|
| 297 |
+
|
| 298 |
+
# الدرجة النهائية للطبقة 1 (أساسيات فقط)
|
| 299 |
+
layer1_score = (
|
| 300 |
+
volume_strength * 0.35 +
|
| 301 |
+
price_momentum * 0.30 +
|
| 302 |
+
price_position * 0.20 +
|
| 303 |
+
volatility * 0.15
|
| 304 |
+
)
|
| 305 |
+
|
| 306 |
+
if layer1_score >= 0.2: # تخفيف من 0.3 إلى 0.2
|
| 307 |
+
candidate_data = {
|
| 308 |
+
'symbol': symbol,
|
| 309 |
+
'current_price': current_price,
|
| 310 |
+
'volume_24h': volume_24h,
|
| 311 |
+
'dollar_volume': dollar_volume,
|
| 312 |
+
'price_change_24h': price_change_24h,
|
| 313 |
+
'high_24h': high_24h,
|
| 314 |
+
'low_24h': low_24h,
|
| 315 |
+
'layer1_score': layer1_score,
|
| 316 |
+
'volume_strength': volume_strength,
|
| 317 |
+
'price_momentum': price_momentum,
|
| 318 |
+
'reasons': self._generate_layer1_reasons(volume_strength, price_momentum, dollar_volume, price_change_24h)
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
candidates.append(candidate_data)
|
| 322 |
+
|
| 323 |
+
except Exception as e:
|
| 324 |
+
if "rate limit" not in str(e).lower():
|
| 325 |
+
continue
|
| 326 |
+
await asyncio.sleep(2) # انتظار في حالة rate limit
|
| 327 |
|
| 328 |
return candidates
|
| 329 |
|
| 330 |
+
def _calculate_volume_strength(self, dollar_volume: float) -> float:
|
| 331 |
+
"""حساب قوة الحجم (بيانات فقط)"""
|
| 332 |
+
if dollar_volume >= 5000000: # تخفيف من 10M إلى 5M
|
| 333 |
+
return 1.0
|
| 334 |
+
elif dollar_volume >= 2000000: # تخفيف من 5M إلى 2M
|
| 335 |
+
return 0.8
|
| 336 |
+
elif dollar_volume >= 1000000: # تخفيف من 2M إلى 1M
|
| 337 |
+
return 0.6
|
| 338 |
+
elif dollar_volume >= 500000: # تخفيف من 1M إلى 500K
|
| 339 |
+
return 0.4
|
| 340 |
+
else:
|
| 341 |
+
return 0.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
|
| 343 |
+
def _calculate_price_momentum(self, price_change_24h: float) -> float:
|
| 344 |
+
"""حساب زخم السعر (بيانات فقط)"""
|
| 345 |
+
if price_change_24h >= 10: # تخفيف من 15 إلى 10
|
| 346 |
+
return 0.9
|
| 347 |
+
elif price_change_24h >= 5: # تخفيف من 8 إلى 5
|
| 348 |
+
return 0.7
|
| 349 |
+
elif price_change_24h >= 2: # تخفيف م�� 3 إلى 2
|
| 350 |
+
return 0.5
|
| 351 |
+
elif price_change_24h <= -10: # تخفيف من -15 إلى -10
|
| 352 |
+
return 0.8
|
| 353 |
+
elif price_change_24h <= -5: # تخفيف من -8 إلى -5
|
| 354 |
+
return 0.6
|
| 355 |
+
elif price_change_24h <= -2: # تخفيف من -3 إلى -2
|
| 356 |
+
return 0.4
|
| 357 |
+
else:
|
| 358 |
+
return 0.3
|
| 359 |
|
| 360 |
+
def _calculate_price_position(self, current_price: float, high_24h: float, low_24h: float) -> float:
|
| 361 |
+
"""حساب موقع السعر (بيانات فقط)"""
|
| 362 |
+
if high_24h == low_24h:
|
| 363 |
+
return 0.5
|
| 364 |
|
| 365 |
+
position = (current_price - low_24h) / (high_24h - low_24h)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
|
| 367 |
+
if position < 0.2: # تخفيف من 0.3 إلى 0.2
|
| 368 |
+
return 0.8
|
| 369 |
+
elif position > 0.8: # تخفيف من 0.7 إلى 0.8
|
| 370 |
+
return 0.6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 371 |
else:
|
| 372 |
+
return 0.5
|
| 373 |
+
|
| 374 |
+
def _calculate_volatility(self, high_24h: float, low_24h: float, current_price: float) -> float:
|
| 375 |
+
"""حساب التقلب (بيانات فقط)"""
|
| 376 |
+
if current_price == 0:
|
| 377 |
+
return 0.5
|
| 378 |
+
|
| 379 |
+
volatility = (high_24h - low_24h) / current_price
|
| 380 |
|
| 381 |
+
if volatility > 0.3: # تخفيف من 0.5 إلى 0.3
|
| 382 |
+
return 0.2
|
| 383 |
+
elif volatility > 0.15: # تخفيف من 0.2 إلى 0.15
|
| 384 |
+
return 0.4
|
| 385 |
+
elif volatility > 0.08: # تخفيف من 0.1 إلى 0.08
|
| 386 |
+
return 0.8
|
| 387 |
+
elif volatility > 0.04: # تخفيف من 0.05 إلى 0.04
|
| 388 |
+
return 0.6
|
| 389 |
+
else:
|
| 390 |
+
return 0.3
|
| 391 |
|
| 392 |
+
def _generate_layer1_reasons(self, volume_strength: float, price_momentum: float,
|
| 393 |
+
dollar_volume: float, price_change: float) -> List[str]:
|
| 394 |
+
"""توليد أسباب الترشيح بناءً على البيانات فقط"""
|
| 395 |
reasons = []
|
| 396 |
|
| 397 |
+
if volume_strength >= 0.6:
|
| 398 |
+
reasons.append('high_liquidity')
|
| 399 |
+
elif volume_strength >= 0.4:
|
|
|
|
|
|
|
| 400 |
reasons.append('good_liquidity')
|
| 401 |
|
| 402 |
if price_change >= 5: # تخفيف من 8 إلى 5
|
|
|
|
| 408 |
elif price_change <= -2: # تخفيف من -3 إلى -2
|
| 409 |
reasons.append('dip_opportunity')
|
| 410 |
|
| 411 |
+
if dollar_volume >= 2000000: # تخفيف من 5M إلى 2M
|
| 412 |
+
reasons.append('very_high_volume')
|
| 413 |
+
elif dollar_volume >= 1000000: # تخفيف من 2M إلى 1M
|
| 414 |
+
reasons.append('high_volume')
|
| 415 |
+
|
| 416 |
return reasons
|
| 417 |
|
| 418 |
async def get_ohlcv_data_for_symbols(self, symbols: List[str]) -> List[Dict[str, Any]]:
|
| 419 |
"""
|
| 420 |
+
جلب بيانات OHLCV كاملة للرموز المحددة
|
| 421 |
+
يستخدم في الطبقة 2 للتحليل المتقدم
|
| 422 |
"""
|
| 423 |
results = []
|
| 424 |
|
| 425 |
print(f"📊 جلب بيانات OHLCV لـ {len(symbols)} عملة...")
|
| 426 |
|
|
|
|
|
|
|
| 427 |
for symbol in symbols:
|
| 428 |
+
try:
|
| 429 |
+
ohlcv_data = await self._fetch_ohlcv_for_symbol_safe(symbol)
|
| 430 |
+
if ohlcv_data:
|
| 431 |
+
results.append(ohlcv_data)
|
| 432 |
+
print(f" ✅ تم جلب بيانات {symbol}")
|
| 433 |
+
else:
|
| 434 |
+
print(f" ❌ فشل جلب بيانات {symbol}")
|
| 435 |
+
|
| 436 |
+
await asyncio.sleep(0.5) # زيادة وقت الانتظار بين الطلبات
|
| 437 |
+
|
| 438 |
+
except Exception as symbol_error:
|
| 439 |
+
print(f"❌ خطأ في جلب بيانات {symbol}: {symbol_error}")
|
| 440 |
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
|
| 442 |
+
print(f"✅ تم تجميع بيانات OHLCV لـ {len(results)} عملة")
|
| 443 |
return results
|
| 444 |
|
| 445 |
+
async def _fetch_ohlcv_for_symbol_safe(self, symbol: str) -> Dict[str, Any]:
|
| 446 |
+
"""جلب بيانات OHLCV لرمز واحد بشكل آمن"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
try:
|
| 448 |
ohlcv_data = {}
|
| 449 |
+
|
| 450 |
+
# استخدام إطارات زمنية أساسية فقط لتقليل الطلبات
|
| 451 |
timeframes = [
|
| 452 |
+
('1h', 50), # ساعة واحدة - أساسي
|
| 453 |
+
('4h', 25), # 4 ساعات
|
| 454 |
+
('1d', 30), # يومي
|
| 455 |
]
|
| 456 |
|
| 457 |
has_sufficient_data = True
|
| 458 |
+
|
| 459 |
for timeframe, limit in timeframes:
|
| 460 |
try:
|
| 461 |
+
# زيادة المهلة وجعل الطلبات أكثر موثوقية
|
| 462 |
ohlcv = await asyncio.wait_for(
|
| 463 |
self.exchange.fetch_ohlcv(symbol, timeframe, limit=limit),
|
| 464 |
+
timeout=15 # زيادة المهلة
|
| 465 |
)
|
| 466 |
+
|
| 467 |
+
if ohlcv and len(ohlcv) >= 10: # تخفيف الحد الأدنى
|
| 468 |
ohlcv_data[timeframe] = ohlcv
|
| 469 |
else:
|
| 470 |
+
print(f" ⚠️ بيانات غير كافية لـ {symbol} على الإطار {timeframe}")
|
| 471 |
has_sufficient_data = False
|
| 472 |
break
|
| 473 |
+
|
| 474 |
+
except asyncio.TimeoutError:
|
| 475 |
+
print(f" ⏰ مهلة جلب بيانات {symbol} على الإطار {timeframe}")
|
| 476 |
+
has_sufficient_data = False
|
| 477 |
+
break
|
| 478 |
+
except Exception as e:
|
| 479 |
+
print(f" ⚠️ خطأ في جلب بيانات {symbol} على الإطار {timeframe}: {e}")
|
| 480 |
has_sufficient_data = False
|
| 481 |
break
|
| 482 |
|
| 483 |
+
if has_sufficient_data and ohlcv_data:
|
| 484 |
+
# الحصول على بيانات التداول الحالية
|
| 485 |
try:
|
| 486 |
ticker = await asyncio.wait_for(
|
| 487 |
self.exchange.fetch_ticker(symbol),
|
| 488 |
+
timeout=10
|
| 489 |
)
|
| 490 |
current_price = ticker.get('last', 0) if ticker else 0
|
| 491 |
|
|
|
|
| 496 |
'timestamp': datetime.now().isoformat()
|
| 497 |
}
|
| 498 |
except Exception as price_error:
|
| 499 |
+
print(f" ⚠️ خطأ في جلب السعر لـ {symbol}: {price_error}")
|
| 500 |
return None
|
| 501 |
else:
|
| 502 |
return None
|
| 503 |
|
| 504 |
+
except Exception as e:
|
| 505 |
+
print(f" ❌ خطأ عام في جلب بيانات {symbol}: {e}")
|
| 506 |
return None
|
| 507 |
|
| 508 |
async def get_latest_price_async(self, symbol):
|
|
|
|
| 511 |
if not self.exchange:
|
| 512 |
return None
|
| 513 |
|
| 514 |
+
ticker = await self.exchange.fetch_ticker(symbol)
|
|
|
|
|
|
|
|
|
|
| 515 |
current_price = ticker.get('last')
|
| 516 |
|
| 517 |
if current_price:
|
|
|
|
| 520 |
return None
|
| 521 |
|
| 522 |
except Exception as e:
|
| 523 |
+
print(f"❌ خطأ في جلب السعر لـ {symbol}: {e}")
|
| 524 |
return None
|
| 525 |
|
| 526 |
async def get_available_symbols(self):
|
|
|
|
| 558 |
print(f"❌ خطأ في التحقق من الرمز {symbol}: {e}")
|
| 559 |
return False
|
| 560 |
|
| 561 |
+
print("✅ DataManager loaded - Optimized for OHLCV data retrieval")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|