fix: resolve 6 warning issues from code review

5. Add daily PnL reset loop — UTC midnight auto-reset via
   _daily_reset_loop in main.py, prevents stale daily_pnl accumulation
6. Fix set_base_balance race condition — call once in main.py before
   spawning bots, instead of each bot calling independently
7. Remove realized_pnl != 0 from close detection — prevents entry
   orders with small rp values being misclassified as closes
8. Rename xrp_btc_rs/xrp_eth_rs → primary_btc_rs/primary_eth_rs —
   generic column names for multi-symbol support (dataset_builder,
   ml_features, and tests updated consistently)
9. Replace asyncio.get_event_loop() → get_running_loop() — fixes
   DeprecationWarning on Python 3.10+
10. Parallelize candle preload — asyncio.gather for all symbols
    instead of sequential REST calls, ~3x faster startup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
21in7
2026-03-16 22:44:40 +09:00
parent 8803c71bf9
commit 64f56806d2
10 changed files with 85 additions and 61 deletions

View File

@@ -203,11 +203,11 @@ def test_rs_zero_denominator():
signal_arr = _calc_signals(d)
feat = _calc_features_vectorized(d, signal_arr, btc_df=btc_df, eth_df=eth_df)
assert "xrp_btc_rs" in feat.columns, "xrp_btc_rs 컬럼이 있어야 함"
assert not feat["xrp_btc_rs"].isin([np.inf, -np.inf]).any(), \
"xrp_btc_rs에 inf가 있으면 안 됨"
assert not feat["xrp_btc_rs"].isna().all(), \
"xrp_btc_rs가 전부 nan이면 안 됨"
assert "primary_btc_rs" in feat.columns, "primary_btc_rs 컬럼이 있어야 함"
assert not feat["primary_btc_rs"].isin([np.inf, -np.inf]).any(), \
"primary_btc_rs에 inf가 있으면 안 됨"
assert not feat["primary_btc_rs"].isna().all(), \
"primary_btc_rs가 전부 nan이면 안 됨"
@pytest.fixture