Skip to content

Instantly share code, notes, and snippets.

@mr-yoo
Created May 16, 2021 08:14
Show Gist options
  • Save mr-yoo/c7e6b5c37d216c64cb358f59f8f9c8d2 to your computer and use it in GitHub Desktop.
Save mr-yoo/c7e6b5c37d216c64cb358f59f8f9c8d2 to your computer and use it in GitHub Desktop.
예쁜 차트 백테스팅 시각화 (패턴검색)
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import pyupbit
pat = [ 100, 90, 80, 70, 90, 120, 140 ]
df = pyupbit.get_ohlcv("KRW-XRP", count=7)
xrp = go.Scatter(
x = df.index,
y = df.close,
name = "XRP"
)
df = pyupbit.get_ohlcv("KRW-ADA", count=7)
ada = go.Scatter(
x = df.index,
y = df.close,
name = "ADA"
)
df = pyupbit.get_ohlcv("KRW-SSX", count=7)
ssx = go.Scatter(
x = df.index,
y = df.close,
name = "SSX"
)
target = go.Scatter(
x = df.index,
y = pat,
name = "PATTERN"
)
fig = make_subplots(rows=2, cols=2)
fig.add_trace(target, row=1, col=1)
fig.add_trace(xrp, row=1, col=2)
fig.add_trace(ada, row=2, col=1)
fig.add_trace(ssx, row=2, col=2)
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment