Add example script for plotting a candlestick chart
This commit is contained in:
parent
a7dd63dc0f
commit
c0f32f4f9c
18
candlestick_chart_example.py
Normal file
18
candlestick_chart_example.py
Normal file
@ -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()
|
Loading…
Reference in New Issue
Block a user