WLD 전용 BB MTF 전략 및 HTML 시뮬 최적화
- strategy.py, candle_features.py, rule_discovery.py로 다봉 BB·캔들 규칙 탐색 - simulation_1h.py: discover 명령, 기본 BB vs 탐색 규칙 자동 선택, Plotly Y축 줌 - mtf_bb.py, downloader/monitor 정리, 다코인 파일 제거 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,52 +1,39 @@
|
||||
"""
|
||||
WLD(월드코인) 실시간 모니터 — 3분 BB MTF (평균회귀 + 돌파).
|
||||
|
||||
전략: strategy.py
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
import time
|
||||
from config import *
|
||||
|
||||
from config import COIN_NAME, COOLDOWN_FILE, MONITOR_LOOP_SLEEP_SEC, SYMBOL
|
||||
from monitor import Monitor
|
||||
|
||||
class MonitorCoin (Monitor):
|
||||
"""자산(코인/주식/ETF) 모니터링 및 매수 실행 클래스"""
|
||||
|
||||
def __init__(self, cooldown_file: str = 'coins_buy_time.json') -> None:
|
||||
class MonitorCoin(Monitor):
|
||||
"""WLD 모니터링 및 매매 실행."""
|
||||
|
||||
def __init__(self, cooldown_file: str = COOLDOWN_FILE) -> None:
|
||||
super().__init__(cooldown_file)
|
||||
|
||||
def monitor_coins(self) -> None:
|
||||
tmps = self.getBalances()
|
||||
balances = {}
|
||||
for tmp in tmps:
|
||||
balances[tmp['currency']] = {'balance': float(tmp['balance']), 'avg_buy_price': float(tmp['avg_buy_price'])}
|
||||
def monitor_wld(self) -> None:
|
||||
"""일봉·1시간 추세 + 3분 신호로 현물 매수/매도."""
|
||||
balances = self.load_balances_dict()
|
||||
print(
|
||||
"[{}] {} ({})".format(
|
||||
datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
||||
COIN_NAME,
|
||||
SYMBOL,
|
||||
)
|
||||
)
|
||||
self.process_wld_mtf(SYMBOL, balances=balances)
|
||||
|
||||
print("[{}] KRW COINs: {}".format(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), ','.join(KR_COINS.keys())))
|
||||
for symbol in KR_COINS:
|
||||
interval = 60
|
||||
data = self.get_coin_some_data(symbol, interval)
|
||||
if data is not None and not data.empty:
|
||||
try:
|
||||
inverseData= self.inverse_data(data)
|
||||
recent_inverseData = self.annotate_signals(symbol, inverseData)
|
||||
if not self.buy_sell_ticker_1h(symbol, recent_inverseData, balances=balances, is_inverse=True):
|
||||
pass
|
||||
|
||||
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)}")
|
||||
else:
|
||||
print(f"Data for {symbol} is empty or None.")
|
||||
|
||||
time.sleep(0.5)
|
||||
|
||||
return
|
||||
# ------------- Scheduler -------------
|
||||
def run_schedule(self) -> None:
|
||||
|
||||
while True:
|
||||
self.monitor_coins()
|
||||
time.sleep(10)
|
||||
self.monitor_wld()
|
||||
time.sleep(MONITOR_LOOP_SLEEP_SEC)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
KR_COINS.keys()
|
||||
|
||||
MonitorCoin().run_schedule()
|
||||
|
||||
Reference in New Issue
Block a user