234 lines
4.6 KiB
Markdown
234 lines
4.6 KiB
Markdown
# 🚀 Setup Guide - Place Order Trading Bot
|
|
|
|
## ✅ Erstmalige Einrichtung (ABGESCHLOSSEN)
|
|
|
|
Die folgenden Schritte wurden bereits durchgeführt:
|
|
|
|
- ✅ Repository geklont von Gitea
|
|
- ✅ Git User konfiguriert (cbazza / froehlich.sebastian@gmail.com)
|
|
- ✅ `telegram_config.json` erstellt
|
|
- ✅ `trading_bot.db` aus altem Ordner kopiert
|
|
- ✅ Virtuelle Python-Umgebung erstellt
|
|
|
|
---
|
|
|
|
## 🔄 Täglicher Workflow
|
|
|
|
### 1. Vor dem Arbeiten - Änderungen vom Server holen
|
|
|
|
```bash
|
|
cd Place-Order-Trading-Bot
|
|
git pull
|
|
```
|
|
|
|
### 2. Virtuelle Umgebung aktivieren
|
|
|
|
```bash
|
|
# Windows
|
|
.\venv\Scripts\activate
|
|
|
|
# Sie sehen dann: (venv) vor Ihrer Kommandozeile
|
|
```
|
|
|
|
### 3. Bot starten
|
|
|
|
```bash
|
|
# Jupyter Notebook (wie bisher)
|
|
jupyter notebook TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb
|
|
|
|
# ODER: GUI starten
|
|
python trading_bot_gui.py
|
|
|
|
# ODER: Dashboard
|
|
streamlit run trading_dashboard.py
|
|
```
|
|
|
|
### 4. Nach dem Arbeiten - Änderungen speichern
|
|
|
|
```bash
|
|
# Status prüfen
|
|
git status
|
|
|
|
# Alle geänderten Dateien hinzufügen
|
|
git add .
|
|
|
|
# ODER: Nur bestimmte Dateien
|
|
git add TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb
|
|
|
|
# Commit mit aussagekräftiger Nachricht
|
|
git commit -m "Beschreibung der Änderung"
|
|
|
|
# Zum Server pushen
|
|
git push
|
|
```
|
|
|
|
---
|
|
|
|
## 🌿 Branch-Strategie (Empfohlen für größere Änderungen)
|
|
|
|
### Neues Feature entwickeln
|
|
|
|
```bash
|
|
# Neuen Feature-Branch erstellen
|
|
git checkout -b feature/mein-neues-feature
|
|
|
|
# ... arbeiten und committen ...
|
|
git add .
|
|
git commit -m "Feature: Beschreibung"
|
|
|
|
# Zum Server pushen
|
|
git push -u origin feature/mein-neues-feature
|
|
```
|
|
|
|
### Zurück zum Hauptbranch
|
|
|
|
```bash
|
|
# Änderungen committen
|
|
git add .
|
|
git commit -m "Work in progress"
|
|
|
|
# Zu main wechseln
|
|
git checkout main
|
|
|
|
# Aktualisieren
|
|
git pull
|
|
```
|
|
|
|
### Feature-Branch mergen
|
|
|
|
```bash
|
|
# Auf Gitea einen Pull Request erstellen
|
|
# ODER lokal mergen:
|
|
git checkout main
|
|
git merge feature/mein-neues-feature
|
|
git push
|
|
```
|
|
|
|
---
|
|
|
|
## 📁 Wichtige Dateien (nicht in Git)
|
|
|
|
Diese Dateien werden von `.gitignore` ignoriert und bleiben lokal:
|
|
|
|
- `telegram_config.json` - Ihre Telegram Credentials
|
|
- `trading_bot.db` - Trading Datenbank
|
|
- `venv/` - Python virtuelle Umgebung
|
|
- `*.log` - Log-Dateien
|
|
- `__pycache__/` - Python Cache
|
|
|
|
**WICHTIG:** Diese Dateien werden NICHT zum Server gepusht!
|
|
|
|
---
|
|
|
|
## 🔧 Nützliche Git-Befehle
|
|
|
|
### Status prüfen
|
|
```bash
|
|
git status # Zeigt geänderte Dateien
|
|
git log --oneline -5 # Letzte 5 Commits
|
|
git diff # Zeigt Änderungen
|
|
```
|
|
|
|
### Änderungen rückgängig machen
|
|
```bash
|
|
# Vor dem Commit (Working Directory)
|
|
git checkout -- datei.py
|
|
|
|
# Nach dem Commit (letzte Änderung rückgängig)
|
|
git revert HEAD
|
|
|
|
# ACHTUNG: Alle lokalen Änderungen verwerfen!
|
|
git reset --hard HEAD
|
|
```
|
|
|
|
### Branches verwalten
|
|
```bash
|
|
git branch # Alle lokalen Branches
|
|
git branch -a # Alle Branches (inkl. remote)
|
|
git branch -d feature/alt # Branch löschen (lokal)
|
|
```
|
|
|
|
---
|
|
|
|
## 🆘 Problemlösung
|
|
|
|
### "Your branch is behind 'origin/main'"
|
|
```bash
|
|
git pull
|
|
```
|
|
|
|
### "Changes not staged for commit"
|
|
```bash
|
|
git add .
|
|
git commit -m "Update"
|
|
git push
|
|
```
|
|
|
|
### "Conflict" beim Pull
|
|
```bash
|
|
# Datei öffnen, Konflikte manuell lösen (<<<, ===, >>> entfernen)
|
|
git add konflikt-datei.py
|
|
git commit -m "Merge conflict resolved"
|
|
```
|
|
|
|
### Versehentlich Datei hinzugefügt (z.B. Credentials)
|
|
```bash
|
|
# Vor dem Commit
|
|
git reset HEAD datei.json
|
|
|
|
# Nach dem Commit (aber vor dem Push!)
|
|
git rm --cached datei.json
|
|
git commit --amend
|
|
```
|
|
|
|
---
|
|
|
|
## 📦 Dependencies installieren
|
|
|
|
Falls neue Packages benötigt werden:
|
|
|
|
```bash
|
|
# Virtuelle Umgebung aktivieren!
|
|
.\venv\Scripts\activate
|
|
|
|
# Installieren
|
|
pip install paketname
|
|
|
|
# requirements.txt aktualisieren
|
|
pip freeze > requirements.txt
|
|
|
|
# Dann committen
|
|
git add requirements.txt
|
|
git commit -m "Add new dependency: paketname"
|
|
git push
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 Best Practices
|
|
|
|
1. **Häufig committen** - Kleine, logische Commits sind besser als große
|
|
2. **Aussagekräftige Commit-Messages** - "Fix bug" ❌ → "Fix position monitor reconnection issue" ✅
|
|
3. **Vor dem Pushen pullen** - Vermeidet Konflikte
|
|
4. **Branches für große Features** - Hält main stabil
|
|
5. **Niemals Secrets committen** - Immer `.gitignore` prüfen
|
|
|
|
---
|
|
|
|
## 📞 Schnellreferenz
|
|
|
|
| Aktion | Befehl |
|
|
|--------|--------|
|
|
| Repository aktualisieren | `git pull` |
|
|
| Status prüfen | `git status` |
|
|
| Änderungen speichern | `git add . && git commit -m "Message" && git push` |
|
|
| Neuen Branch | `git checkout -b feature/name` |
|
|
| Virtuelle Umgebung aktivieren | `.\venv\Scripts\activate` |
|
|
| Bot starten (Notebook) | `jupyter notebook` |
|
|
| Bot starten (GUI) | `python trading_bot_gui.py` |
|
|
|
|
---
|
|
|
|
**Erstellt am:** 2025-12-20
|
|
**Repository:** https://gitea.cbazza.synology.me/cbazza/Place-Order-Trading-Bot.git
|