init
This commit is contained in:
31
monitor.py
31
monitor.py
@@ -229,8 +229,8 @@ class Monitor(HTS):
|
||||
try:
|
||||
# 신호 생성 및 최신 포인트 확인
|
||||
data = self.annotate_signals(symbol, data)
|
||||
if data['point'].iloc[-1] != 1:
|
||||
return False
|
||||
#if data['point'].iloc[-1] != 1:
|
||||
# return False
|
||||
|
||||
# 인버스 데이터: 매수 신호를 매도로 처리 (fall_6p, deviation40 만 허용)
|
||||
if is_inverse:
|
||||
@@ -283,11 +283,11 @@ class Monitor(HTS):
|
||||
# Ignore errors in MA calculation so as not to block trading logic
|
||||
pass
|
||||
|
||||
buy_amount = 6000
|
||||
buy_amount = 5100
|
||||
current_time = datetime.now()
|
||||
if data['signal'].iloc[-1] == 'fall_6p':
|
||||
if data['Close'].iloc[-1] > 100:
|
||||
buy_amount = 500000
|
||||
buy_amount = 600000
|
||||
else:
|
||||
buy_amount = 300000
|
||||
|
||||
@@ -305,24 +305,32 @@ class Monitor(HTS):
|
||||
print(f"{symbol}: 매수 금지 중 (남은 시간: {1800 - time_diff.total_seconds():.0f}초)")
|
||||
return False
|
||||
|
||||
buy_amount = 5100
|
||||
if data['signal'].iloc[-1] == 'movingaverage':
|
||||
buy_amount = 30000
|
||||
buy_amount = 100000
|
||||
elif data['signal'].iloc[-1] == 'deviation40':
|
||||
buy_amount = 50000
|
||||
buy_amount = 500000
|
||||
elif data['signal'].iloc[-1] == 'deviation240':
|
||||
buy_amount = 6000
|
||||
buy_amount = 60000
|
||||
elif data['signal'].iloc[-1] == 'deviation1440':
|
||||
if symbol in ['BONK', 'PEPE', 'TON']:
|
||||
buy_amount = 20000
|
||||
buy_amount = 200000
|
||||
else:
|
||||
buy_amount = 30000
|
||||
# heikin_ashi 조건 제거 완료
|
||||
buy_amount = 300000
|
||||
|
||||
if data['signal'].iloc[-1] in ['movingaverage', 'deviation40', 'deviation240', 'deviation1440']:
|
||||
if check_5_week_lowest:
|
||||
buy_amount *= 4
|
||||
|
||||
# 분봉 시스널이 없을 때는 이전 봉보다 높으면 60분 마다 매수
|
||||
if data['point'].iloc[-1] != 1:
|
||||
buy_amount = 30000
|
||||
last_buy_dt = self.buy_cooldown.get(symbol, {}).get('buy', {}).get('datetime')
|
||||
if last_buy_dt:
|
||||
time_diff = current_time - last_buy_dt
|
||||
if time_diff.total_seconds() < 3600:
|
||||
print(f"{symbol}: 매수 금지 중 (남은 시간: {3600 - time_diff.total_seconds():.0f}초)")
|
||||
return False
|
||||
|
||||
_ = self.hts.buyCoinMarket(symbol, buy_amount)
|
||||
|
||||
if self.cooldown_file is not None:
|
||||
@@ -554,6 +562,7 @@ class Monitor(HTS):
|
||||
data = self.get_coin_data(symbol, interval)
|
||||
data_1 = self.get_coin_data(symbol, interval=1)
|
||||
data_1.at[data_1.index[-1], 'Volume'] = data_1['Volume'].iloc[-1] * 60
|
||||
|
||||
saved_data = self.get_coin_saved_data(symbol, interval, data)
|
||||
data = pd.concat([data, saved_data, data_1.iloc[[-1]]], ignore_index=True)
|
||||
data['datetime'] = pd.to_datetime(data['datetime'], format='%Y-%m-%d %H:%M:%S')
|
||||
|
||||
@@ -19,6 +19,12 @@ class MonitorCoin (Monitor):
|
||||
for symbol in KR_COINS_1:
|
||||
|
||||
print("[{}] {}".format(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), symbol))
|
||||
interval = 1440
|
||||
data = self.get_coin_some_data(symbol, interval)
|
||||
data = self.calculate_technical_indicators(data)
|
||||
recent_data = self.annotate_signals(symbol, data)
|
||||
if recent_data['point'].iloc[-1] == 1:
|
||||
|
||||
interval = 60
|
||||
data = self.get_coin_some_data(symbol, interval)
|
||||
if data is not None and not data.empty:
|
||||
@@ -29,6 +35,7 @@ class MonitorCoin (Monitor):
|
||||
|
||||
data = self.calculate_technical_indicators(data)
|
||||
recent_data = self.annotate_signals(symbol, data)
|
||||
|
||||
_ = self.buy_sell_ticker_1h(symbol, recent_data, balances=None, is_inverse=False)
|
||||
except Exception as e:
|
||||
print(f"Error processing data for {symbol}: {str(e)}")
|
||||
|
||||
@@ -17,7 +17,14 @@ class MonitorCoin (Monitor):
|
||||
balances[tmp['currency']] = {'balance': float(tmp['balance']), 'avg_buy_price': float(tmp['avg_buy_price'])}
|
||||
|
||||
for symbol in KR_COINS_2:
|
||||
|
||||
print("[{}] {}".format(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), symbol))
|
||||
interval = 1440
|
||||
data = self.get_coin_some_data(symbol, interval)
|
||||
data = self.calculate_technical_indicators(data)
|
||||
recent_data = self.annotate_signals(symbol, data)
|
||||
if recent_data['point'].iloc[-1] == 1:
|
||||
|
||||
interval = 60
|
||||
data = self.get_coin_some_data(symbol, interval)
|
||||
if data is not None and not data.empty:
|
||||
|
||||
Reference in New Issue
Block a user