Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BTC Technical Analysis Agent

Automated technical analysis agent for BTC/USDT that sends Telegram alerts on high-conviction signals and optionally executes trades on Polymarket.

Architecture

┌──────────────┐    ┌─────────────────┐    ┌──────────────────┐
│ Binance API  │───▶│ Indicator       │───▶│ Multi-TF Scorer  │
│ (1h + 4h)    │    │ Engine          │    │ (-1.0 ... +1.0)  │
└──────────────┘    └─────────────────┘    └────────┬─────────┘
                                                    │
                                       ┌────────────┴────────────┐
                                       │                         │
                              score ≥ 0.55                 score ≥ 0.75
                              + cooldown                   + ADX ≥ 25
                                       │                         │
                                       ▼                         ▼
                              ┌─────────────┐          ┌────────────────┐
                              │  Telegram   │          │   Polymarket   │
                              │   Alert     │          │   CLOB Order   │
                              └─────────────┘          └────────────────┘

Indicators

Indicator Period Role
EMA 50/200 Trend direction + Golden/Death cross
RSI 14 Momentum, overbought/oversold zones
MACD 12/26/9 Momentum confirmation + crossovers
Bollinger Bands 20, 2σ Volatility & mean reversion
ADX 14 Trend strength gate (filters chop)
OBV smoothed Volume confirmation / divergence
ATR 14 Volatility (used for risk sizing)

Each indicator outputs a score in [-1, +1]. The aggregate is a weighted average; multi-timeframe agreement adds a confirmation bonus.

Local development

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

cp .env.example .env
# Fill in secrets

python -m pytest tests/ -v       # run sanity tests
python run_once.py                # one analysis cycle
python main.py                    # run the scheduler

Telegram setup

  1. Open Telegram, search for @BotFather, send /newbot, follow prompts.
  2. Save the bot token in .env as TELEGRAM_BOT_TOKEN.
  3. Send any message to your new bot, then visit https://api.telegram.org/bot<TOKEN>/getUpdates and copy the chat.id value into .env as TELEGRAM_CHAT_ID.

Polymarket setup

  1. Create a dedicated wallet (MetaMask or similar). Never reuse your main one.
  2. Fund it with a small amount of MATIC (gas) and USDC.e on the Polygon network.
  3. Export the private key and put it in .env as POLYMARKET_PRIVATE_KEY.
  4. (Optional but recommended) Generate API credentials via the py-clob-client create_api_key() flow and store them in .env.
  5. Keep polymarket.dry_run: true in config.yaml until you have observed at least 1 week of correct dry-run behavior.

VPS deployment (Ubuntu 22.04+)

A 1 vCPU / 1 GB RAM VPS is plenty (Hetzner CX11, DigitalOcean basic, etc.).

# On your laptop
rsync -av --exclude=venv --exclude=.git --exclude='__pycache__' \
  ./ user@your-vps:/tmp/btc_agent/

# On the VPS
ssh user@your-vps
sudo mv /tmp/btc_agent /opt/
cd /opt/btc_agent
sudo bash deploy/install.sh

# After install:
sudo nano /opt/btc_agent/.env       # fill in secrets
sudo chown btcagent:btcagent /opt/btc_agent/.env
sudo chmod 600 /opt/btc_agent/.env

# Smoke test
sudo -u btcagent /opt/btc_agent/venv/bin/python /opt/btc_agent/run_once.py

# Start
sudo systemctl start btc-agent
sudo systemctl status btc-agent
sudo journalctl -u btc-agent -f

Operational runbook

Task Command
Tail logs journalctl -u btc-agent -f
Restart systemctl restart btc-agent
Stop systemctl stop btc-agent
Update config edit config/config.yaml then restart
Update code rsync then systemctl restart btc-agent
Test alerts python run_once.py

Safety checklist before going live

  • Telegram alerts received correctly for at least 48h
  • dry_run: true for at least 1 week
  • Reviewed dry-run trade logs - markets matched correctly
  • Risk caps in config.yaml set conservatively
  • Dedicated Polymarket wallet funded with only the amount you can lose
  • .env has chmod 600 and is owned by btcagent
  • Backed up the wallet recovery phrase offline
  • Reviewed max_daily_trades and max_trade_size_usdc
  • Tested systemctl restart recovery

Disclaimer

Esto es software de investigación. No es asesoramiento financiero. Los mercados de criptomonedas y de predicción son altamente volátiles. Solo arriesga capital que puedas permitirte perder por completo.

About

BTC agent with polimarket

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages