init
This commit is contained in:
@@ -10,7 +10,27 @@ plt.rcParams['font.family'] ='AppleGothic'
|
|||||||
plt.rcParams['axes.unicode_minus'] =False
|
plt.rcParams['axes.unicode_minus'] =False
|
||||||
|
|
||||||
from config import *
|
from config import *
|
||||||
from stock_monitor import calculate_technical_indicators, detect_turnaround_signal, get_coin_more_data, check_buy_point
|
from stock_monitor import calculate_technical_indicators, get_coin_more_data, check_buy_point
|
||||||
|
|
||||||
|
def detect_turnaround_signal(symbol, data, interval=0, params=None):
|
||||||
|
"""매수 신호 감지 함수 - stock_simulation.py에서 사용"""
|
||||||
|
if len(data) < 7:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# 현재 매수 조건 확인
|
||||||
|
current_data = data.iloc[-1]
|
||||||
|
|
||||||
|
# 매수 신호가 있는지 확인
|
||||||
|
if current_data.get('buy_point', 0) == 1:
|
||||||
|
return {
|
||||||
|
'alert': True,
|
||||||
|
'details': f"매수신호: {current_data.get('buy_signal', 'unknown')}"
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'alert': False,
|
||||||
|
'details': "매수신호 없음"
|
||||||
|
}
|
||||||
|
|
||||||
# 비트/알트코인 KRW 마켓 식별: 문자열 "-KRW" 포함 여부로 간단 구분
|
# 비트/알트코인 KRW 마켓 식별: 문자열 "-KRW" 포함 여부로 간단 구분
|
||||||
|
|
||||||
@@ -118,6 +138,7 @@ def analyze_bottom_period(symbol: str, interval_minutes: int, days: int = 90):
|
|||||||
|
|
||||||
for i in range(len(bottom_data)):
|
for i in range(len(bottom_data)):
|
||||||
slice_df = data.iloc[:data.index.get_loc(bottom_data.index[i]) + 1]
|
slice_df = data.iloc[:data.index.get_loc(bottom_data.index[i]) + 1]
|
||||||
|
slice_df = check_buy_point(slice_df, simulation=True)
|
||||||
info = detect_turnaround_signal(symbol, slice_df, interval=interval_minutes)
|
info = detect_turnaround_signal(symbol, slice_df, interval=interval_minutes)
|
||||||
|
|
||||||
if info:
|
if info:
|
||||||
@@ -161,6 +182,7 @@ def run_simulation(symbol: str, interval_minutes: int, days: int = 30):
|
|||||||
alerts.clear()
|
alerts.clear()
|
||||||
for i in range(len(data)):
|
for i in range(len(data)):
|
||||||
slice_df = data.iloc[: i + 1]
|
slice_df = data.iloc[: i + 1]
|
||||||
|
slice_df = check_buy_point(slice_df, simulation=True)
|
||||||
info = detect_turnaround_signal(symbol, slice_df, interval=interval_minutes, params=params)
|
info = detect_turnaround_signal(symbol, slice_df, interval=interval_minutes, params=params)
|
||||||
if info and info['alert']:
|
if info and info['alert']:
|
||||||
alerts.append((slice_df.index[-1], slice_df['Close'].iloc[-1]))
|
alerts.append((slice_df.index[-1], slice_df['Close'].iloc[-1]))
|
||||||
|
|||||||
Reference in New Issue
Block a user