Skip to content

Commit

Permalink
add generic
Browse files Browse the repository at this point in the history
  • Loading branch information
ryqdev committed May 30, 2024
1 parent 7dc72f2 commit d3c895d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/green/green.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ fn fetch_csv_data(symbol: &str) -> impl Iterator<Item = Bar> {
.from_reader(csv_file)
.deserialize();

reader.map(|record:(String, Vec<f64>)| Bar{
// TODO: Why move here
reader.map(move |record:(String, Vec<f64>)| Bar{
date: OffsetDateTime::now_utc(),
open: record.1[0],
high: record.1[1],
Expand All @@ -217,6 +218,25 @@ fn fetch_csv_data(symbol: &str) -> impl Iterator<Item = Bar> {
wap: 0.0,
count: 0,
})

}

fn bar_from_csv<T>(
csv_reader: impl Iterator<Item = XXXX>
) -> impl Iterator<Item = Bar>
where T: XXXX
{
// TODO:
csv_reader.map(move |r| Bar{
date: OffsetDateTime::now_utc(),
open: r.1[0],
high: r.1[1],
low: r.1[2],
close: r.1[3],
volume: 0.0,
wap: 0.0,
count: 0,
})
}

// fn connect_and_fetch_market_data() -> impl Iterator<Item = Bar>{
Expand Down

0 comments on commit d3c895d

Please sign in to comment.