feat: add testnet mode support and fix UDS order type classification

- Add BINANCE_TESTNET env var to switch between live/demo API keys
- Add KLINE_INTERVAL env var (default 15m) for configurable candle interval
- Pass testnet flag through to Exchange, DataStream, UDS, Notifier
- Add demo mode in bot: forced LONG entry with fixed 0.5% SL / 2% TP
- Fix UDS close_reason: use ot (original order type) field to correctly
  classify STOP_MARKET/TAKE_PROFIT_MARKET triggers (was MANUAL)
- Add UDS raw event logging with ot field for debugging
- Add backtest market context (BTC/ETH regime, L/S ratio per fold)
- Separate testnet trade history to data/trade_history/testnet/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
21in7
2026-03-23 13:05:38 +09:00
parent 1135efc5be
commit 0ddd1f6764
9 changed files with 511 additions and 20 deletions

View File

@@ -20,6 +20,7 @@ class BinanceFuturesClient:
self.client = Client(
api_key=config.api_key,
api_secret=config.api_secret,
demo=config.testnet,
)
self._qty_precision: int | None = None
self._price_precision: int | None = None