﻿# Telegram Signals Handoff

Workspace branch source: C:\python_scripts\top_1_telegram_signals
Target channel: https://t.me/darkknighttrade

Important: secrets are intentionally NOT included. The real .env is in C:\python_scripts\top_1\.env on the local machine.

What was tested locally:
- telethon installed with: python -m pip install --user telethon
- TG_API_ID/TG_API_HASH/TG_CHANNEL/TG_SESSION/TG_SIGNAL_OUT exist in C:\python_scripts\top_1\.env
- Bot token authorizes as top_TPI_bot, but Telegram rejects get_messages for bot users with BotMethodInvalidError.
- User session is not authorized yet.
- send_code_request(+380676899784) succeeded and returned delivery_type SentCodeTypeApp, meaning Telegram sent the code to an existing Telegram app session, not SMS.

Useful commands after user session is authorized:

python obw_platform\telegram_signal_tools\fetch_telegram_channel_signals.py --env-file C:\python_scripts\top_1\.env --channel https://t.me/darkknighttrade --limit 500
python obw_platform\telegram_signal_tools\validate_telegram_signal_quality.py --signals runs\telegram_paper\darkknighttrade_signals.jsonl
python obw_platform\telegram_signal_tools\normalize_telegram_signal_jsonl.py --jsonl runs\telegram_paper\darkknighttrade_signals.jsonl --out-csv telegram_signal_standard_bt\telegram_signals_paper.csv

Relevant files:
- obw_platform/telegram_signal_tools/authorize_telegram_session.py
- obw_platform/telegram_signal_tools/telegram_signal_listener_paper.py
- obw_platform/telegram_signal_tools/fetch_telegram_channel_signals.py
- obw_platform/telegram_signal_tools/telegram_signal_schema.py
- obw_platform/telegram_signal_tools/validate_telegram_signal_quality.py
- obw_platform/telegram_signal_tools/normalize_telegram_signal_jsonl.py
- docs/TELEGRAM_SIGNAL_DATA_BUNDLE_README.md
- telegram_standard_bt_bundle/INSTALL_AND_RUN.md

Login/debug command added for server authorization:

python obw_platform/telegram_signal_tools/authorize_telegram_session.py --env-file C:\python_scripts\top_1\.env --send-only

If code delivery does not appear from the server IP, set TG_PROXY to another route and install PySocks:

python -m pip install pysocks
set TG_PROXY=socks5://USER:PASS@HOST:PORT
python obw_platform/telegram_signal_tools/authorize_telegram_session.py --env-file C:\python_scripts\top_1\.env

On Linux use `export TG_PROXY=...` instead of `set TG_PROXY=...`.
