init
This commit is contained in:
@@ -301,31 +301,32 @@ def get_coin_saved_data(symbol, interval, data):
|
|||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
cursor.execute("select * from (SELECT Open,Close,High,Low,Volume,ymdhms as datetime from " + symbol + " order by ymdhms desc limit 5000) subquery order by ymdhms")
|
cursor.execute("select * from (SELECT Open,Close,High,Low,Volume,ymdhms as datetime from " + symbol + " order by ymdhms desc limit 5000) subquery order by datetime")
|
||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
conn.commit()
|
conn.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
saved_data = pd.DataFrame(result)
|
df = pd.DataFrame(result)
|
||||||
|
df.columns = ['Open','Close','High','Low','Volume','datetime']
|
||||||
data = pd.concat([data, saved_data], ignore_index=True)
|
df = df.set_index('datetime')
|
||||||
data = data.set_index('datetime')
|
df = df.sort_index()
|
||||||
data = data.sort_index()
|
df['datetime'] = df.index
|
||||||
data = data.drop_duplicates(keep='first')
|
return df
|
||||||
data["datetime"] = data.index
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
def get_coin_some_data(symbol, interval):
|
def get_coin_some_data(symbol, interval):
|
||||||
data = get_coin_data(symbol, interval)
|
data = get_coin_data(symbol, interval)
|
||||||
|
data_1 = get_coin_data(symbol, interval=1)
|
||||||
|
data_1.at[data_1.index[-1], 'Volume'] = data_1['Volume'].iloc[-1] * 60
|
||||||
|
|
||||||
saved_data = get_coin_saved_data(symbol, interval, data)
|
saved_data = 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')
|
||||||
data = data.set_index('datetime')
|
data = data.set_index('datetime')
|
||||||
data = data.sort_index()
|
data = data.sort_index()
|
||||||
data = data.drop_duplicates(keep='first')
|
data = data.drop_duplicates(keep='first')
|
||||||
data["datetime"] = data.index
|
data["datetime"] = data.index
|
||||||
# 코인 데이터 1500개 봉 가져오기
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@@ -404,7 +405,7 @@ def monitor_kr_stocks():
|
|||||||
if recent_data['buy_point'].iloc[-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, KR_ETFS[symbol], recent_data['Close'][-1]))
|
||||||
|
|
||||||
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)}")
|
||||||
@@ -443,8 +444,8 @@ def monitor_coins():
|
|||||||
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'].iloc[-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_COINS[symbol]} ({symbol}): {recent_data['Close'][-1]:.2f}")
|
||||||
message_list.append(format_message('COIN', symbol, US_STOCKS[symbol], recent_data['Close'][-1], recent_data['buy_signal'][-1]))
|
message_list.append(format_message('COIN', symbol, KR_COINS[symbol], recent_data['Close'][-1], recent_data['buy_signal'][-1]))
|
||||||
|
|
||||||
# buy
|
# buy
|
||||||
buy_ticker(symbol, recent_data)
|
buy_ticker(symbol, recent_data)
|
||||||
|
|||||||
Reference in New Issue
Block a user