init
This commit is contained in:
@@ -157,7 +157,7 @@ def check_buy_signals(symbol, data):
|
||||
'signal_line': latest['Signal'],
|
||||
'buy_signals': buy_signals,
|
||||
'signal_count': signal_count,
|
||||
'buy': signal_count >= 3
|
||||
'buy': signal_count >= 2
|
||||
}
|
||||
|
||||
def format_message(info, market_type):
|
||||
@@ -217,6 +217,7 @@ def get_coin_data(symbol, retries=3):
|
||||
|
||||
if not data.empty:
|
||||
return data
|
||||
|
||||
print(f"No data received for {symbol}, attempt {attempt + 1}")
|
||||
time.sleep(0.5)
|
||||
except Exception as e:
|
||||
@@ -242,6 +243,7 @@ def get_stock_data(symbol, retries=3):
|
||||
)
|
||||
if not data.empty:
|
||||
return data
|
||||
|
||||
print(f"No data received for {symbol}, attempt {attempt + 1}")
|
||||
time.sleep(0.5)
|
||||
except Exception as e:
|
||||
@@ -263,8 +265,9 @@ def monitor_us_stocks():
|
||||
info = check_buy_signals(symbol, data)
|
||||
info['name'] = US_STOCKS[symbol]
|
||||
print(f" - {info['name']} ({symbol}): {info['price']:.2f} -> {info['signal_count']}")
|
||||
|
||||
if info['buy'] or any(info['buy_signals'].values()):
|
||||
|
||||
if info['buy']:
|
||||
#if info['buy'] or any(info['buy_signals'].values()):
|
||||
message += format_message(info, 'US')
|
||||
except Exception as e:
|
||||
print(f"Error processing data for {symbol}: {str(e)}")
|
||||
@@ -292,8 +295,9 @@ def monitor_kr_stocks():
|
||||
info = check_buy_signals(symbol, data)
|
||||
info['name'] = KR_ETFS[symbol]
|
||||
print(f" - {info['name']} ({symbol}): {info['price']:.2f} -> {info['signal_count']}")
|
||||
|
||||
if info['buy'] or any(info['buy_signals'].values()):
|
||||
|
||||
if info['buy']:
|
||||
#if info['buy'] or any(info['buy_signals'].values()):
|
||||
message += format_message(info, 'KR')
|
||||
|
||||
except Exception as e:
|
||||
@@ -324,7 +328,8 @@ def monitor_coins():
|
||||
info['name'] = KR_COINS[symbol]
|
||||
print(f" - {info['name']} ({symbol}): {info['price']:.2f} -> {info['signal_count']}")
|
||||
|
||||
if info['buy'] or any(info['buy_signals'].values()):
|
||||
if info['buy']:
|
||||
#if info['buy'] or any(info['buy_signals'].values()):
|
||||
message += format_message(info, 'KR')
|
||||
except Exception as e:
|
||||
print(f"Error processing data for {symbol}: {str(e)}")
|
||||
@@ -341,9 +346,6 @@ def monitor_coins():
|
||||
|
||||
|
||||
def run_schedule():
|
||||
monitor_coins()
|
||||
monitor_kr_stocks()
|
||||
monitor_us_stocks()
|
||||
|
||||
# 코인 모니터링 스케줄 (매시간 1분, 11분, 21분, 31분, 41분, 51분)
|
||||
for minute in [1, 11, 21, 31, 41, 51]:
|
||||
@@ -362,4 +364,6 @@ def run_schedule():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
monitor_us_stocks()
|
||||
|
||||
run_schedule()
|
||||
|
||||
Reference in New Issue
Block a user