plotting/line_chart_example.py

17 lines
455 B
Python
Raw Normal View History

2023-12-30 14:15:30 +00:00
from database.ohlc import ohlc
from datetime import datetime, timedelta
from line import Line
2023-12-30 14:15:30 +00:00
from line_chart import LineChart
from plot import plot
end_date = datetime.today().date()
2023-12-31 15:15:53 +00:00
start_date = (end_date - timedelta(days = 90))
2023-12-30 14:15:30 +00:00
data = ohlc('SPX.XO', '1d', start_date = start_date, end_date = end_date)
line_chart = LineChart(
x = data['Timestamp'],
lines = [Line(data['Close'], name = 'Close')],
2024-01-03 14:32:29 +00:00
title = 'SPX (Close)'
2023-12-30 14:15:30 +00:00
)
2023-12-31 14:12:37 +00:00
plot(line_chart)