adding corporate data to webscraper
This commit is contained in:
38
src/config.rs
Normal file
38
src/config.rs
Normal 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 100–500 tickers here
|
||||
].into_iter().map(String::from).collect()
|
||||
}
|
||||
Reference in New Issue
Block a user