adding corporate data to webscraper

This commit is contained in:
2025-11-21 00:17:59 +01:00
parent 0ea3fcc3b5
commit 9d0d15f3f8
18 changed files with 2128 additions and 970 deletions

38
src/config.rs Normal file
View File

@@ -0,0 +1,38 @@
// src/config.rs
#[derive(Debug, Clone)]
pub struct Config {
// Economic calendar start (usually the earliest available on finanzen.net)
pub economic_start_date: String, // e.g. "2007-02-13"
// Corporate earnings & price history start
pub corporate_start_date: String, // e.g. "2000-01-01" or "2010-01-01"
// How far into the future we scrape economic events
pub economic_lookahead_months: u32, // default: 3
}
impl Default for Config {
fn default() -> Self {
Self {
economic_start_date: "2007-02-13".to_string(),
corporate_start_date: "2010-01-01".to_string(),
economic_lookahead_months: 3,
}
}
}
impl Config {
pub fn target_end_date(&self) -> String {
let now = chrono::Local::now().naive_local().date();
let future = now + chrono::Duration::days(30 * self.economic_lookahead_months as i64);
future.format("%Y-%m-%d").to_string()
}
}
pub fn get_tickers() -> Vec<String> {
vec![
"AAPL", "MSFT", "NVDA", "GOOGL", "AMZN",
"TSLA", "META", "JPM", "V", "WMT",
// ... your 100500 tickers here
].into_iter().map(String::from).collect()
}