forked from atilaahmettaner/tradingview-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinal_nasdaq_test.py
More file actions
53 lines (42 loc) Β· 1.7 KB
/
final_nasdaq_test.py
File metadata and controls
53 lines (42 loc) Β· 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
"""Final NASDAQ test"""
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
print("π Testing NASDAQ with MCP server...")
# Test coin_analysis directly
try:
from src.tradingview_mcp.server import coin_analysis
print("\nπ Testing AAPL analysis...")
result = coin_analysis(symbol="AAPL", exchange="NASDAQ", timeframe="1D")
if "error" in result:
print(f"β Error: {result['error']}")
else:
print(f"β
Success!")
print(f" Symbol: {result.get('symbol', 'N/A')}")
price = result.get('price_data', {}).get('current_price')
change = result.get('price_data', {}).get('change_percent')
print(f" Price: ${price} ({change:+.2f}%)" if price and change else " Price: N/A")
bbw = result.get('bollinger_analysis', {}).get('bbw')
print(f" BBW: {bbw}" if bbw else " BBW: N/A")
except Exception as e:
print(f"β Analysis failed: {e}")
import traceback
traceback.print_exc()
# Test top_gainers
try:
print("\nπ Testing NASDAQ top gainers...")
from src.tradingview_mcp.server import top_gainers
result = top_gainers(exchange="NASDAQ", limit=3)
if "error" in result:
print(f"β Error: {result['error']}")
else:
symbols = result.get('symbols', [])
print(f"β
Found {len(symbols)} gainers")
for i, symbol in enumerate(symbols[:3], 1):
name = symbol.get('symbol', 'N/A')
change = symbol.get('changePercent', 0)
print(f" {i}. {name}: {change:+.2f}%")
except Exception as e:
print(f"β Top gainers failed: {e}")
print("\nπ Test completed!")