ohlc/ohlc.rs
1use plotlars::{Axis, OhlcPlot, Plot};
2use polars::prelude::*;
3
4fn main() {
5 let stock_data = LazyCsvReader::new(PlRefPath::new("data/stock_prices.csv"))
6 .finish()
7 .unwrap()
8 .collect()
9 .unwrap();
10
11 OhlcPlot::builder()
12 .data(&stock_data)
13 .dates("date")
14 .open("open")
15 .high("high")
16 .low("low")
17 .close("close")
18 .plot_title("OHLC Plot")
19 .y_title("price ($)")
20 .y_axis(&Axis::new().show_axis(true))
21 .build()
22 .plot();
23}