Fix trade recovery, local web isolation and backtest risk accounting

This commit is contained in:
Igol committed 2026-10-22 21:49:20 +03:00
1 parent 5c6b0dc54a
commit 6aa76064dc
29 files changed
+2662 -1693

No files matched your search

+7 -6
View File
@@ -4,6 +4,8 @@ Standalone real-time simulator and optional Bybit USDT-perpetual trading bot.
## Run on Windows
Python 3.11+; dependencies are pinned in `requirements.txt`. Recovery semantics, module layout and offline tests: [docs/reliability.md](docs/reliability.md).
```powershell
cd C:\arb\RealtimePaperSimulator
py -3 -m pip install -r requirements.txt
@@ -142,12 +144,11 @@ the SHORT leg, funding per 8 h in $, the exit fees, a warning when the best pric
and the result in $ if the spread closes to zero / to its usual level, with the break-even spread (all fees: entry
and exit on both exchanges, plus the transfer fee when the transfer is taken into account).
**Access from outside with a VPN on**: `run_web_sim.bat` starts two processes — the engine
`py -3 web_sim.py --backend` (python.exe, 127.0.0.1:8766, needs the VPN for the exchanges) and the public page
`pyw -3 web_proxy.py` (pythonw.exe, 0.0.0.0:8765, forwards everything to the engine). Add
`…\Python312\pythonw.exe` to the VPN's app exclusions so answers to outside visitors leave through the home
connection; forward TCP 8765 in the router and allow it in Windows Firewall. `py -3 web_sim.py` alone still serves
the page itself on 0.0.0.0:8765 (`--local`: 127.0.0.1 only).
**Local proxy with a VPN on**: `run_web_sim.bat` starts the engine on `127.0.0.1:8766`
(`python.exe`) and the page proxy on `127.0.0.1:8765` (`pythonw.exe`). The page remains local even when
`pythonw.exe` is excluded from the VPN. Both processes validate the original local Host and browser Origin;
POST commands require the page's `X-Sim` header. The app is not configured for public internet hosting.
`py -3 web_sim.py` serves the page directly on `127.0.0.1:8765`.
**Saved connections** («Подключение»): every leader + follower combination used is kept in `lead_connections.json`
(coin, KuCoin market/ticker or DEX pool, follower exchange and ticker) and can be picked again from the list; a new one