Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
31d4c7a
Update README to clarify get-all-markets command usage
VirilePeak Feb 8, 2026
649ae04
Optimierungen: ngrok Auto-Start, Orphan-Cleanup, Trade-Stat Scripts
VirilePeak Feb 9, 2026
4b0bb73
ci: add workflow to run lint/tests and open automated draft PRs (semi…
VirilePeak Feb 9, 2026
8c65fb8
docs(automation): add guide for semi-automatic workflow and secrets
VirilePeak Feb 9, 2026
f2e4566
ci(tests): run black, flake8 and pytest; autoformat before PR
VirilePeak Feb 9, 2026
a08f300
ci(deploy): optional SSH/SCP deploy on merge to main (conditional on …
VirilePeak Feb 9, 2026
3e37637
docs(automation): add deploy secrets quickstart
VirilePeak Feb 9, 2026
e93efdc
chore(scripts): add SSH/SCP deploy connection test script
VirilePeak Feb 9, 2026
6d2077b
docs(automation): document test_deploy_ssh usage in automation README
VirilePeak Feb 9, 2026
a7a0b03
ci(workflow): quote commit-message to fix YAML
VirilePeak Feb 9, 2026
2a68e3d
fix(position_manager): persist idempotency and cooldown maps to state…
VirilePeak Feb 9, 2026
758e4d1
fix(start_server): Projektpfad an PYTHONPATH anhängen statt vorhand…
VirilePeak Feb 9, 2026
9b49004
fix(fast_entry_engine): enhance error handling and logging, improve p…
VirilePeak Feb 9, 2026
192307d
ci(monitor): scheduled watcher to rerun stuck CodeQL runs on automati…
VirilePeak Feb 9, 2026
79dbba1
ci(workflow): remove duplicate flake8 execution in CI workflow
VirilePeak Feb 9, 2026
e7bc9d8
fix(market_data): improve data fetching logic and enhance error handl…
VirilePeak Feb 9, 2026
3033a8f
fix(ci): resolve YAML nested mapping error in bot-auto-pr.yml
VirilePeak Feb 9, 2026
c5ffbb4
fix(ci): add conditional checks for SSH key and host in deployment wo…
VirilePeak Feb 9, 2026
503b1c3
fix(ci): quote commit-message in workflow to avoid YAML parsing error
VirilePeak Feb 9, 2026
d044c47
ci(summary): hourly automation PR summary (posts comment to automatio…
VirilePeak Feb 9, 2026
91ffc53
chore: remove cursor worktree config from repo
VirilePeak Feb 10, 2026
9302d1f
feat(winrate): add MQ gate, confirmation store, exit safety and tests
VirilePeak Feb 10, 2026
07b6102
chore(start): set WINRATE_UPGRADE env flags for safe paper-mode smoke…
VirilePeak Feb 10, 2026
2ef06df
chore(start): set CONFIRM_TTL_SECONDS env for compatibility
VirilePeak Feb 10, 2026
09c19f2
feat(winrate): move confirmation before session/MQ; add MQ gate, conf…
VirilePeak Feb 10, 2026
7d62865
fix(winrate): load env vars for winrate upgrade; use sig_for_dedupe i…
VirilePeak Feb 10, 2026
071ec00
fix(dedupe): allow duplicates to pass when confirmation pending
VirilePeak Feb 10, 2026
b40b57e
debug(dedupe): log confirmation_store keys when duplicate detected
VirilePeak Feb 10, 2026
9dc713b
refactor(webhook): move confirmation to immediately after dedupe acce…
VirilePeak Feb 10, 2026
ba75ab9
feat(winrate): add ConfirmationStore.handle API (pending/expired/conf…
VirilePeak Feb 10, 2026
183d9a5
feat(winrate): add ConfirmationStore.handle and use stable conf_key (…
VirilePeak Feb 10, 2026
7c0cc1b
feat(winrate): add ConfirmationStore.clear to remove pending keys
VirilePeak Feb 10, 2026
d4a4276
fix(winrate): clear pending confirmation when confirmed signal later …
VirilePeak Feb 10, 2026
e9cd6f5
fix(winrate): clear confirmed pending keys on various rejects and aft…
VirilePeak Feb 10, 2026
7b3752b
fix(syntax): remove stray escape in logger.exception for confirmation…
VirilePeak Feb 10, 2026
c564b86
refactor(winrate): structured conf_key, improve ConfirmationStore.cle…
VirilePeak Feb 10, 2026
936c276
fix(winrate): 5 bugs in confirmation flow - syntax, clear semantics, …
VirilePeak Feb 10, 2026
4d935ad
fix(ci): use env proxy for secrets in deploy-on-merge workflow if-con…
VirilePeak Feb 11, 2026
42854ec
Market data: adapter runtime startup, health/metrics routes, tests, CI
VirilePeak Feb 11, 2026
8887382
Register market-data health/metrics routes (safe, no WS side-effects)
VirilePeak Feb 11, 2026
ed0ab4b
Entry/Risk Gates: settings, RiskManager.check_entry_allowed, integrat…
VirilePeak Feb 12, 2026
1680b16
Enforce Entry Gate chokepoint: OrderExecutor + Polymarket check flag …
VirilePeak Feb 12, 2026
2b64102
RiskManager: kill-switch cooldown + persistent state file (atomic sav…
VirilePeak Feb 12, 2026
c78b28b
Docs: RISK_STATE_PATH note in settings.py (persistence guidance)
VirilePeak Feb 12, 2026
f45bad9
archive: rotate legacy trade logs before reset
VirilePeak Feb 12, 2026
041d3aa
chore: initialize fresh paper_trades/position_state/pending_confirmat…
VirilePeak Feb 12, 2026
de54708
market_data: add REST fallback provider and RTDS provider (parsers + …
VirilePeak Feb 12, 2026
f837fce
market_data: RTDS provider support + settings + normalizer unit test
VirilePeak Feb 12, 2026
4dbcc27
tests(market_data): REST provider refresh + adapter subscribe wiring
VirilePeak Feb 12, 2026
2d3f7e3
fix: import MarketDataAdapter safely in webhook startup to avoid Name…
VirilePeak Feb 12, 2026
81e7d2e
fix(startup): remove local asyncio import to avoid UnboundLocalError …
VirilePeak Feb 13, 2026
5bba0ac
health: improve /market-data/health to introspect adapter state when …
VirilePeak Feb 13, 2026
6f0b58b
health: rely on telemetry gauge for adapter presence to avoid cross-m…
VirilePeak Feb 13, 2026
e8d7a5d
feat(market-data): add market_data_event_consumer to subscribe to ada…
VirilePeak Feb 13, 2026
3ad347f
feature: auto-subscribe MarketDataAdapter on paper trade creation (be…
VirilePeak Feb 13, 2026
8254b89
fix: schedule MarketDataAdapter.subscribe instead of awaiting (avoid …
VirilePeak Feb 13, 2026
134f478
log: MarketDataAdapter.subscribe start/complete for better visibility
VirilePeak Feb 13, 2026
4ad936d
feature: PositionManager.auto-subscribe MarketDataAdapter on trade cr…
VirilePeak Feb 13, 2026
8d85eb5
log: PositionManager subscribe failure to INFO for visibility
VirilePeak Feb 13, 2026
3dc589d
fix: ensure smoke_trade schedules MarketDataAdapter.subscribe for tes…
VirilePeak Feb 13, 2026
55557ce
feature: auto-subscribe MarketDataAdapter on signal accept (best-effort)
VirilePeak Feb 13, 2026
9299618
telemetry: update market_data_active_subscriptions gauge on subscribe…
VirilePeak Feb 13, 2026
f64f711
admin: add market-data admin subscribe endpoint (best-effort)
VirilePeak Feb 13, 2026
dbc9ff0
fix: remove improper 'global _market_data_adapter' causing SyntaxErro…
VirilePeak Feb 13, 2026
f9ebec3
ops: enable RTDS provider by default (MARKET_DATA_RTDS_ENABLED=true) …
VirilePeak Feb 13, 2026
bf32f06
feat(market-data): bootstrap/reconcile subscriptions from open trades…
VirilePeak Feb 13, 2026
61f59e0
feat(market-data): add reconcile logic with refcount + flap guard; au…
VirilePeak Feb 13, 2026
191c470
test(market-data): reconcile unsubscribe + refcount flap-guard unit t…
VirilePeak Feb 13, 2026
e83cd41
test: ensure local src in PYTHONPATH for CI
VirilePeak Feb 13, 2026
3c73992
feat(market-data): subscriptions view + configurable reconcile missin…
VirilePeak Feb 13, 2026
221e76f
test(market-data): subscriptions view endpoint returns tokens + refco…
VirilePeak Feb 13, 2026
f82bbf3
fix(logging): correct string quoting in reconcile scheduling logs
VirilePeak Feb 13, 2026
0162460
feat(market-data): secure subscriptions view behind DEBUG_ENDPOINTS +…
VirilePeak Feb 13, 2026
4b0eba2
test: enable debug endpoints in subscriptions view test
VirilePeak Feb 13, 2026
409a6bd
chore(docs): note on debug endpoints security; add README usage line
VirilePeak Feb 13, 2026
4ba1fc8
Add trade performance reporting CLI + tests
VirilePeak Feb 13, 2026
131aa5b
test(research): use timezone.utc for portability on Windows
VirilePeak Feb 13, 2026
852007b
research: treat realized_pnl records as closed when closed_at missing…
VirilePeak Feb 13, 2026
495cff5
research: timezone fallbacks for generate_markdown (avoid tzdata requ…
VirilePeak Feb 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .deployignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Files and directories to exclude from deploy
.git
.gitignore
.github/
.env
*.env
venv/
.venv/
env/
__pycache__/
*.pyc
local_markets_db/
local_db*
*.sqlite
*.db
logs/
*.log
*.pem
*.key
node_modules/
coverage/
dist/
build/
.idea/
.vscode/
*.egg-info/

# Add any other local artifacts you don't want deployed
31 changes: 31 additions & 0 deletions .github/automation/README_AUTOMATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Automations‑Guide (semi‑automatic workflow)

Kurz:
- Workflow `.github/workflows/bot-auto-pr.yml` erstellt automatisch einen Draft‑PR (`automation/bot-auto-pr`) nachdem Lint/Tests gelaufen sind.
- Du reviewst den PR manuell und mergest nach Freigabe.

Empfohlene Einstellungen:
1) Branch‑Protection auf `main`
- Require pull request reviews before merging (1 reviewer)
- Require status checks to pass (CI)
- Include administrators (optional)

2) Secrets / Tokens
- Der Workflow nutzt das automatisch bereitgestellte `GITHUB_TOKEN` — kein PAT nötig für PR‑Erstellung.
- Falls du später Aktionen brauchst, die externen Zugriff benötigen (z.B. Deployment), erstelle einen separaten PAT mit minimalen Scopes und lege ihn in Repository → Settings → Secrets → Actions.
Empfohlene minimale Scopes für Deploy (wenn nötig):
- repo (only if pushing tags/branches required)
- workflow (if triggering workflows)
- Weitere Scopes nur bei Bedarf.

3) Review‑Prozess
- PR wird als Entwurf erstellt. Prüfe Änderungen lokal oder in GitHub UI, führe Tests aus und merge erst nach Review.

4) Sicherheit
- Niemals Tokens in Code oder Issue‑Vorlagen einchecken.
- Revoke/drehe Tokens sofort, falls sie versehentlich veröffentlicht wurden.

Wenn du möchtest, kann ich:
- eine einfache Deploy‑Action (nur beim Merge) anlegen, die nach Merge automatisch in ein staging Verzeichnis deployed (benötigt Secret).
- oder zusätzliche PR‑Templates/labels für automatisierte PRs erstellen.

40 changes: 40 additions & 0 deletions .github/automation/README_AUTOMATION_EXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Ergänzung: Deploy‑Secrets und Schnellstart

Kurz: Diese Anleitung erklärt, wie du die optionalen Deploy‑Secrets sicher anlegst, damit der Deploy‑Workflow nach Merge funktioniert.

1) SSH‑Key erzeugen (lokal)
ssh-keygen -t rsa -b 4096 -C "deploy@yourhost" -f ~/.ssh/agents_deploy_key
- Public: ~/.ssh/agents_deploy_key.pub
- Private: ~/.ssh/agents_deploy_key

2) Public key auf Zielserver installieren
- Melde dich auf dem Zielserver als Deploy‑User an und füge die Public key zu `~/.ssh/authorized_keys`.
- Setze korrekte Rechte: `chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys`

3) Secrets in GitHub setzen
Repository → Settings → Secrets and variables → Actions → New repository secret
Erstelle folgende Secrets (Namen exakt verwenden):
- DEPLOY_HOST (z. B. example.com)
- DEPLOY_USER (z. B. deployuser)
- DEPLOY_PORT (optional, wenn nicht gesetzt: 22)
- DEPLOY_TARGET (Zielpfad, z. B. /var/www/agents)
- DEPLOY_SSH_KEY (Inhalt der privaten Key‑Datei `~/.ssh/agents_deploy_key` — ganze Datei einfügen)

4) Sicherheitshinweise
- Verwende einen dedizierten Deploy‑User mit minimalen Rechten.
- Lege keine Secrets in Repo‑Dateien oder Chatnachrichten ab.
- Rotiere oder widerrufe Keys sofort, falls sie kompromittiert wurden.

5) Testen
- Merge oder push auf `main` (oder simuliere lokal). Deploy‑Job läuft nur, wenn die oben genannten Secrets vorhanden sind.

Optional: Ich kann ein kurzes Shell‑Testscript hinzufügen, das vor dem ersten Merge die SSH‑Verbindung prüft (ssh -i KEY -p PORT USER@HOST echo ok). Soll ich das zusätzlich anlegen? (ja/nein)

Hinweis zum Testscript:
- Datei: `scripts/test_deploy_ssh.sh` (bereits vorhanden im Repo)
- Beispielaufruf:
- `./scripts/test_deploy_ssh.sh -h example.com -u deployuser -k ~/.ssh/agents_deploy_key -p 22 -t /var/www/agents`
- Das Script prüft SSH‑Login und optionales SCP eines kleinen Testfiles in das angegebene Zielverzeichnis.

Führe das Script lokal aus, bevor du Secrets in GitHub setzt, um sicherzustellen, dass der Deploy‑User korrekt konfiguriert ist.

87 changes: 87 additions & 0 deletions .github/workflows/bot-auto-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Bot — Auto PRs (semi-automatic)

on:
push:
branches:
- 'bot/**'
schedule:
- cron: '0 2 * * *' # daily at 02:00 UTC
workflow_dispatch:

jobs:
test-and-lint:
name: Test & Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies (if any)
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install black==23.12.0 flake8 pytest || true

- name: Run black (check)
run: |
if command -v black >/dev/null 2>&1; then
black --check . || true
fi

- name: Run flake8
run: |
if command -v flake8 >/dev/null 2>&1; then
flake8 || true
fi

- name: Run tests (pytest)
run: |
if command -v pytest >/dev/null 2>&1; then
pytest -q || true
fi
# flake8 already run above in "Run flake8" step; avoid duplicate execution.

create-pr:
name: Create Pull Request
runs-on: ubuntu-latest
needs: test-and-lint
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure git for auto-commits
run: |
git config user.name "automation-bot"
git config user.email "automation-bot@users.noreply.github.com"

- name: Autoformat with black (if installed)
run: |
if python -c "import importlib.util,sys; sys.exit(0 if importlib.util.find_spec('black') else 1)"; then
python -m black . || true
git add -A
git diff --quiet --cached || (git commit -m "style: autoformat with black" || true)
fi

# This action will create a PR from branch `automation/bot-auto-pr` when changes exist.
- name: Create Pull Request (draft)
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore(ci): automated fixes / checks'
branch: automation/bot-auto-pr
title: "chore(ci): automated bot PR"
body: |
This pull request was created automatically by the repository automation workflow.
It contains automated lint/test fixes or CI suggestions. Please review before merging.
labels: automated
draft: true

53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
push:
branches: [ main, master ]
pull_request:

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.11"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip

# Prefer editable install if pyproject/setup exists
if [ -f pyproject.toml ]; then
pip install -e ".[dev]" || pip install -e .
fi

# Fallback to requirements files if present
if [ -f requirements.txt ]; then
pip install -r requirements.txt
fi
if [ -f requirements-dev.txt ]; then
pip install -r requirements-dev.txt
fi

# Ensure pytest is available even if not in deps
pip show pytest >/dev/null 2>&1 || pip install pytest pytest-asyncio

- name: Run tests
env:
PYTHONUNBUFFERED: "1"
run: |
pytest -q

100 changes: 100 additions & 0 deletions .github/workflows/deploy-on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Deploy on Merge (optional)

# This workflow performs an optional SSH/SCP deploy when code is merged to `main`.
# It only runs the deploy step if the required secrets are provided in the repository:
# - DEPLOY_HOST
# - DEPLOY_USER
# - DEPLOY_SSH_KEY
# - DEPLOY_TARGET
# - DEPLOY_PORT (optional, defaults to 22)
#
# To enable: add the above secrets in GitHub → Settings → Secrets → Actions.

on:
push:
branches:
- main

jobs:
build:
name: Build / Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install deps (if any)
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Run quick tests (if pytest)
run: |
if command -v pytest >/dev/null 2>&1; then pytest -q || true; fi

deploy:
name: Deploy (conditional)
runs-on: ubuntu-latest
needs: build
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_TARGET: ${{ secrets.DEPLOY_TARGET }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check deploy secrets
id: check-secrets
run: |
if [ -n "$DEPLOY_HOST" ] && [ -n "$DEPLOY_SSH_KEY" ]; then
echo "has_secrets=true" >> $GITHUB_OUTPUT
else
echo "has_secrets=false" >> $GITHUB_OUTPUT
fi

- name: Prepare SSH key
if: steps.check-secrets.outputs.has_secrets == 'true'
run: |
mkdir -p ~/.ssh
echo "$DEPLOY_SSH_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa

- name: Ensure known_hosts (optional)
if: steps.check-secrets.outputs.has_secrets == 'true'
run: |
PORT="${DEPLOY_PORT:-22}"
ssh-keyscan -p "$PORT" -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts || true

- name: Copy files to target via scp
if: steps.check-secrets.outputs.has_secrets == 'true'
run: |
PORT="${DEPLOY_PORT:-22}"
echo "Deploying to $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_TARGET (port $PORT) using rsync with .deployignore"
# Prefer using .deployignore in repo root to control excludes.
if [ -f .deployignore ]; then
rsync -az --delete --exclude-from='.deployignore' -e "ssh -p $PORT -o StrictHostKeyChecking=yes" . "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_TARGET"
else
echo ".deployignore not found, using conservative inline excludes"
rsync -az --delete \
--exclude='.git' \
--exclude='.env' \
--exclude='*.env' \
--exclude='venv/' \
--exclude='.venv/' \
--exclude='env/' \
--exclude='__pycache__/' \
--exclude='*.pyc' \
--exclude='local_markets_db/' \
--exclude='*.sqlite' \
--exclude='*.db' \
--exclude='logs/' \
-e "ssh -p $PORT -o StrictHostKeyChecking=yes" . "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_TARGET"
fi
Loading