init
This commit is contained in:
@@ -121,14 +121,16 @@ def calculate_technical_indicators(data):
|
|||||||
|
|
||||||
def check_buy_point(data, simulation=None):
|
def check_buy_point(data, simulation=None):
|
||||||
|
|
||||||
|
"""
|
||||||
# 매수 포인트 탐지 및 표시
|
# 매수 포인트 탐지 및 표시
|
||||||
if simulation:
|
if simulation:
|
||||||
recent_data = data
|
recent_data = data
|
||||||
else:
|
else:
|
||||||
recent_data = data.tail(10)
|
# recent_data의 복사본 생성
|
||||||
|
recent_data = data.tail(10).copy()
|
||||||
|
|
||||||
# SettingWithCopyWarning 해결
|
# 'buy_point' 열 초기화
|
||||||
recent_data.loc[:, 'buy_point'] = 0
|
recent_data['buy_point'] = 0
|
||||||
|
|
||||||
# FutureWarning 해결
|
# FutureWarning 해결
|
||||||
if recent_data['buy_point'].iloc[-1] != 1:
|
if recent_data['buy_point'].iloc[-1] != 1:
|
||||||
@@ -144,6 +146,26 @@ def check_buy_point(data, simulation=None):
|
|||||||
recent_data.at[recent_data.index[-1], 'buy_point'] = 1
|
recent_data.at[recent_data.index[-1], 'buy_point'] = 1
|
||||||
|
|
||||||
return recent_data
|
return recent_data
|
||||||
|
"""
|
||||||
|
|
||||||
|
# 매수 포인트 탐지 및 표시
|
||||||
|
# 'buy_point' 열 초기화
|
||||||
|
data['buy_point'] = 0
|
||||||
|
|
||||||
|
# FutureWarning 해결
|
||||||
|
if data['buy_point'].iloc[-1] != 1:
|
||||||
|
# 코드 계속
|
||||||
|
for i in range(1, len(data)):
|
||||||
|
if all(data[f'MA{n}'].iloc[i] < data['MA720'].iloc[i] for n in [5, 20, 40, 120, 200, 240]) and \
|
||||||
|
all(data[f'MA{n}'].iloc[i] > data[f'MA{n}'].iloc[i - 1] for n in [5, 20, 40, 120, 200, 240]) and \
|
||||||
|
data['MA720'].iloc[i] < data['MA1440'].iloc[i]:
|
||||||
|
data.at[data.index[i], 'buy_point'] = 1
|
||||||
|
|
||||||
|
if not simulation:
|
||||||
|
if data['buy_point'][-10:-1].sum() > 0:
|
||||||
|
data.at[data.index[-1], 'buy_point'] = 1
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
def format_message(market_type, symbol, symbol_name, close):
|
def format_message(market_type, symbol, symbol_name, close):
|
||||||
message = f"매수 [{market_type}] {symbol_name} ({symbol}) "
|
message = f"매수 [{market_type}] {symbol_name} ({symbol}) "
|
||||||
@@ -417,5 +439,5 @@ def run_schedule():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#run_schedule()
|
run_schedule()
|
||||||
monitor_coins()
|
#monitor_coins()
|
||||||
|
|||||||
Reference in New Issue
Block a user