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.

docs update

tilakpatel22547f3fdd8044
diff --git a/README.md b/README.md
index cf5f1d172..50586ca8e 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@
State-of-the-art financial intelligence platform with CFA-level analytics, AI automation, and unlimited data connectivity.
-[📥 Download](https://github.com/Fincept-Corporation/FinceptTerminal/releases) • [📚 Docs](https://github.com/Fincept-Corporation/FinceptTerminal/tree/main/docs) • [💬 Discussions](https://github.com/Fincept-Corporation/FinceptTerminal/discussions) • [💬 Discord](https://discord.gg/ae87a8ygbN)
+[📥 Download](https://github.com/Fincept-Corporation/FinceptTerminal/releases) • [📚 Docs](https://github.com/Fincept-Corporation/FinceptTerminal/tree/main/docs) • [💬 Discussions](https://github.com/Fincept-Corporation/FinceptTerminal/discussions) • [💬 Discord](https://discord.gg/ae87a8ygbN) • [🤝 Partner](https://github.com/Fincept-Corporation/FinceptTerminal/blob/main/docs/COMMERCIAL_LICENSE.md)
![Fincept Terminal](https://raw.githubusercontent.com/Fincept-Corporation/FinceptTerminal/main/images/Equity.png)
@@ -229,9 +229,22 @@ We're building the future of financial analysis—together.
**Contribute:** New data connectors • AI agents • Analytics modules • Documentation • Translations
-**New to the project?** Start with our [Developer Walkthrough](docs/DEVELOPER_WALKTHROUGH.md) for a complete guide to the codebase.
+[Contributing Guide](docs/CONTRIBUTING.md) • [Report Bug](https://github.com/Fincept-Corporation/FinceptTerminal/issues) • [Request Feature](https://github.com/Fincept-Corporation/FinceptTerminal/discussions)
-[Contributing Guide](docs/CONTRIBUTING.md) • [Developer Walkthrough](docs/DEVELOPER_WALKTHROUGH.md) • [Report Bug](https://github.com/Fincept-Corporation/FinceptTerminal/issues) • [Request Feature](https://github.com/Fincept-Corporation/FinceptTerminal/discussions)
+---
+
+## 🎓 For Universities & Educators
+
+**Bring professional-grade financial analytics to your classroom.**
+
+- **$799/month** for 20 accounts
+- Full access to Fincept Data & APIs
+- Perfect for finance, economics, and data science courses
+- CFA curriculum analytics built-in
+
+**Interested?** Email **[email protected]** with your institution name.
+
+[University Licensing Details](https://github.com/Fincept-Corporation/FinceptTerminal/blob/main/docs/COMMERCIAL_LICENSE.md)
---
@@ -240,21 +253,17 @@ We're building the future of financial analysis—together.
**Dual Licensed: AGPL-3.0 (Open Source) + Commercial**
### Open Source (AGPL-3.0)
-- ✅ Free for personal, educational, and non-commercial use
-- ✅ Requires sharing modifications when distributed or used as network service
-- ✅ Full source code transparency
+- Free for personal, educational, and non-commercial use
+- Requires sharing modifications when distributed or used as network service
+- Full source code transparency
### Commercial License
-- 💼 Required for proprietary/SaaS use without open-sourcing modifications
-- 📞 Contact: **[email protected]**
-- 📄 Details: [Commercial License Guide](https://github.com/Fincept-Corporation/FinceptTerminal/blob/main/docs/COMMERCIAL_LICENSE.md)
+- Required for business use or to access Fincept Data/APIs commercially
+- Contact: **[email protected]**
+- Details: [Commercial License Guide](https://github.com/Fincept-Corporation/FinceptTerminal/blob/main/docs/COMMERCIAL_LICENSE.md)
### Trademarks
"Fincept Terminal" and "Fincept" are trademarks of Fincept Corporation.
-See [Trademark Guidelines](https://github.com/Fincept-Corporation/FinceptTerminal/blob/main/docs/TRADEMARK.md).
-
-### Contributors
-By contributing, you agree to our [Contributor License Agreement](https://github.com/Fincept-Corporation/FinceptTerminal/blob/main/docs/CLA.md).
© 2025-2026 Fincept Corporation. All rights reserved.
diff --git a/docs/COMMERCIAL_LICENSE.md b/docs/COMMERCIAL_LICENSE.md
index 9c5efc30e..fb440408c 100644
--- a/docs/COMMERCIAL_LICENSE.md
+++ b/docs/COMMERCIAL_LICENSE.md
@@ -1,4 +1,4 @@
-# Commercial Licensing
+# Commercial & Educational Licensing
## Overview
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/yfinance_data.py b/fincept-terminal-desktop/src-tauri/resources/scripts/yfinance_data.py
index eb0f580cc..fdf53ee9f 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/yfinance_data.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/yfinance_data.py
@@ -77,6 +77,59 @@ def get_historical(symbol, start_date, end_date, interval='1d'):
except Exception as e:
return {"error": str(e), "symbol": symbol}
+def get_historical_price(symbol, target_date):
+ """Fetch closing price for a specific date
+
+ Args:
+ symbol: Stock symbol (e.g., 'AAPL')
+ target_date: Target date (YYYY-MM-DD)
+
+ Returns:
+ dict with price info or error
+ """
+ try:
+ from datetime import datetime, timedelta
+
+ # Parse target date
+ target = datetime.strptime(target_date, '%Y-%m-%d')
+
+ # Fetch a range around the target date (to handle weekends/holidays)
+ start = target - timedelta(days=5)
+ end = target + timedelta(days=1)
+
+ ticker = yf.Ticker(symbol)
+ hist = ticker.history(start=start.strftime('%Y-%m-%d'), end=end.strftime('%Y-%m-%d'), interval='1d')
+
+ if hist.empty:
+ return {"found": False, "error": "No data available for this date range", "symbol": symbol}
+
+ # Find the closest date <= target_date
+ target_ts = target.replace(hour=23, minute=59, second=59)
+ closest_date = None
+ closest_price = None
+
+ for index, row in hist.iterrows():
+ idx_date = index.to_pydatetime().replace(tzinfo=None)
+ if idx_date.date() <= target.date():
+ closest_date = idx_date
+ closest_price = round(float(row['Close']), 2)
+
+ if closest_price is None:
+ # If no date before or on target, take the first available
+ first_row = hist.iloc[0]
+ closest_date = hist.index[0].to_pydatetime()
+ closest_price = round(float(first_row['Close']), 2)
+
+ return {
+ "found": True,
+ "symbol": symbol,
+ "price": closest_price,
+ "date": closest_date.strftime('%Y-%m-%d'),
+ "requested_date": target_date
+ }
+ except Exception as e:
+ return {"found": False, "error": str(e), "symbol": symbol}
+
def get_info(symbol):
"""Fetch company info for a symbol"""
try:
@@ -542,6 +595,15 @@ def main(args=None):
symbol = args[1]
result = resolve_symbol(symbol)
+ elif command == "historical_price":
+ # Get closing price for a specific date
+ if len(args) < 3:
+ result = {"error": "Usage: python yfinance_data.py historical_price <symbol> <date>"}
+ else:
+ symbol = args[1]
+ target_date = args[2] # Format: YYYY-MM-DD
+ result = get_historical_price(symbol, target_date)
+
else:
result = {"error": f"Unknown command: {command}"}
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/portfolio_management.rs b/fincept-terminal-desktop/src-tauri/src/commands/portfolio_management.rs
index 425a002f2..a925f6a40 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/portfolio_management.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/portfolio_management.rs
@@ -125,3 +125,33 @@ pub async fn portfolio_get_transactions(
) -> Result<Vec<Value>, String> {
operations::get_portfolio_transactions(&portfolio_id, limit).map_err(|e| e.to_string())
}
+
+#[tauri::command]
+pub async fn portfolio_update_transaction(
+ transaction_id: String,
+ quantity: f64,
+ price: f64,
+ transaction_date: String,
+ notes: Option<String>,
+) -> Result<(), String> {
+ operations::update_portfolio_transaction(
+ &transaction_id,
+ quantity,
+ price,
+ &transaction_date,
+ notes.as_deref(),
+ )
+ .map_err(|e| e.to_string())
+}
+
+#[tauri::command]
+pub async fn portfolio_delete_transaction(transaction_id: String) -> Result<(), String> {
+ operations::delete_portfolio_transaction(&transaction_id).map_err(|e| e.to_string())
+}
+
+#[tauri::command]
+pub async fn portfolio_get_transaction_by_id(
+ transaction_id: String,
+) -> Result<Option<Value>, String> {
+ operations::get_portfolio_transaction_by_id(&transaction_id).map_err(|e| e.to_string())
+}
diff --git a/fincept-terminal-desktop/src-tauri/src/database/operations.rs b/fincept-terminal-desktop/src-tauri/src/database/operations.rs
index 4d14eb623..05e1f1712 100644
--- a/fincept-terminal-desktop/src-tauri/src/database/operations.rs
+++ b/fincept-terminal-desktop/src-tauri/src/database/operations.rs
@@ -891,6 +891,68 @@ pub fn get_portfolio_transactions(portfolio_id: &str, limit: Option<i32>) -> Res
Ok(transactions)
}
+pub fn update_portfolio_transaction(
+ transaction_id: &str,
+ quantity: f64,
+ price: f64,
+ transaction_date: &str,
+ notes: Option<&str>,
+) -> Result<()> {
+ let pool = get_pool()?;
+ let conn = pool.get()?;
+
+ let total_value = quantity * price;
+
+ conn.execute(
+ "UPDATE portfolio_transactions
+ SET quantity = ?1, price = ?2, total_value = ?3, transaction_date = ?4, notes = ?5
+ WHERE id = ?6",
+ params![quantity, price, total_value, transaction_date, notes, transaction_id],
+ )?;
+
+ Ok(())
+}
+
+pub fn delete_portfolio_transaction(transaction_id: &str) -> Result<()> {
+ let pool = get_pool()?;
+ let conn = pool.get()?;
+
+ conn.execute(
+ "DELETE FROM portfolio_transactions WHERE id = ?1",
+ params![transaction_id],
+ )?;
+
+ Ok(())
+}
+
+pub fn get_portfolio_transaction_by_id(transaction_id: &str) -> Result<Option<serde_json::Value>> {
+ let pool = get_pool()?;
+ let conn = pool.get()?;
+
+ let result = conn
+ .query_row(
+ "SELECT id, portfolio_id, symbol, transaction_type, quantity, price, total_value, transaction_date, notes
+ FROM portfolio_transactions WHERE id = ?1",
+ params![transaction_id],
+ |row| {
+ Ok(serde_json::json!({
+ "id": row.get::<_, String>(0)?,
+ "portfolio_id": row.get::<_, String>(1)?,
+ "symbol": row.get::<_, String>(2)?,
+ "transaction_type": row.get::<_, String>(3)?,
+ "quantity": row.get::<_, f64>(4)?,
+ "price": row.get::<_, f64>(5)?,
+ "total_value": row.get::<_, f64>(6)?,
+ "transaction_date": row.get::<_, String>(7)?,
+ "notes": row.get::<_, Option<String>>(8)?
+ }))
+ },
+ )
+ .optional()?;
+
+ Ok(result)
+}
+
// ============================================================================
// Custom Index Operations (Aggregate Index Feature)
// ============================================================================
diff --git a/fincept-terminal-desktop/src-tauri/src/lib.rs b/fincept-terminal-desktop/src-tauri/src/lib.rs
index 1285b109e..4fca37a19 100644
--- a/fincept-terminal-desktop/src-tauri/src/lib.rs
+++ b/fincept-terminal-desktop/src-tauri/src/lib.rs
@@ -1429,6 +1429,9 @@ pub fn run() {
commands::portfolio_management::portfolio_get_assets,
commands::portfolio_management::portfolio_update_asset_symbol,
commands::portfolio_management::portfolio_get_transactions,
+ commands::portfolio_management::portfolio_update_transaction,
+ commands::portfolio_management::portfolio_delete_transaction,
+ commands::portfolio_management::portfolio_get_transaction_by_id,
// Custom Index Commands (Aggregate Index Feature)
commands::custom_index::custom_index_create,
commands::custom_index::custom_index_get_all,
diff --git a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/PortfolioTab.tsx b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/PortfolioTab.tsx
index ae76e86dd..aeb6df589 100644
--- a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/PortfolioTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/PortfolioTab.tsx
@@ -81,7 +81,9 @@ const PortfolioTab: React.FC = () => {
sellAsset,
deletePortfolio,
refreshPortfolioData,
- exportToCSV
+ exportToCSV,
+ updateTransaction,
+ deleteTransaction
} = usePortfolioOperations();
// Workspace tab state
@@ -598,7 +600,7 @@ const PortfolioTab: React.FC = () => {
) : (
<div style={{ flex: 1, overflow: 'hidden' }}>
{activeSubTab === 'positions' && <div id="positions-view" style={{ height: '100%' }}><PositionsView portfolioSummary={portfolioSummary} /></div>}
- {activeSubTab === 'history' && <div id="history-view" style={{ height: '100%' }}><HistoryView transactions={transactions} currency={currency} /></div>}
+ {activeSubTab === 'history' && <div id="history-view" style={{ height: '100%' }}><HistoryView transactions={transactions} currency={currency} onUpdateTransaction={updateTransaction} onDeleteTransaction={deleteTransaction} /></div>}
{activeSubTab === 'analytics' && <div id="analytics-view" style={{ height: '100%' }}><AnalyticsView portfolioSummary={portfolioSummary} /></div>}
{activeSubTab === 'sectors' && <div id="sectors-view" style={{ height: '100%' }}><SectorsView portfolioSummary={portfolioSummary} /></div>}
{activeSubTab === 'performance' && <div id="performance-view" style={{ height: '100%' }}><PerformanceView portfolioSummary={portfolioSummary} /></div>}
diff --git a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/usePortfolioOperations.ts b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/usePortfolioOperations.ts
index 9df5f0cd8..0421531aa 100644
--- a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/usePortfolioOperations.ts
+++ b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/usePortfolioOperations.ts
@@ -140,6 +140,24 @@ export const usePortfolioOperations = () => {
URL.revokeObjectURL(url);
};
+ // Update transaction
+ const updateTransaction = async (
+ transactionId: string,
+ quantity: number,
+ price: number,
+ transactionDate: string,
+ notes?: string
+ ) => {
+ await portfolioService.updateTransaction(transactionId, quantity, price, transactionDate, notes);
+ await refreshPortfolioData();
+ };
+
+ // Delete transaction
+ const deleteTransaction = async (transactionId: string) => {
+ await portfolioService.deleteTransaction(transactionId);
+ await refreshPortfolioData();
+ };
+
// ==================== EFFECTS (use functions declared above) ====================
// Initialize service and load portfolios
@@ -240,6 +258,8 @@ export const usePortfolioOperations = () => {
sellAsset,
deletePortfolio,
refreshPortfolioData,
- exportToCSV
+ exportToCSV,
+ updateTransaction,
+ deleteTransaction
};
};
diff --git a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/modals/EditTransactionModal.tsx b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/modals/EditTransactionModal.tsx
new file mode 100644
index 000000000..1fd1d6708
--- /dev/null
+++ b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/modals/EditTransactionModal.tsx
@@ -0,0 +1,515 @@
+import React, { useState, useEffect, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useTerminalTheme } from '@/contexts/ThemeContext';
+import { Transaction } from '../../../../services/portfolio/portfolioService';
+import { invoke } from '@tauri-apps/api/core';
+
+interface EditTransactionModalProps {
+ show: boolean;
+ transaction: Transaction | null;
+ onClose: () => void;
+ onSave: (transactionId: string, quantity: number, price: number, transactionDate: string, notes?: string) => void;
+ onDelete: (transactionId: string) => void;
+}
+
+const EditTransactionModal: React.FC<EditTransactionModalProps> = ({
+ show,
+ transaction,
+ onClose,
+ onSave,
+ onDelete
+}) => {
+ const { t } = useTranslation('portfolio');
+ const { colors, fontSize, fontFamily } = useTerminalTheme();
+
+ const [quantity, setQuantity] = useState('');
+ const [price, setPrice] = useState('');
+ const [transactionDate, setTransactionDate] = useState('');
+ const [notes, setNotes] = useState('');
+ const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
+ const [fetchingPrice, setFetchingPrice] = useState(false);
+ const [priceSource, setPriceSource] = useState<'auto' | 'manual' | null>(null);
+ const [priceError, setPriceError] = useState<string | null>(null);
+ const initialDateRef = useRef<string>('');
+
+ // Initialize form when transaction changes
+ useEffect(() => {
+ if (transaction) {
+ setQuantity(transaction.quantity.toString());
+ setPrice(transaction.price.toString());
+ setPriceSource(null);
+ setPriceError(null);
+ // Parse date - handle both ISO format and datetime format
+ const dateStr = transaction.transaction_date;
+ if (dateStr) {
+ // Convert to YYYY-MM-DDTHH:mm format for datetime-local input
+ const date = new Date(dateStr);
+ if (!isNaN(date.getTime())) {
+ const localDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000);
+ const formattedDate = localDate.toISOString().slice(0, 16);
+ setTransactionDate(formattedDate);
+ initialDateRef.current = formattedDate.slice(0, 10); // Store initial date (YYYY-MM-DD)
+ } else {
+ setTransactionDate(dateStr.slice(0, 16));
+ initialDateRef.current = dateStr.slice(0, 10);
+ }
+ }
+ setNotes(transaction.notes || '');
+ }
+ }, [transaction]);
+
+ // Auto-fetch historical price when date changes
+ useEffect(() => {
+ if (!transaction || !transactionDate) return;
+
+ const currentDateOnly = transactionDate.slice(0, 10); // YYYY-MM-DD
+
+ // Only fetch if date actually changed from initial
+ if (currentDateOnly === initialDateRef.current) {
+ return;
+ }
+
+ const fetchHistoricalPrice = async () => {
+ setFetchingPrice(true);
+ setPriceError(null);
+
+ try {
+ const result = await invoke<string>('execute_yfinance_command', {
+ command: 'historical_price',
+ args: [transaction.symbol, currentDateOnly],
+ });
+
+ const parsed = JSON.parse(result);
+
+ if (parsed.found && parsed.price) {
+ setPrice(parsed.price.toString());
+ setPriceSource('auto');
+ if (parsed.date !== currentDateOnly) {
+ setPriceError(`Using price from ${parsed.date} (closest available)`);
+ }
+ } else {
+ setPriceError(parsed.error || 'Price not found');
+ setPriceSource(null);
+ }
+ } catch (error) {
+ console.error('Failed to fetch historical price:', error);
+ setPriceError('Failed to fetch price');
+ setPriceSource(null);
+ } finally {
+ setFetchingPrice(false);
+ }
+ };
+
+ // Debounce: wait 500ms after user stops changing date
+ const timer = setTimeout(fetchHistoricalPrice, 500);
+ return () => clearTimeout(timer);
+ }, [transactionDate, transaction]);
+
+ if (!show || !transaction) return null;
+
+ const handleSave = () => {
+ const qty = parseFloat(quantity);
+ const prc = parseFloat(price);
+
+ if (isNaN(qty) || isNaN(prc) || qty <= 0 || prc <= 0) {
+ return;
+ }
+
+ // Convert local datetime to ISO format
+ const date = new Date(transactionDate);
+ const isoDate = date.toISOString();
+
+ onSave(transaction.id, qty, prc, isoDate, notes || undefined);
+ onClose();
+ };
+
+ const handleDelete = () => {
+ onDelete(transaction.id);
+ setShowDeleteConfirm(false);
+ onClose();
+ };
+
+ return (
+ <div style={{
+ position: 'fixed',
+ top: 0,
+ left: 0,
+ right: 0,
+ bottom: 0,
+ backgroundColor: 'rgba(0,0,0,0.85)',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ zIndex: 9999,
+ }}>
+ <div style={{
+ backgroundColor: colors.panel,
+ border: `2px solid ${colors.primary}`,
+ padding: '24px',
+ minWidth: '450px',
+ maxWidth: '600px',
+ boxShadow: `0 4px 16px ${colors.background}80`,
+ fontFamily,
+ }}>
+ {showDeleteConfirm ? (
+ // Delete confirmation view
+ <>
+ <div style={{
+ color: colors.alert,
+ fontSize: fontSize.heading,
+ fontWeight: 700,
+ marginBottom: '16px',
+ letterSpacing: '0.5px',
+ }}>
+ {t('modals.confirmDelete', 'CONFIRM DELETE')}
+ </div>
+ <p style={{ color: colors.text, marginBottom: '16px', fontSize: fontSize.small }}>
+ {t('modals.deleteTransactionWarning', 'Are you sure you want to delete this transaction? This action cannot be undone.')}
+ </p>
+ <div style={{
+ backgroundColor: colors.background,
+ padding: '12px',
+ marginBottom: '16px',
+ border: '1px solid var(--ft-color-border, #2A2A2A)',
+ }}>
+ <div style={{ color: colors.textMuted, fontSize: fontSize.tiny, marginBottom: '4px' }}>
+ {transaction.transaction_type} - {transaction.symbol}
+ </div>
+ <div style={{ color: 'var(--ft-color-accent, #00E5FF)', fontSize: fontSize.small }}>
+ {transaction.quantity} @ ${transaction.price.toFixed(2)} = ${transaction.total_value.toFixed(2)}
+ </div>
+ </div>
+ <div style={{ display: 'flex', gap: '8px', justifyContent: 'flex-end' }}>
+ <button
+ onClick={() => setShowDeleteConfirm(false)}
+ style={{
+ padding: '6px 12px',
+ backgroundColor: 'transparent',
+ border: '1px solid var(--ft-color-border, #2A2A2A)',
+ color: colors.textMuted,
+ borderRadius: '2px',
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ cursor: 'pointer',
+ textTransform: 'uppercase',
+ }}
+ >
+ {t('modals.cancel', 'CANCEL')}
+ </button>
+ <button
+ onClick={handleDelete}
+ style={{
+ padding: '6px 12px',
+ backgroundColor: colors.alert,
+ color: '#fff',
+ border: 'none',
+ borderRadius: '2px',
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ cursor: 'pointer',
+ textTransform: 'uppercase',
+ }}
+ >
+ {t('modals.delete', 'DELETE')}
+ </button>
+ </div>
+ </>
+ ) : (
+ // Edit form view
+ <>
+ <div style={{
+ display: 'flex',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ marginBottom: '16px',
+ }}>
+ <div style={{
+ color: colors.primary,
+ fontSize: fontSize.heading,
+ fontWeight: 700,
+ letterSpacing: '0.5px',
+ }}>
+ {t('modals.editTransaction', 'EDIT TRANSACTION')}
+ </div>
+ <span style={{
+ padding: '2px 8px',
+ backgroundColor: transaction.transaction_type === 'BUY' ? `${colors.success}20` : `${colors.alert}20`,
+ color: transaction.transaction_type === 'BUY' ? colors.success : colors.alert,
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ borderRadius: '2px',
+ }}>
+ {transaction.transaction_type}
+ </span>
+ </div>
+
+ {/* Symbol (read-only) */}
+ <div style={{ marginBottom: '12px' }}>
+ <label style={{
+ color: colors.textMuted,
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ letterSpacing: '0.5px',
+ textTransform: 'uppercase',
+ display: 'block',
+ marginBottom: '4px',
+ }}>
+ {t('modals.symbol', 'SYMBOL')}
+ </label>
+ <div style={{
+ padding: '8px 10px',
+ backgroundColor: colors.background,
+ color: 'var(--ft-color-accent, #00E5FF)',
+ border: '1px solid var(--ft-color-border, #2A2A2A)',
+ borderRadius: '2px',
+ fontSize: fontSize.small,
+ fontFamily,
+ fontWeight: 700,
+ }}>
+ {transaction.symbol}
+ </div>
+ </div>
+
+ {/* Quantity */}
+ <div style={{ marginBottom: '12px' }}>
+ <label style={{
+ color: colors.textMuted,
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ letterSpacing: '0.5px',
+ textTransform: 'uppercase',
+ display: 'block',
+ marginBottom: '4px',
+ }}>
+ {t('modals.quantity', 'QUANTITY')} *
+ </label>
+ <input
+ type="text"
+ inputMode="decimal"
+ value={quantity}
+ onChange={(e) => { const v = e.target.value; if (v === '' || /^\d*\.?\d*$/.test(v)) setQuantity(v); }}
+ style={{
+ width: '100%',
+ padding: '8px 10px',
+ backgroundColor: colors.background,
+ color: colors.text,
+ border: '1px solid var(--ft-color-border, #2A2A2A)',
+ borderRadius: '2px',
+ fontSize: fontSize.small,
+ fontFamily,
+ outline: 'none',
+ }}
+ onFocus={(e) => { e.currentTarget.style.borderColor = colors.primary; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = 'var(--ft-color-border, #2A2A2A)'; }}
+ />
+ </div>
+
+ {/* Price */}
+ <div style={{ marginBottom: '12px' }}>
+ <div style={{
+ display: 'flex',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ marginBottom: '4px',
+ }}>
+ <label style={{
+ color: colors.textMuted,
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ letterSpacing: '0.5px',
+ textTransform: 'uppercase',
+ }}>
+ {t('modals.price', 'PRICE')} *
+ </label>
+ {fetchingPrice && (
+ <span style={{ color: 'var(--ft-color-warning, #FFD700)', fontSize: fontSize.tiny }}>
+ ● Fetching...
+ </span>
+ )}
+ {!fetchingPrice && priceSource === 'auto' && !priceError && (
+ <span style={{ color: 'var(--ft-color-accent, #00E5FF)', fontSize: fontSize.tiny }}>
+ ✓ Auto-fetched
+ </span>
+ )}
+ {!fetchingPrice && priceError && (
+ <span style={{ color: priceSource === 'auto' ? 'var(--ft-color-warning, #FFD700)' : colors.alert, fontSize: fontSize.tiny }}>
+ {priceError}
+ </span>
+ )}
+ </div>
+ <input
+ type="text"
+ inputMode="decimal"
+ value={price}
+ onChange={(e) => {
+ const v = e.target.value;
+ if (v === '' || /^\d*\.?\d*$/.test(v)) {
+ setPrice(v);
+ setPriceSource('manual');
+ }
+ }}
+ style={{
+ width: '100%',
+ padding: '8px 10px',
+ backgroundColor: colors.background,
+ color: colors.text,
+ border: `1px solid ${fetchingPrice ? 'var(--ft-color-warning, #FFD700)' : 'var(--ft-color-border, #2A2A2A)'}`,
+ borderRadius: '2px',
+ fontSize: fontSize.small,
+ fontFamily,
+ outline: 'none',
+ }}
+ onFocus={(e) => { e.currentTarget.style.borderColor = colors.primary; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = fetchingPrice ? 'var(--ft-color-warning, #FFD700)' : 'var(--ft-color-border, #2A2A2A)'; }}
+ />
+ </div>
+
+ {/* Transaction Date */}
+ <div style={{ marginBottom: '12px' }}>
+ <label style={{
+ color: colors.textMuted,
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ letterSpacing: '0.5px',
+ textTransform: 'uppercase',
+ display: 'block',
+ marginBottom: '4px',
+ }}>
+ {t('modals.transactionDate', 'TRANSACTION DATE')} *
+ </label>
+ <input
+ type="datetime-local"
+ value={transactionDate}
+ onChange={(e) => setTransactionDate(e.target.value)}
+ style={{
+ width: '100%',
+ padding: '8px 10px',
+ backgroundColor: colors.background,
+ color: colors.text,
+ border: '1px solid var(--ft-color-border, #2A2A2A)',
+ borderRadius: '2px',
+ fontSize: fontSize.small,
+ fontFamily,
+ outline: 'none',
+ }}
+ onFocus={(e) => { e.currentTarget.style.borderColor = colors.primary; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = 'var(--ft-color-border, #2A2A2A)'; }}
+ />
+ </div>
+
+ {/* Notes */}
+ <div style={{ marginBottom: '16px' }}>
+ <label style={{
+ color: colors.textMuted,
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ letterSpacing: '0.5px',
+ textTransform: 'uppercase',
+ display: 'block',
+ marginBottom: '4px',
+ }}>
+ {t('modals.notes', 'NOTES')}
+ </label>
+ <input
+ type="text"
+ value={notes}
+ onChange={(e) => setNotes(e.target.value)}
+ style={{
+ width: '100%',
+ padding: '8px 10px',
+ backgroundColor: colors.background,
+ color: colors.text,
+ border: '1px solid var(--ft-color-border, #2A2A2A)',
+ borderRadius: '2px',
+ fontSize: fontSize.small,
+ fontFamily,
+ outline: 'none',
+ }}
+ onFocus={(e) => { e.currentTarget.style.borderColor = colors.primary; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = 'var(--ft-color-border, #2A2A2A)'; }}
+ placeholder={t('modals.notesPlaceholder', 'Optional notes...')}
+ />
+ </div>
+
+ {/* Calculated Total */}
+ <div style={{
+ backgroundColor: colors.background,
+ padding: '12px',
+ marginBottom: '16px',
+ border: '1px solid var(--ft-color-border, #2A2A2A)',
+ display: 'flex',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ }}>
+ <span style={{ color: colors.textMuted, fontSize: fontSize.tiny, fontWeight: 700 }}>
+ {t('modals.totalValue', 'TOTAL VALUE')}
+ </span>
+ <span style={{ color: 'var(--ft-color-warning, #FFD700)', fontSize: fontSize.body, fontWeight: 700 }}>
+ ${(parseFloat(quantity || '0') * parseFloat(price || '0')).toFixed(2)}
+ </span>
+ </div>
+
+ {/* Action Buttons */}
+ <div style={{ display: 'flex', gap: '8px', justifyContent: 'space-between' }}>
+ <button
+ onClick={() => setShowDeleteConfirm(true)}
+ style={{
+ padding: '6px 12px',
+ backgroundColor: 'transparent',
+ border: `1px solid ${colors.alert}`,
+ color: colors.alert,
+ borderRadius: '2px',
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ cursor: 'pointer',
+ textTransform: 'uppercase',
+ letterSpacing: '0.5px',
+ }}
+ >
+ {t('modals.delete', 'DELETE')}
+ </button>
+ <div style={{ display: 'flex', gap: '8px' }}>
+ <button
+ onClick={onClose}
+ style={{
+ padding: '6px 12px',
+ backgroundColor: 'transparent',
+ border: '1px solid var(--ft-color-border, #2A2A2A)',
+ color: colors.textMuted,
+ borderRadius: '2px',
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ cursor: 'pointer',
+ textTransform: 'uppercase',
+ letterSpacing: '0.5px',
+ }}
+ >
+ {t('modals.cancel', 'CANCEL')}
+ </button>
+ <button
+ onClick={handleSave}
+ style={{
+ padding: '6px 16px',
+ backgroundColor: colors.primary,
+ color: colors.background,
+ border: 'none',
+ borderRadius: '2px',
+ fontSize: fontSize.tiny,
+ fontWeight: 700,
+ cursor: 'pointer',
+ textTransform: 'uppercase',
+ letterSpacing: '0.5px',
+ }}
+ >
+ {t('modals.save', 'SAVE')}
+ </button>
+ </div>
+ </div>
+ </>
+ )}
+ </div>
+ </div>
+ );
+};
+
+export default EditTransactionModal;
diff --git a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/portfolio/HistoryView.tsx b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/portfolio/HistoryView.tsx
index af3304172..f297c8cbc 100644
--- a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/portfolio/HistoryView.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/portfolio/HistoryView.tsx
@@ -1,17 +1,22 @@
-import React from 'react';
+import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useTerminalTheme } from '@/contexts/ThemeContext';
import { Transaction } from '../../../../services/portfolio/portfolioService';
import { formatCurrency, formatNumber, formatDateTime } from './utils';
+import { Edit2, Trash2 } from 'lucide-react';
+import EditTransactionModal from '../modals/EditTransactionModal';
interface HistoryViewProps {
transactions: Transaction[];
currency: string;
+ onUpdateTransaction?: (transactionId: string, quantity: number, price: number, transactionDate: string, notes?: string) => void;
+ onDeleteTransaction?: (transactionId: string) => void;
}
-const HistoryView: React.FC<HistoryViewProps> = ({ transactions, currency }) => {
+const HistoryView: React.FC<HistoryViewProps> = ({ transactions, currency, onUpdateTransaction, onDeleteTransaction }) => {
const { t } = useTranslation('portfolio');
const { colors, fontSize, fontFamily } = useTerminalTheme();
+ const [editingTransaction, setEditingTransaction] = useState<Transaction | null>(null);
return (
<div style={{
@@ -57,7 +62,7 @@ const HistoryView: React.FC<HistoryViewProps> = ({ transactions, currency }) =>
{/* Table Header */}
<div style={{
display: 'grid',
- gridTemplateColumns: '1.5fr 1fr 0.8fr 1fr 1fr 1fr 2fr',
+ gridTemplateColumns: '1.5fr 1fr 0.8fr 1fr 1fr 1fr 1.5fr 0.5fr',
gap: '8px',
padding: '8px 12px',
backgroundColor: 'var(--ft-color-header, #1A1A1A)',
@@ -76,6 +81,7 @@ const HistoryView: React.FC<HistoryViewProps> = ({ transactions, currency }) =>
<div style={{ color: colors.primary, textAlign: 'right' }}>{t('history.price', 'PRICE')}</div>
<div style={{ color: colors.primary, textAlign: 'right' }}>{t('history.total', 'TOTAL')}</div>
<div style={{ color: colors.primary }}>{t('history.notes', 'NOTES')}</div>
+ <div style={{ color: colors.primary, textAlign: 'center' }}>{t('history.actions', 'ACTIONS')}</div>
</div>
{/* Transaction Rows */}
@@ -84,7 +90,7 @@ const HistoryView: React.FC<HistoryViewProps> = ({ transactions, currency }) =>
key={txn.id}
style={{
display: 'grid',
- gridTemplateColumns: '1.5fr 1fr 0.8fr 1fr 1fr 1fr 2fr',
+ gridTemplateColumns: '1.5fr 1fr 0.8fr 1fr 1fr 1fr 1.5fr 0.5fr',
gap: '8px',
padding: '8px 12px',
backgroundColor: index % 2 === 0 ? 'rgba(255,255,255,0.03)' : 'transparent',
@@ -120,11 +126,78 @@ const HistoryView: React.FC<HistoryViewProps> = ({ transactions, currency }) =>
<div style={{ color: 'var(--ft-color-warning, #FFD700)', textAlign: 'right', fontWeight: 600 }}>
{formatCurrency(txn.total_value, currency)}
</div>
- <div style={{ color: colors.textMuted, fontSize: fontSize.tiny }}>{txn.notes || '-'}</div>
+ <div style={{ color: colors.textMuted, fontSize: fontSize.tiny, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{txn.notes || '-'}</div>
+ <div style={{ display: 'flex', gap: '4px', justifyContent: 'center' }}>
+ {onUpdateTransaction && (
+ <button
+ onClick={() => setEditingTransaction(txn)}
+ style={{
+ background: 'none',
+ border: 'none',
+ color: colors.textMuted,
+ cursor: 'pointer',
+ padding: '4px',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ transition: 'color 0.15s ease',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.color = colors.primary; }}
+ onMouseLeave={(e) => { e.currentTarget.style.color = colors.textMuted; }}
+ title={t('history.edit', 'Edit transaction')}
+ >
+ <Edit2 size={12} />
+ </button>
+ )}
+ {onDeleteTransaction && (
+ <button
+ onClick={() => {
+ if (window.confirm(t('history.confirmDelete', 'Are you sure you want to delete this transaction?'))) {
+ onDeleteTransaction(txn.id);
+ }
+ }}
+ style={{
+ background: 'none',
+ border: 'none',
+ color: colors.textMuted,
+ cursor: 'pointer',
+ padding: '4px',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ transition: 'color 0.15s ease',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.color = colors.alert; }}
+ onMouseLeave={(e) => { e.currentTarget.style.color = colors.textMuted; }}
+ title={t('history.delete', 'Delete transaction')}
+ >
+ <Trash2 size={12} />
+ </button>
+ )}
+ </div>
</div>
))}
</div>
)}
+
+ {/* Edit Transaction Modal */}
+ <EditTransactionModal
+ show={!!editingTransaction}
+ transaction={editingTransaction}
+ onClose={() => setEditingTransaction(null)}
+ onSave={(transactionId, quantity, price, transactionDate, notes) => {
+ if (onUpdateTransaction) {
+ onUpdateTransaction(transactionId, quantity, price, transactionDate, notes);
+ }
+ setEditingTransaction(null);
+ }}
+ onDelete={(transactionId) => {
+ if (onDeleteTransaction) {
+ onDeleteTransaction(transactionId);
+ }
+ setEditingTransaction(null);
+ }}
+ />
</div>
);
};
diff --git a/fincept-terminal-desktop/src/services/portfolio/portfolioService.ts b/fincept-terminal-desktop/src/services/portfolio/portfolioService.ts
index b1b138f96..5e27c2eca 100644
--- a/fincept-terminal-desktop/src/services/portfolio/portfolioService.ts
+++ b/fincept-terminal-desktop/src/services/portfolio/portfolioService.ts
@@ -264,6 +264,34 @@ class PortfolioService {
return allTransactions.filter(t => t.symbol === symbol.toUpperCase());
}
+ async updateTransaction(
+ transactionId: string,
+ quantity: number,
+ price: number,
+ transactionDate: string,
+ notes?: string
+ ): Promise<void> {
+ portfolioLogger.info(`Updating transaction: ${transactionId}`);
+ await invoke('portfolio_update_transaction', {
+ transactionId,
+ quantity,
+ price,
+ transactionDate,
+ notes,
+ });
+ }
+
+ async deleteTransaction(transactionId: string): Promise<void> {
+ portfolioLogger.info(`Deleting transaction: ${transactionId}`);
+ await invoke('portfolio_delete_transaction', { transactionId });
+ }
+
+ async getTransactionById(transactionId: string): Promise<Transaction | null> {
+ portfolioLogger.info(`Fetching transaction: ${transactionId}`);
+ const transaction = await invoke<Transaction | null>('portfolio_get_transaction_by_id', { transactionId });
+ return transaction;
+ }
+
async getPortfolioSummary(portfolioId: string): Promise<PortfolioSummary> {
portfolioLogger.info(`Calculating portfolio summary: ${portfolioId}`);