init
This commit is contained in:
@@ -216,6 +216,21 @@ def run_simulation(symbol: str, interval_minutes: int, days: int = 30):
|
|||||||
))
|
))
|
||||||
cursor.connect("remove", lambda sel: sel.annotation.set_visible(False))
|
cursor.connect("remove", lambda sel: sel.annotation.set_visible(False))
|
||||||
|
|
||||||
|
# 매수 신호에도 마우스 오버 기능 추가
|
||||||
|
if scatter_buy is not None:
|
||||||
|
cursor2 = mplcursors.cursor(scatter_buy, hover=True)
|
||||||
|
cursor2.connect("add", lambda sel: sel.annotation.set_text(
|
||||||
|
f'매수신호\n날짜: {matplotlib.dates.num2date(sel.target[0]).replace(tzinfo=None).strftime("%Y-%m-%d %H:%M")}\n가격: {sel.target[1]:.2f}'
|
||||||
|
))
|
||||||
|
cursor2.connect("remove", lambda sel: sel.annotation.set_visible(False))
|
||||||
|
|
||||||
|
# 모든 봉에 마우스 오버 기능 추가
|
||||||
|
cursor3 = mplcursors.cursor(line_close, hover=True)
|
||||||
|
cursor3.connect("add", lambda sel: sel.annotation.set_text(
|
||||||
|
f'종가\n날짜: {matplotlib.dates.num2date(sel.target[0]).replace(tzinfo=None).strftime("%Y-%m-%d %H:%M")}\n가격: {sel.target[1]:.2f}'
|
||||||
|
))
|
||||||
|
cursor3.connect("remove", lambda sel: sel.annotation.set_visible(False))
|
||||||
|
|
||||||
ax1.set_ylabel("가격")
|
ax1.set_ylabel("가격")
|
||||||
ax1.legend(loc='upper left', fontsize=10)
|
ax1.legend(loc='upper left', fontsize=10)
|
||||||
ax1.grid(True, linestyle='--', alpha=0.5)
|
ax1.grid(True, linestyle='--', alpha=0.5)
|
||||||
|
|||||||
Reference in New Issue
Block a user