using chromedriver for collecting corporate earnings
This commit is contained in:
@@ -6,7 +6,7 @@ use chrono::Local;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
|
||||
pub async fn run_full_update(tickers: Vec<String>, config: &Config) -> anyhow::Result<()> {
|
||||
pub async fn run_full_update(client: &fantoccini::Client, tickers: Vec<String>, config: &Config) -> anyhow::Result<()> {
|
||||
println!("Updating {} tickers (prices from {})", tickers.len(), config.corporate_start_date);
|
||||
|
||||
let today = chrono::Local::now().format("%Y-%m-%d").to_string();
|
||||
@@ -15,13 +15,13 @@ pub async fn run_full_update(tickers: Vec<String>, config: &Config) -> anyhow::R
|
||||
print!(" → {:6} ", ticker);
|
||||
|
||||
// Earnings
|
||||
if let Ok(events) = fetch_earnings_history(&ticker).await {
|
||||
if let Ok(events) = fetch_earnings_history(client, &ticker).await {
|
||||
merge_and_save_events(&ticker, events.clone()).await?;
|
||||
println!("{} earnings", events.len());
|
||||
}
|
||||
|
||||
// Prices – now using config.corporate_start_date
|
||||
if let Ok(prices) = fetch_price_history(&ticker, &config.corporate_start_date, &today).await {
|
||||
if let Ok(prices) = fetch_price_history(client, &ticker, &config.corporate_start_date, &today).await {
|
||||
save_prices_for_ticker(&ticker, prices).await?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user