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