From c0f32f4f9c7b2c946309e0aea7f464b064791d92 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Fri, 29 Dec 2023 07:16:11 -0800 Subject: [PATCH] Add example script for plotting a candlestick chart --- candlestick_chart_example.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 candlestick_chart_example.py diff --git a/candlestick_chart_example.py b/candlestick_chart_example.py new file mode 100644 index 0000000..f976975 --- /dev/null +++ b/candlestick_chart_example.py @@ -0,0 +1,18 @@ +from database.ohlc import ohlc +from datetime import datetime, timedelta + +from candlestick_chart import CandlestickChart +from plot import plot + +end_date = datetime.today().date() +start_date = (end_date - timedelta(days=90)) +data = ohlc('SPX.XO', '1d', start_date = start_date, end_date = end_date) + +candlestick_chart = CandlestickChart( + x = data['Timestamp'], + opens = data['Open'], + highs = data['High'], + lows = data['Low'], + closes = data['Close'] +) +plot(candlestick_chart).show() \ No newline at end of file