feat: Enhance trading system with new permanent subscription features and order book management
Changes: - Added a new API endpoint for managing permanent subscriptions, allowing users to enable or disable subscriptions dynamically. - Implemented a function to fill candle data from Kiwoom, ensuring that only relevant data is inserted into the database. - Introduced a mechanism to handle master subscription states, improving the management of subscription statuses. - Updated the database schema to include new fields for managing subscription states and order book filtering. Impact: - These enhancements improve the flexibility and reliability of the trading system, allowing for better management of subscriptions and order book data, while reducing the risk of data inconsistencies. 히스토리 align 제거 븅신같은 초기설계 아예 제거 진입모드에 구멍메움 호가진입을 켜도 호가가 안들어올때 호가 안보고 그냥 사버림
This commit is contained in:
@@ -205,9 +205,12 @@ def enrich_out_data_with_mode_combo(
|
||||
except Exception as exc:
|
||||
lg.warning("⚠️ mode_combo 부분저장 실패: %s", exc)
|
||||
|
||||
mode_fills: List[Dict[str, Any]] = []
|
||||
if evaluate_fn is not None and mode_params:
|
||||
try:
|
||||
bt = evaluate_fn(dict(mode_params))
|
||||
if isinstance(bt, dict):
|
||||
mode_fills = list(bt.pop("_trades", None) or [])
|
||||
report["backtest"] = _bt_summary(bt)
|
||||
if report["backtest"].get("ok"):
|
||||
lg.info(
|
||||
@@ -222,6 +225,7 @@ def enrich_out_data_with_mode_combo(
|
||||
except Exception as exc:
|
||||
report["backtest"] = {"ok": False, "error": str(exc)}
|
||||
lg.warning("🧪 [mode] 실측 백테 예외: %s", exc)
|
||||
mode_fills = []
|
||||
|
||||
if best_pnl is not None and report.get("backtest") and report["backtest"].get("ok"):
|
||||
mode_pnl = float(report["backtest"]["total_pnl"] or 0)
|
||||
@@ -266,33 +270,25 @@ def enrich_out_data_with_mode_combo(
|
||||
)
|
||||
|
||||
out_data["mode_combo"] = report
|
||||
# 다단트레일 추천 (탐색 축 아님 — 미리보기/apply 전용)
|
||||
# TopN 후처리(호가/휩쏘/트레일) — 실매 엔진 미변경. 합의값이 기존 단일 recommend 키를 대체.
|
||||
try:
|
||||
from kis_trader.backtest.optuna_daily_trail_recommend import (
|
||||
attach_daily_trail_recommend,
|
||||
from kis_trader.backtest.optuna_postprocess_topn import attach_topn_postprocess
|
||||
|
||||
attach_topn_postprocess(
|
||||
out_data,
|
||||
evaluate_fn=evaluate_fn,
|
||||
mode_fills=mode_fills,
|
||||
log=lg,
|
||||
run_ob_whipsaw=True,
|
||||
)
|
||||
|
||||
attach_daily_trail_recommend(out_data, log=lg)
|
||||
except Exception as exc:
|
||||
lg.warning("⚠️ daily_trail_recommend 첨부 실패: %s", exc)
|
||||
|
||||
# 호가 수급 합의 추천 (탐색 축 아님 — apply/미리보기 전용 1000회 핀셋 탐색)
|
||||
try:
|
||||
from kis_trader.backtest.optuna_orderbook_recommend import (
|
||||
attach_orderbook_recommend,
|
||||
)
|
||||
|
||||
attach_orderbook_recommend(out_data, log=lg)
|
||||
except Exception as exc:
|
||||
lg.warning("⚠️ orderbook_recommend 첨부 실패: %s", exc)
|
||||
|
||||
# 휩쏘 필터 합의 추천
|
||||
try:
|
||||
from kis_trader.backtest.optuna_whipsaw_recommend import (
|
||||
attach_whipsaw_recommend,
|
||||
)
|
||||
attach_whipsaw_recommend(out_data, log=lg)
|
||||
except Exception as exc:
|
||||
lg.warning("⚠️ whipsaw_recommend 첨부 실패: %s", exc)
|
||||
lg.warning("⚠️ TopN 후처리 첨부 실패: %s", exc)
|
||||
try:
|
||||
from kis_trader.backtest.optuna_daily_trail_recommend import (
|
||||
attach_daily_trail_recommend,
|
||||
)
|
||||
attach_daily_trail_recommend(out_data, log=lg)
|
||||
except Exception as exc2:
|
||||
lg.warning("⚠️ daily_trail_recommend 폴백 실패: %s", exc2)
|
||||
|
||||
return out_data
|
||||
|
||||
Reference in New Issue
Block a user