init
This commit is contained in:
@@ -127,16 +127,21 @@ def check_buy_point(data, simulation=None):
|
|||||||
else:
|
else:
|
||||||
recent_data = data.tail(10)
|
recent_data = data.tail(10)
|
||||||
|
|
||||||
recent_data['buy_point'] = 0
|
# SettingWithCopyWarning 해결
|
||||||
for i in range(1, len(recent_data)):
|
recent_data.loc[:, 'buy_point'] = 0
|
||||||
if all(recent_data[f'MA{n}'].iloc[i] < recent_data['MA720'].iloc[i] for n in [5, 20, 40, 120, 200, 240]) and \
|
|
||||||
all(recent_data[f'MA{n}'].iloc[i] > recent_data[f'MA{n}'].iloc[i-1] for n in [5, 20, 40, 120, 200, 240]) and \
|
# FutureWarning 해결
|
||||||
recent_data['MA720'].iloc[i] < recent_data['MA1440'].iloc[i]:
|
if recent_data['buy_point'].iloc[-1] != 1:
|
||||||
recent_data.at[recent_data.index[i], 'buy_point'] = 1
|
# 코드 계속
|
||||||
|
for i in range(1, len(recent_data)):
|
||||||
|
if all(recent_data[f'MA{n}'].iloc[i] < recent_data['MA720'].iloc[i] for n in [5, 20, 40, 120, 200, 240]) and \
|
||||||
|
all(recent_data[f'MA{n}'].iloc[i] > recent_data[f'MA{n}'].iloc[i-1] for n in [5, 20, 40, 120, 200, 240]) and \
|
||||||
|
recent_data['MA720'].iloc[i] < recent_data['MA1440'].iloc[i]:
|
||||||
|
recent_data.at[recent_data.index[i], 'buy_point'] = 1
|
||||||
|
|
||||||
if not simulation:
|
if not simulation:
|
||||||
if recent_data['buy_point'][-10:-1].sum() > 0:
|
if recent_data['buy_point'][-10:-1].sum() > 0:
|
||||||
recent_data['buy_point'][-1] = 1
|
recent_data.at[recent_data.index[-1], 'buy_point'] = 1
|
||||||
|
|
||||||
return recent_data
|
return recent_data
|
||||||
|
|
||||||
@@ -261,7 +266,7 @@ def monitor_us_stocks():
|
|||||||
try:
|
try:
|
||||||
data = calculate_technical_indicators(data)
|
data = calculate_technical_indicators(data)
|
||||||
recent_data = check_buy_point(data) # Changed to check_buy_point
|
recent_data = check_buy_point(data) # Changed to check_buy_point
|
||||||
if recent_data['buy_point'][-1] != 1:
|
if recent_data['buy_point'].iloc[-1] != 1:
|
||||||
continue
|
continue
|
||||||
print(f" - {US_STOCKS[symbol]} ({symbol}): {recent_data['Close'][-1]:.2f}")
|
print(f" - {US_STOCKS[symbol]} ({symbol}): {recent_data['Close'][-1]:.2f}")
|
||||||
message_list.append(format_message('US', symbol, US_STOCKS[symbol], recent_data['Close'][-1]))
|
message_list.append(format_message('US', symbol, US_STOCKS[symbol], recent_data['Close'][-1]))
|
||||||
@@ -292,7 +297,7 @@ def monitor_kr_stocks():
|
|||||||
try:
|
try:
|
||||||
data = calculate_technical_indicators(data)
|
data = calculate_technical_indicators(data)
|
||||||
recent_data = check_buy_point(data) # Changed to check_buy_point
|
recent_data = check_buy_point(data) # Changed to check_buy_point
|
||||||
if recent_data['buy_point'][-1] != 1:
|
if recent_data['buy_point'].iloc[-1] != 1:
|
||||||
continue
|
continue
|
||||||
print(f" - {KR_ETFS[symbol]} ({symbol}): {recent_data['Close'][-1]:.2f}")
|
print(f" - {KR_ETFS[symbol]} ({symbol}): {recent_data['Close'][-1]:.2f}")
|
||||||
message_list.append(format_message('KR', symbol, US_STOCKS[symbol], recent_data['Close'][-1]))
|
message_list.append(format_message('KR', symbol, US_STOCKS[symbol], recent_data['Close'][-1]))
|
||||||
@@ -332,7 +337,7 @@ def monitor_coins():
|
|||||||
try:
|
try:
|
||||||
data = calculate_technical_indicators(data)
|
data = calculate_technical_indicators(data)
|
||||||
recent_data = check_buy_point(data) # Changed to check_buy_point
|
recent_data = check_buy_point(data) # Changed to check_buy_point
|
||||||
if recent_data['buy_point'][-1] != 1:
|
if recent_data['buy_point'].iloc[-1] != 1:
|
||||||
continue
|
continue
|
||||||
print(f" - {KR_ETFS[symbol]} ({symbol}): {recent_data['Close'][-1]:.2f}")
|
print(f" - {KR_ETFS[symbol]} ({symbol}): {recent_data['Close'][-1]:.2f}")
|
||||||
message_list.append(format_message('COIN', symbol, US_STOCKS[symbol], recent_data['Close'][-1]))
|
message_list.append(format_message('COIN', symbol, US_STOCKS[symbol], recent_data['Close'][-1]))
|
||||||
@@ -412,4 +417,5 @@ def run_schedule():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
run_schedule()
|
#run_schedule()
|
||||||
|
monitor_coins()
|
||||||
|
|||||||
Reference in New Issue
Block a user