handle each symbol concurrently
This commit is contained in:
parent
1c302990af
commit
235104ae75
1 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,7 @@ use async_std::prelude::*;
|
|||
use chrono::prelude::*;
|
||||
|
||||
use clap::Parser;
|
||||
use futures::future::try_join_all;
|
||||
use std::{
|
||||
io::{Error, ErrorKind},
|
||||
time::Duration,
|
||||
|
@ -160,9 +161,12 @@ async fn fetch_and_output_symbol_data(
|
|||
from: DateTime<Utc>,
|
||||
to: DateTime<Utc>,
|
||||
) -> std::io::Result<()> {
|
||||
let mut fs = vec![];
|
||||
for symbol in symbols.split(',') {
|
||||
fetch_and_output_closing_data(symbol, from, to).await?;
|
||||
let f = fetch_and_output_closing_data(symbol, from, to);
|
||||
fs.push(f);
|
||||
}
|
||||
try_join_all(fs).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue