adding openfigi as identifier for company data

This commit is contained in:
2025-11-25 22:18:52 +01:00
parent e57a013224
commit eeae94e041
13 changed files with 608 additions and 139 deletions

View File

@@ -4,7 +4,8 @@ mod corporate;
mod config;
mod util;
use fantoccini::{ClientBuilder, Locator};
use fantoccini::{ClientBuilder};
use serde_json::{Map, Value};
use tokio::signal;
#[tokio::main]
@@ -17,11 +18,31 @@ async fn main() -> anyhow::Result<()> {
// === Start ChromeDriver ===
let mut child = std::process::Command::new("chromedriver-win64/chromedriver.exe")
.args(["--port=9515"])
.args(["--port=9515"]) // Level 3 = minimal logs
.spawn()?;
let client = ClientBuilder::native()
.connect("http://localhost:9515")
// Build capabilities to hide infobar + enable full rendering
let port = 9515;
let caps_value = serde_json::json!({
"goog:chromeOptions": {
"args": [
//"--headless",
"--disable-gpu",
"--disable-notifications",
"--disable-popup-blocking",
"--disable-blink-features=AutomationControlled"
],
"excludeSwitches": ["enable-automation"]
}
});
let caps_map: Map<String, Value> = caps_value.as_object()
.expect("Capabilities should be a JSON object")
.clone();
let mut client = ClientBuilder::native()
.capabilities(caps_map)
.connect(&format!("http://localhost:{}", port))
.await?;
// Graceful shutdown
@@ -39,7 +60,6 @@ async fn main() -> anyhow::Result<()> {
// === Corporate Earnings Update ===
println!("\nUpdating Corporate Earnings");
let tickers = config::get_tickers();
corporate::run_full_update(&client, &config).await?;
// === Cleanup ===