added lei to isin mapping
This commit is contained in:
@@ -16,8 +16,8 @@ struct DayData {
|
||||
}
|
||||
|
||||
/// Aggregate price data from multiple exchanges, converting all to USD
|
||||
pub async fn aggregate_best_price_data(isin: &str) -> anyhow::Result<()> {
|
||||
let company_dir = get_company_dir(isin);
|
||||
pub async fn aggregate_best_price_data(lei: &str) -> anyhow::Result<()> {
|
||||
let company_dir = get_company_dir(lei);
|
||||
|
||||
for timeframe in ["daily", "5min"].iter() {
|
||||
let source_dir = company_dir.join(timeframe);
|
||||
@@ -136,7 +136,7 @@ pub async fn aggregate_best_price_data(isin: &str) -> anyhow::Result<()> {
|
||||
.unwrap_or_else(|| "unknown".to_string());
|
||||
|
||||
aggregated.push(CompanyPrice {
|
||||
ticker: format!("{}@agg", isin), // Mark as aggregated
|
||||
ticker: format!("{lei}@agg"), // Mark as aggregated
|
||||
date,
|
||||
time,
|
||||
open: data.open,
|
||||
@@ -159,7 +159,7 @@ pub async fn aggregate_best_price_data(isin: &str) -> anyhow::Result<()> {
|
||||
|
||||
// Save aggregation metadata
|
||||
let meta = AggregationMetadata {
|
||||
isin: isin.to_string(),
|
||||
lei: lei.to_string(), // ← CHANGE THIS
|
||||
timeframe: timeframe.to_string(),
|
||||
sources: sources_used.into_iter().collect(),
|
||||
total_bars: aggregated.len(),
|
||||
@@ -169,7 +169,7 @@ pub async fn aggregate_best_price_data(isin: &str) -> anyhow::Result<()> {
|
||||
),
|
||||
aggregated_at: chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string(),
|
||||
};
|
||||
|
||||
|
||||
let meta_path = agg_dir.join("metadata.json");
|
||||
fs::write(&meta_path, serde_json::to_string_pretty(&meta)?).await?;
|
||||
|
||||
@@ -185,7 +185,7 @@ pub async fn aggregate_best_price_data(isin: &str) -> anyhow::Result<()> {
|
||||
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
struct AggregationMetadata {
|
||||
isin: String,
|
||||
lei: String,
|
||||
timeframe: String,
|
||||
sources: Vec<String>,
|
||||
total_bars: usize,
|
||||
|
||||
Reference in New Issue
Block a user