feat: volume-lead strategy with compounding, WF filter, and DB-backed simulation
- core/strategy.py: replace trend strategy with volume-lead accumulation (vol spike + 2h quiet → signal, +4.8% rise → entry) - core/trader.py: compound budget adjusts on both profit and loss (floor 30%) - core/notify.py: add accumulation signal telegram notification - ohlcv_db.py: Oracle ADB OHLCV cache (insert, load, incremental update) - sim_365.py: 365-day compounding simulation loading from DB - krw_sim.py: KRW-based simulation with MAX_POSITIONS constraint - ticker_sim.py: ticker count expansion comparison - STRATEGY.md: full strategy documentation - .gitignore: exclude *.pkl cache files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,21 +33,22 @@ if SIMULATION_MODE:
|
||||
INITIAL_BUDGET = int(os.getenv("MAX_BUDGET", "10000000")) # 초기 원금 (고정)
|
||||
MAX_POSITIONS = int(os.getenv("MAX_POSITIONS", "3")) # 최대 동시 보유 종목 수
|
||||
|
||||
# 복리 적용 예산 (매도 후 재계산) — 수익 발생 시만 증가, 손실 시 원금 유지
|
||||
# 복리 적용 예산 (매도 후 재계산) — 수익 시 복리 증가, 손실 시 차감 (하한 30%)
|
||||
MIN_BUDGET = INITIAL_BUDGET * 3 // 10 # 최소 예산: 초기값의 30%
|
||||
MAX_BUDGET = INITIAL_BUDGET
|
||||
PER_POSITION = INITIAL_BUDGET // MAX_POSITIONS
|
||||
|
||||
|
||||
def _recalc_compound_budget() -> None:
|
||||
"""누적 수익을 반영해 MAX_BUDGET / PER_POSITION 재계산.
|
||||
"""누적 수익/손실을 반영해 MAX_BUDGET / PER_POSITION 재계산.
|
||||
|
||||
수익이 발생한 만큼만 예산에 더함 (손실 시 원금 아래로 내려가지 않음).
|
||||
수익 시 복리로 증가, 손실 시 차감 (최소 초기 예산의 30% 보장).
|
||||
매도 완료 후 호출.
|
||||
"""
|
||||
global MAX_BUDGET, PER_POSITION
|
||||
try:
|
||||
cum_profit = get_cumulative_krw_profit()
|
||||
effective = INITIAL_BUDGET + max(int(cum_profit), 0)
|
||||
effective = max(INITIAL_BUDGET + int(cum_profit), MIN_BUDGET)
|
||||
MAX_BUDGET = effective
|
||||
PER_POSITION = effective // MAX_POSITIONS
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user