fix: 히스터리시스 SELL 해제 이중 부호 버그 — SELL 과도한 끈끈함 제거 - #395
Merged
Conversation
scoring 전략 신호 히스터리시스에서 SELL→HOLD 해제 조건이 `s > -exit_sell`로 이중 부호화돼 있었다. 배포 설정(exit_sell_threshold=-1)에서 `-(-1)=+1`이 되어 점수가 +1(강한 강세) 위로 올라야만 SELL이 풀렸다. 즉 SELL 진입(-2) 후 점수가 중립(0)·약강세(+0.9)로 회복해도 계속 SELL로 남아, 회복 종목 재진입을 부당하게 억제했다(paper/get_latest_signal 경로에 영향). exit 임계값을 모두 실제 점수 레벨로 통일(부호 그대로 사용)한다: - BUY → HOLD: 점수 < exit_buy_threshold (0.5) - SELL → HOLD: 점수 > exit_sell_threshold (-1) 이제 BUY는 점수가 0.5 아래로 약화될 때, SELL은 점수가 -1 위로 회복할 때 해제되어 대칭적이고 직관적이다. exit_sell=None 기본값(=sell_threshold)도 기존의 비정상 `s > +2`에서 정상 베이스라인 `s > sell_threshold`로 개선된다. config/strategies.yaml 주석을 코드 의미(SELL/BUY 해제선)와 일치하도록 정정. 히스터리시스 양방향 전이·과매매 방지(BUY↔SELL 직접 전환 금지) 회귀 테스트 추가.
easygap
added a commit
that referenced
this pull request
Jul 6, 2026
fix: 히스터리시스 SELL 해제 이중 부호 버그 — SELL 과도한 끈끈함 제거
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제 (MED, 배포 paper 경로)
scoring 전략 신호 히스터리시스에서 SELL→HOLD 해제 조건이
s > -exit_sell로 이중 부호화돼 있었다. 배포 설정exit_sell_threshold: -1에서-(-1) = +1이 되어, 점수가 +1(강한 강세) 위로 올라야만 SELL이 풀린다.결과: SELL 진입(점수 ≤ -2) 후 점수가 중립(0)이나 약강세(+0.9)로 회복해도 계속 SELL로 남아, 회복 종목의 재진입을 부당하게 억제한다. BUY 측은
s < exit_buy(0.5)로 정상 해제되는데 SELL만 비대칭적으로 끈끈했다.hysteresis: enabled: true로 배포 설정에서 활성 상태이며, paper/get_latest_signal경로의 신호 출력에 영향을 준다(바스켓 리밸런싱은total_score만 읽어 영향 없음).수정
exit 임계값을 모두 실제 점수 레벨로 통일(부호 그대로 사용):
BUY → HOLD: 점수 <exit_buy_threshold(0.5)SELL → HOLD: 점수 >exit_sell_threshold(-1)이제 BUY는 점수가 0.5 아래로 약화될 때, SELL은 점수가 -1 위로 회복할 때 해제되어 대칭적·직관적이다.
exit_sell=None기본값(=sell_threshold)도 기존의 비정상s > +2에서 정상 베이스라인s > sell_threshold로 개선된다.config/strategies.yaml주석을 코드 의미(SELL/BUY 해제선)에 맞게 정정.테스트
tests/test_signal_hysteresis.py: SELL/BUY 양방향 진입·해제, 끈끈함 제거, BUY↔SELL 직접 전환 금지(과매매 방지) 회귀 검증.