-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_config.py
More file actions
124 lines (106 loc) · 4.03 KB
/
Copy pathinstall_config.py
File metadata and controls
124 lines (106 loc) · 4.03 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/env python3
"""
install_config.py — One-shot installer for SignalScanner v1.
Run AFTER copying the files to /Users/YOUR_USERNAME/vibe_os/signal_dashboard/.
Does:
1. Writes Telegram token + chat_id into config.yaml
2. Creates logs/ directory
3. Verifies Ollama is reachable and model is loaded
4. Does a quick ccxt connectivity test to Kraken
"""
import json
import subprocess
import sys
import time
from pathlib import Path
import requests
import yaml
TOKEN = "YOUR_TELEGRAM_BOT_TOKEN_HERE"
CHAT_ID = "YOUR_CHAT_ID_HERE"
BOT_NAME = "SignalScanner_V1_Bot"
BASE = Path("/Users/YOUR_USERNAME/vibe_os/signal_dashboard")
def step(n, msg):
print(f"\n{'='*60}\nStep {n}: {msg}\n{'='*60}")
def main():
if not BASE.exists():
print(f"❌ {BASE} does not exist. Copy the files there first.")
sys.exit(1)
# Step 1: update config.yaml
step(1, "Populating Telegram credentials in config.yaml")
cfg_path = BASE / "config.yaml"
with open(cfg_path) as f:
cfg = yaml.safe_load(f)
cfg["telegram"]["token"] = TOKEN
cfg["telegram"]["chat_id"] = CHAT_ID
cfg["telegram"]["bot_name"] = BOT_NAME
with open(cfg_path, "w") as f:
yaml.safe_dump(cfg, f, default_flow_style=False, sort_keys=False)
print(f"✅ config.yaml updated — bot: @{BOT_NAME}")
# Step 2: logs dir
step(2, "Creating logs directory")
(BASE / "logs").mkdir(exist_ok=True)
print(f"✅ {BASE / 'logs'}/ ready")
# Step 3: Ollama connectivity
step(3, "Checking Ollama")
try:
r = requests.get("http://127.0.0.1:11434/api/tags", timeout=5)
if r.status_code == 200:
models = [m["name"] for m in r.json().get("models", [])]
print(f"✅ Ollama reachable, models: {models}")
if "llama3.2:3b" not in models:
print("⚠️ llama3.2:3b not found. Run: ollama pull llama3.2:3b")
else:
print(f"⚠️ Ollama returned {r.status_code}")
except requests.exceptions.ConnectionError:
print("⚠️ Ollama not running. Start it with: ollama serve &")
except Exception as e:
print(f"⚠️ Ollama check failed: {e}")
# Step 4: Kraken connectivity
step(4, "Testing Kraken connectivity via ccxt")
try:
import ccxt
ex = ccxt.kraken({"enableRateLimit": True, "timeout": 10000})
ex.load_markets()
ticker = ex.fetch_ticker("BTC/USDT")
print(f"✅ Kraken reachable, BTC/USDT: ${ticker['last']:,.2f}")
except Exception as e:
print(f"❌ Kraken test failed: {e}")
sys.exit(1)
# Step 5: Telegram test
step(5, "Testing Telegram bot")
try:
r = requests.post(
f"https://api.telegram.org/bot{TOKEN}/sendMessage",
json={
"chat_id": CHAT_ID,
"text": "✅ SignalScanner v1 install complete. Bot ready.",
},
timeout=10,
)
if r.status_code == 200:
print(f"✅ Telegram message sent to chat {CHAT_ID}")
else:
print(f"⚠️ Telegram send returned {r.status_code}: {r.text[:200]}")
except Exception as e:
print(f"⚠️ Telegram test failed: {e}")
print(f"\n{'='*60}")
print("Install complete. Next steps:")
print(f"{'='*60}")
print("1. First test run (single pass, no infinite loop):")
print(f" cd {BASE} && python3 scanner.py --once")
print()
print("2. Start scanner as background process (terminal 1):")
print(f" cd {BASE} && python3 scanner.py")
print()
print("3. Open web dashboard (terminal 2):")
print(f" cd {BASE} && python3 web_app.py")
print(" # Then visit http://127.0.0.1:8082")
print()
print("4. Open terminal dashboard (terminal 3):")
print(f" cd {BASE} && python3 terminal_dashboard.py")
print()
print("5. Start Telegram summarizer daemon (terminal 4):")
print(f" cd {BASE} && python3 summarizer.py --daemon")
print(" # Then in Telegram, send '/summary' to @SignalScanner_V1_Bot")
if __name__ == "__main__":
main()