# Brimoza — Setup Guide

This guide is for the **easy setup (SQLite)**: no separate database server is required,
and all data is kept in a single file. For technical details, see `README.md`.

> ⚠️ **Risk:** Crypto trading is high risk; you may lose all of your money.
> This software does not guarantee profit and is not financial advice. The default mode is the safe
> **DRY_RUN** (paper money). LIVE (real money) only after you have proven your strategy.

---

## 1. Requirements
- A server/computer with **Docker** + **Docker Compose** installed (Linux/Mac/Windows).
- (Optional, for LIVE) A Binance account + API key.
- (Optional) A Telegram account (for notifications).

## 2. One-command setup
In the project folder:

```bash
./scripts/install.sh
```

This command:
1. **Automatically generates** the `.env` file (random panel password + encryption key),
2. Builds the Docker image,
3. Starts the panel.

The **panel password** is printed to the screen in the output (it is also kept in `.env` — save it).

> If you prefer to set it up manually: put `PANEL_PASSWORD` and `SECRET_KEY` into `.env` and run
> `docker compose -f compose.sqlite.yml --env-file .env up -d --build`.

## 3. Logging into the panel
In your browser: **http://SERVER_IP:8787** (locally `http://localhost:8787`).
User is `admin`, password is the value generated during setup.

> For public access, **HTTPS** with a reverse proxy (Caddy/Nginx) is recommended.

## 4. Initial settings (Settings screen)
Left menu → **Settings**:
- **Telegram notifications:** get a token from BotFather → send a message to your bot → **Connect**
  (the chat ID is found automatically). From now on, trade/error notifications will arrive on Telegram.
- **Binance API keys (global):** enter your LIVE and/or TESTNET keys. Bots that do not have a per-bot
  key will use these. (On Binance, create the key with **Spot Trading only**
  permission, **withdrawals disabled**, and IP-restricted if possible.)
- **LIVE real-money gate:** open it only when you are ready to trade with real money.

## 5. Adding a bot
**Bots** → **+ Add Bot**: choose the name, mode (dry_run/testnet/live), strategy type, budget, and
the related parameters → **Save** → **Start**. In the bot detail view: open positions,
manual close, signal preview (SCAN), daily performance.

## 6. Screens
- **Overview:** total equity/P-L of all bots + BTC regime.
- **Bots:** bot list + detail + manual close.
- **Coin Analysis:** market scans (large buy/sell, pump, volume anomaly, past pump).
- **Backtest:** test the strategy on historical data.
- **Settings:** notifications + keys + LIVE gate.

## 7. Recommended path (up to LIVE)
1. **DRY_RUN** (paper) — monitor for weeks, look at the daily performance distribution.
2. **Backtest** — test the parameters on the past.
3. **TESTNET** — real API + fake money; observe slippage/OCO behavior.
4. **LIVE** — only if the strategy is proven, with a **small** budget you can afford to lose.

## 8. Backup & update
- **Data:** SQLite in a single file (Docker volume `costate`). Backup:
  `docker run --rm -v brimoza_costate:/d -v "$PWD":/b alpine tar czf /b/yedek.tgz -C /d .`
- **Update:** pull the new version and run `docker compose -f compose.sqlite.yml up -d --build`.
  `.env` and data are preserved.
- **Stop/start:** `docker compose -f compose.sqlite.yml down` / `up -d`.

## 9. Common issues
- **Panel won't open:** check the logs with `docker compose -f compose.sqlite.yml logs web`;
  wait ~20 sec until the container is "healthy".
- **I forgot the password:** check `PANEL_PASSWORD` in `.env`.
- **No notifications arriving:** Settings → Telegram → **Send Test**. Verify the token/chat ID.
- **Bots stopped after a restart:** running (enabled) bots resume automatically;
  manually stopped ones stay off (by design).

---
License: `LICENSE` · Version: `VERSION` · Changes: `CHANGELOG.md`
