Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

rust commands updates

tilakpatel22e50354c12393
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/adb.rs b/fincept-terminal-desktop/src-tauri/src/commands/adb.rs
index ee0ad4111..73663b4fc 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/adb.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/adb.rs
@@ -1,6 +1,5 @@
// Asian Development Bank data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute ADB Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_adb_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "adb_data.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "ADB script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute ADB command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("ADB command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "adb_data.py", &cmd_args)
}
/// Get economic indicators for Asian countries
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/bis.rs b/fincept-terminal-desktop/src-tauri/src/commands/bis.rs
index 58dde3ff8..34a13210b 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/bis.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/bis.rs
@@ -1,34 +1,19 @@
// BIS (Bank for International Settlements) data commands based on SDMX API
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute BIS Python script command
#[tauri::command]
pub async fn execute_bis_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "bis_data.py")?;
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute BIS command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("BIS command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "bis_data.py", &cmd_args)
}
// BASIC DATA QUERY COMMANDS
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/bls.rs b/fincept-terminal-desktop/src-tauri/src/commands/bls.rs
index b80e7550d..8c8b9bf81 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/bls.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/bls.rs
@@ -1,43 +1,19 @@
// BLS (Bureau of Labor Statistics) data commands based on OpenBB bls provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute BLS Python script command
#[tauri::command]
pub async fn execute_bls_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "bls_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "BLS script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute BLS command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("BLS command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "bls_data.py", &cmd_args)
}
// SERIES DATA COMMANDS
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/canada_gov.rs b/fincept-terminal-desktop/src-tauri/src/commands/canada_gov.rs
index 2e83e950c..a3292da16 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/canada_gov.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/canada_gov.rs
@@ -1,6 +1,5 @@
// Canadian Government data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Canada Government Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_canada_gov_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "canada_gov_api.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Canada Government script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Canada Government command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Canada Government command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "canada_gov_api.py", &cmd_args)
}
/// Search Canadian government datasets
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/cboe.rs b/fincept-terminal-desktop/src-tauri/src/commands/cboe.rs
index e85691f80..da127ddc3 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/cboe.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/cboe.rs
@@ -1,43 +1,19 @@
// CBOE (Chicago Board Options Exchange) data commands based on OpenBB cboe provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute CBOE Python script command
#[tauri::command]
pub async fn execute_cboe_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "cboe_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "CBOE script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute CBOE command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("CBOE command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "cboe_data.py", &cmd_args)
}
// EQUITY DATA COMMANDS
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/cftc.rs b/fincept-terminal-desktop/src-tauri/src/commands/cftc.rs
index 83e4fbfdb..00a4fc120 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/cftc.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/cftc.rs
@@ -1,43 +1,19 @@
// CFTC (Commodity Futures Trading Commission) data commands based on OpenBB cftc provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute CFTC Python script command
#[tauri::command]
pub async fn execute_cftc_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "cftc_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "CFTC script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute CFTC command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("CFTC command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "cftc_data.py", &cmd_args)
}
// COT DATA COMMANDS
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/coingecko.rs b/fincept-terminal-desktop/src-tauri/src/commands/coingecko.rs
index ef3726811..e3bb91010 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/coingecko.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/coingecko.rs
@@ -1,6 +1,5 @@
// CoinGecko cryptocurrency data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute CoinGecko Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_coingecko_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "coingecko.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "CoinGecko script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute CoinGecko command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("CoinGecko command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "coingecko.py", &cmd_args)
}
/// Get cryptocurrency price
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/congress_gov.rs b/fincept-terminal-desktop/src-tauri/src/commands/congress_gov.rs
index acb1a154c..ec5f26506 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/congress_gov.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/congress_gov.rs
@@ -1,43 +1,19 @@
// Congress.gov data commands based on OpenBB congress_gov provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Congress.gov Python script command
#[tauri::command]
pub async fn execute_congress_gov_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "congress_gov_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "Congress.gov script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Congress.gov command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Congress.gov command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "congress_gov_data.py", &cmd_args)
}
/// Get Congressional bills with various filters
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/data_gov_hk.rs b/fincept-terminal-desktop/src-tauri/src/commands/data_gov_hk.rs
index 8d6cca740..7ca136007 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/data_gov_hk.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/data_gov_hk.rs
@@ -1,6 +1,5 @@
// Hong Kong Government data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Hong Kong Government Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_data_gov_hk_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "data_gov_hk_api.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Hong Kong Government script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Hong Kong Government command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Hong Kong Government command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "data_gov_hk_api.py", &cmd_args)
}
/// Search Hong Kong government datasets
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/databento.rs b/fincept-terminal-desktop/src-tauri/src/commands/databento.rs
index 60c669432..eb8dc3327 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/databento.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/databento.rs
@@ -1,6 +1,5 @@
// Databento market data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Databento Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_databento_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "explore_databento_data.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Databento script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Databento command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Databento command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "explore_databento_data.py", &cmd_args)
}
/// Get market data
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/datagov_au.rs b/fincept-terminal-desktop/src-tauri/src/commands/datagov_au.rs
index 927b23fbc..7019a2ccf 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/datagov_au.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/datagov_au.rs
@@ -1,6 +1,5 @@
// Australian Government data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Australian Government Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_datagov_au_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "datagov_au_api.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Australian Government script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Australian Government command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Australian Government command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "datagov_au_api.py", &cmd_args)
}
/// Search Australian government datasets
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/datagovsg.rs b/fincept-terminal-desktop/src-tauri/src/commands/datagovsg.rs
index 9627293e0..d6b5a4ae2 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/datagovsg.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/datagovsg.rs
@@ -1,6 +1,5 @@
// Singapore Government data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Singapore Government Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_datagovsg_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "datagovsg_data.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Singapore Government script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Singapore Government command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Singapore Government command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "datagovsg_data.py", &cmd_args)
}
/// Search Singapore government datasets
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/datagovuk.rs b/fincept-terminal-desktop/src-tauri/src/commands/datagovuk.rs
index 9a8e2dff7..0983ff5b1 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/datagovuk.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/datagovuk.rs
@@ -1,6 +1,5 @@
// UK Government data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute UK Government Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_datagovuk_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "datagovuk_api.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "UK Government script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute UK Government command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("UK Government command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "datagovuk_api.py", &cmd_args)
}
/// Search UK government datasets
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/ecb.rs b/fincept-terminal-desktop/src-tauri/src/commands/ecb.rs
index 4748fe912..e44c0e8eb 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/ecb.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/ecb.rs
@@ -1,43 +1,19 @@
// ECB (European Central Bank) data commands based on OpenBB ECB provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute ECB Python script command
#[tauri::command]
pub async fn execute_ecb_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "ecb_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "ECB script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute ECB command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("ECB command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "ecb_data.py", &cmd_args)
}
// BASIC DATA ACCESS COMMANDS
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/econdb.rs b/fincept-terminal-desktop/src-tauri/src/commands/econdb.rs
index 228c803d4..746223f12 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/econdb.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/econdb.rs
@@ -1,6 +1,5 @@
// EconDB economic database commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute EconDB Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_econdb_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "econdb_data.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "EconDB script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute EconDB command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("EconDB command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "econdb_data.py", &cmd_args)
}
/// Get economic series data
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/economic_calendar.rs b/fincept-terminal-desktop/src-tauri/src/commands/economic_calendar.rs
index ddea5bc37..dc72012d2 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/economic_calendar.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/economic_calendar.rs
@@ -1,6 +1,5 @@
// Economic calendar events commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Economic Calendar Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_economic_calendar_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "economic_calendar.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Economic Calendar script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Economic Calendar command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Economic Calendar command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "economic_calendar.py", &cmd_args)
}
/// Get today's economic events
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/eia.rs b/fincept-terminal-desktop/src-tauri/src/commands/eia.rs
index cab4525cc..2815c3d1d 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/eia.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/eia.rs
@@ -1,43 +1,19 @@
// EIA (U.S. Energy Information Administration) data commands based on OpenBB eia provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute EIA Python script command
#[tauri::command]
pub async fn execute_eia_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "eia_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "EIA script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute EIA command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("EIA command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "eia_data.py", &cmd_args)
}
// PETROLEUM STATUS REPORT COMMANDS
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/estat_japan.rs b/fincept-terminal-desktop/src-tauri/src/commands/estat_japan.rs
index 0970a9f6e..55531873a 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/estat_japan.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/estat_japan.rs
@@ -1,6 +1,5 @@
// Japan Statistics Bureau data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Japan Statistics Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_estat_japan_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "estat_japan_api.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Japan Statistics script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Japan Statistics command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Japan Statistics command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "estat_japan_api.py", &cmd_args)
}
/// Get statistical data
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/federal_reserve.rs b/fincept-terminal-desktop/src-tauri/src/commands/federal_reserve.rs
index d8823381e..c993a5f71 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/federal_reserve.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/federal_reserve.rs
@@ -1,43 +1,19 @@
// Federal Reserve data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Federal Reserve Python script command
#[tauri::command]
pub async fn execute_federal_reserve_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "federal_reserve_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "Federal Reserve script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Federal Reserve command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Federal Reserve command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "federal_reserve_data.py", &cmd_args)
}
/// Get Federal Funds Rate data
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/fmp.rs b/fincept-terminal-desktop/src-tauri/src/commands/fmp.rs
index 605e12a7c..ef29740f5 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/fmp.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/fmp.rs
@@ -1,43 +1,19 @@
// FMP (Financial Modeling Prep) data commands based on OpenBB fmp provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute FMP Python script command
#[tauri::command]
pub async fn execute_fmp_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "fmp_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "FMP script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute FMP command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("FMP command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "fmp_data.py", &cmd_args)
}
// EQUITY DATA COMMANDS
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/french_gov.rs b/fincept-terminal-desktop/src-tauri/src/commands/french_gov.rs
index b642e3e07..785502e9e 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/french_gov.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/french_gov.rs
@@ -1,6 +1,5 @@
// French Government data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute French Government Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_french_gov_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "french_gov_api.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "French Government script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute French Government command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("French Government command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "french_gov_api.py", &cmd_args)
}
/// Search French government datasets
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/govdata_de.rs b/fincept-terminal-desktop/src-tauri/src/commands/govdata_de.rs
index af8b6b4c6..70588fadd 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/govdata_de.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/govdata_de.rs
@@ -1,6 +1,5 @@
// German Government data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute German Government Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_govdata_de_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "govdata_de_api_complete.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "German Government script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute German Government command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("German Government command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "govdata_de_api_complete.py", &cmd_args)
}
/// Search German government datasets
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/government_us.rs b/fincept-terminal-desktop/src-tauri/src/commands/government_us.rs
index 0e31a0295..cc16b3fba 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/government_us.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/government_us.rs
@@ -1,6 +1,5 @@
// US Government data commands based on OpenBB government_us provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute US Government Python script command
#[tauri::command]
@@ -9,35 +8,12 @@ pub async fn execute_government_us_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "government_us_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "US Government script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute US Government command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("US Government command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "government_us_data.py", &cmd_args)
}
/// Get US Treasury prices for a specific date
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/imf.rs b/fincept-terminal-desktop/src-tauri/src/commands/imf.rs
index 206ae6585..abdeb559e 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/imf.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/imf.rs
@@ -1,43 +1,19 @@
// IMF (International Monetary Fund) data commands based on OpenBB imf provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute IMF Python script command
#[tauri::command]
pub async fn execute_imf_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "imf_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "IMF script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute IMF command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("IMF command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "imf_data.py", &cmd_args)
}
/// Get economic indicators data (IRFCL and FSI)
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/multpl.rs b/fincept-terminal-desktop/src-tauri/src/commands/multpl.rs
index 7fd80bc10..3b3bd9911 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/multpl.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/multpl.rs
@@ -1,43 +1,19 @@
// MULTPL (S&P 500 Multiples) data commands based on OpenBB multpl provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute MULTPL Python script command
#[tauri::command]
pub async fn execute_multpl_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "multpl_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "MULTPL script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute MULTPL command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("MULTPL command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "multpl_data.py", &cmd_args)
}
// BASIC SERIES DATA COMMANDS
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/nasdaq.rs b/fincept-terminal-desktop/src-tauri/src/commands/nasdaq.rs
index 9b9afed07..2171c072e 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/nasdaq.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/nasdaq.rs
@@ -1,44 +1,20 @@
// NASDAQ data commands based on OpenBB nasdaq provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
use chrono::Datelike;
/// Execute NASDAQ Python script command
#[tauri::command]
pub async fn execute_nasdaq_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "nasdaq_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "NASDAQ script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute NASDAQ command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("NASDAQ command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "nasdaq_data.py", &cmd_args)
}
// EQUITY SEARCH AND SCREENER COMMANDS
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/oecd.rs b/fincept-terminal-desktop/src-tauri/src/commands/oecd.rs
index fc42a8645..b52077b23 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/oecd.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/oecd.rs
@@ -1,43 +1,19 @@
// OECD data commands based on OpenBB oecd provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute OECD Python script command
#[tauri::command]
pub async fn execute_oecd_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "oecd_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "OECD script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute OECD command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("OECD command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "oecd_data.py", &cmd_args)
}
/// Get real GDP data for specified countries
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/openafrica.rs b/fincept-terminal-desktop/src-tauri/src/commands/openafrica.rs
index cc6c4dada..29893d2cd 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/openafrica.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/openafrica.rs
@@ -1,6 +1,5 @@
// OpenAFRICA data portal commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute OpenAFRICA Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_openafrica_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "openafrica_api.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "OpenAFRICA script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute OpenAFRICA command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("OpenAFRICA command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "openafrica_api.py", &cmd_args)
}
/// Search African datasets
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/sec.rs b/fincept-terminal-desktop/src-tauri/src/commands/sec.rs
index 13fbc94e1..dcad323ae 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/sec.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/sec.rs
@@ -1,43 +1,19 @@
// SEC (Securities and Exchange Commission) data commands based on OpenBB sec provider
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute SEC Python script command
#[tauri::command]
pub async fn execute_sec_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "sec_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "SEC script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute SEC command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("SEC command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "sec_data.py", &cmd_args)
}
// COMPANY FILINGS COMMANDS
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/sentinelhub.rs b/fincept-terminal-desktop/src-tauri/src/commands/sentinelhub.rs
index e2d5ddf2f..f4c349a02 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/sentinelhub.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/sentinelhub.rs
@@ -1,6 +1,5 @@
// Sentinel Hub satellite data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Sentinel Hub Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_sentinelhub_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "sentinelhub_data.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Sentinel Hub script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Sentinel Hub command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Sentinel Hub command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "sentinelhub_data.py", &cmd_args)
}
/// Get satellite imagery
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/spain_data.rs b/fincept-terminal-desktop/src-tauri/src/commands/spain_data.rs
index 4e48fd4f7..4becd8ea2 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/spain_data.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/spain_data.rs
@@ -1,6 +1,5 @@
// Spanish economic data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Spain data Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_spain_data_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "spain_data.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Spain data script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Spain data command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Spain data command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "spain_data.py", &cmd_args)
}
/// Get Spanish economic indicators
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/swiss_gov.rs b/fincept-terminal-desktop/src-tauri/src/commands/swiss_gov.rs
index 9eb8e8ed9..1476b71f0 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/swiss_gov.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/swiss_gov.rs
@@ -1,6 +1,5 @@
// Swiss Government data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Swiss Government Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_swiss_gov_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "swiss_gov_api.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Swiss Government script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Swiss Government command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Swiss Government command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "swiss_gov_api.py", &cmd_args)
}
/// Search Swiss government datasets
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/trading_economics.rs b/fincept-terminal-desktop/src-tauri/src/commands/trading_economics.rs
index 48d9a9b7a..b93116029 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/trading_economics.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/trading_economics.rs
@@ -1,6 +1,5 @@
// Trading Economics data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute Trading Economics Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_trading_economics_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "trading_economics_data.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "Trading Economics script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute Trading Economics command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("Trading Economics command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "trading_economics_data.py", &cmd_args)
}
/// Get economic indicators for a country
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/worldbank.rs b/fincept-terminal-desktop/src-tauri/src/commands/worldbank.rs
index 53ef69007..0050c88f7 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/worldbank.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/worldbank.rs
@@ -1,6 +1,5 @@
// World Bank data commands
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute World Bank Python script command
#[tauri::command]
@@ -9,31 +8,12 @@ pub async fn execute_worldbank_command(
command: String,
args: Vec<String>,
) -> Result<String, String> {
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "worldbank_data.py")?;
-
- if !script_path.exists() {
- return Err(format!(
- "World Bank script not found at: {}",
- script_path.display()
- ));
- }
-
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ // Build command arguments
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute World Bank command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("World Bank command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "worldbank_data.py", &cmd_args)
}
/// Get World Bank indicator data
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/wto.rs b/fincept-terminal-desktop/src-tauri/src/commands/wto.rs
index 19311a14c..0c609d3d0 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/wto.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/wto.rs
@@ -1,43 +1,19 @@
// WTO (World Trade Organization) data commands based on WTO APIs
-use std::process::Command;
-use crate::utils::python::{get_python_path, get_script_path};
+use crate::utils::python::execute_python_command;
/// Execute WTO Python script command
#[tauri::command]
pub async fn execute_wto_command(
- app: tauri::AppHandle,
+ app: tauri::AppHandle,
command: String,
args: Vec<String>,
) -> Result<String, String> {
- // Get the Python script path
- let python_path = get_python_path(&app)?;
- let script_path = get_script_path(&app, "wto_data.py")?;
-
- // Verify script exists
- if !script_path.exists() {
- return Err(format!(
- "WTO script not found at: {}",
- script_path.display()
- ));
- }
-
// Build command arguments
- let mut cmd_args = vec![script_path.to_string_lossy().to_string(), command];
+ let mut cmd_args = vec![command];
cmd_args.extend(args);
- // Execute Python script
- let output = Command::new(&python_path)
- .args(&cmd_args)
- .output()
- .map_err(|e| format!("Failed to execute WTO command: {}", e))?;
-
- if output.status.success() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- Ok(stdout.to_string())
- } else {
- let stderr = String::from_utf8_lossy(&output.stderr);
- Err(format!("WTO command failed: {}", stderr))
- }
+ // Execute Python script with console window hidden on Windows
+ execute_python_command(&app, "wto_data.py", &cmd_args)
}
// REFERENCE AND OVERVIEW COMMANDS
diff --git a/legacy-python-depreciated/fincept_terminal/Agents/.claude/settings.local.json b/legacy-python-depreciated/fincept_terminal/Agents/.claude/settings.local.json
new file mode 100644
index 000000000..8efd8ec28
--- /dev/null
+++ b/legacy-python-depreciated/fincept_terminal/Agents/.claude/settings.local.json
@@ -0,0 +1,9 @@
+{
+ "permissions": {
+ "allow": [
+ "Read(//c/windowsdisk/finceptTerminal/legacy-python-depreciated/fincept_terminal/Analytics/economics/**)"
+ ],
+ "deny": [],
+ "ask": []
+ }
+}