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.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
Merge branch 'main' of https://github.com/Fincept-Corporation/FinceptTerminal
tilakpatel229aa4226722af
diff --cc fincept-qt/CMakeLists.txtindex 8911f7ec0,84d71105c..e24e8f444--- a/fincept-qt/CMakeLists.txt+++ b/fincept-qt/CMakeLists.txt@@@ -712,7 -790,10 +766,11 @@@ set(STORAGE_SOURCEsrc/storage/sqlite/migrations/v022_portfolio_broker_link.cppsrc/storage/sqlite/migrations/v023_algo_trading_deploy.cppsrc/storage/sqlite/migrations/v024_alpha_arena.cpp- src/storage/sqlite/migrations/v025_secure_credentials.cpp+ src/storage/sqlite/migrations/v025_oi_snapshots.cpp+ src/storage/sqlite/migrations/v026_strategies.cpp+ src/storage/sqlite/migrations/v027_fii_dii.cpp+ src/storage/sqlite/migrations/v028_iv_history.cpp++ src/storage/sqlite/migrations/v029_secure_credentials.cpp)# Python runnerdiff --cc fincept-qt/src/ai_chat/LlmService.cppindex c0bc02dc2,23d825fd4..31173dde6--- a/fincept-qt/src/ai_chat/LlmService.cpp+++ b/fincept-qt/src/ai_chat/LlmService.cpp@@@ -124,22 -105,14 +124,22 @@@ void LlmService::ensure_config() constprovider_ = "fincept";model_ = "MiniMax-M2.7";base_url_ = {};- LOG_INFO(TAG, "No LLM provider configured — using Fincept default");+ LOG_INFO(kLlmSvcTag, "No LLM provider configured — using Fincept default");}- // Fincept always resolves API key from session (never stored in llm_configs)+ // Fincept always resolves API key from the authenticated session, never+ // from llm_configs. Prefer AuthManager's in-memory session (authoritative+ // and live); fall back to SettingsRepository("fincept_api_key") which+ // AuthManager writes during auto_configure_fincept_llm (legacy path).if (provider_ == "fincept") {- auto stored_key = SettingsRepository::instance().get("fincept_api_key");- if (stored_key.is_ok() && !stored_key.value().isEmpty())- api_key_ = stored_key.value();+ const auto& sess = fincept::auth::AuthManager::instance().session();+ if (!sess.api_key.isEmpty()) {+ api_key_ = sess.api_key;+ } else {+ auto stored_key = SettingsRepository::instance().get("fincept_api_key");+ if (stored_key.is_ok() && !stored_key.value().isEmpty())+ api_key_ = stored_key.value();+ }}auto gs = LlmConfigRepository::instance().get_global_settings();diff --cc fincept-qt/src/app/main.cppindex a8f579afe,4646c05ca..f04158b04--- a/fincept-qt/src/app/main.cpp+++ b/fincept-qt/src/app/main.cpp@@@ -553,6 -554,9 +566,10 @@@ int main(int argc, char* argv[])fincept::register_migration_v023();fincept::register_migration_v024();fincept::register_migration_v025();+ fincept::register_migration_v026();+ fincept::register_migration_v027();+ fincept::register_migration_v028();++ fincept::register_migration_v029();// Open main databaseQString db_path = fincept::AppPaths::data() + "/fincept.db";diff --cc fincept-qt/src/core/panel/PanelMaterialiser.hindex d8a9986ad,35a5a36f5..a3f97206d--- a/fincept-qt/src/core/panel/PanelMaterialiser.h+++ b/fincept-qt/src/core/panel/PanelMaterialiser.h@@@ -15,17 -38,44 +16,34 @@@ class PanelMaterialiser : public QObjecpublic:static PanelMaterialiser& instance();- void enqueue(const QString& id, std::function<void()> work, int priority = 1);+ /// Construction work to run later. The id is for logging/dedup;+ /// the lambda is the actual constructor invocation (typically a call+ /// into DockScreenRouter::navigate or materialize_screen).+ ///+ /// `owner` is an optional QObject whose lifetime the queued item is+ /// tied to. When `owner` is destroyed, queued items referencing it+ /// are silently dropped via `cancel_for(owner)`. Without an owner,+ /// items remain in the queue indefinitely (or until they fire).+ /// Pass `nullptr` for fire-and-forget semantics.+ void enqueue(const QString& id, std::function<void()> work, int priority = 1,+ QObject* owner = nullptr);++ /// Drop every queued item whose `owner` matches. Called from+ /// WindowFrame's destructor so layouts that close mid-stage don't+ /// burn UI ticks draining no-op lambdas. O(n) over the buffered+ /// queue — buffered queues are typically < 200 items so this is+ /// fast enough on the destruction path.+ void cancel_for(QObject* owner);- /// Drain everything synchronously. Used by tests + by tear-off paths- /// that need a panel up *now*. Avoid on the UI thread during normal- /// operation — the whole point of this class is to NOT block.+ /// Synchronous drain. Used by tests and tear-off paths; avoid during normal UI flow.void drain_all_now();- /// Number of items still queued. Inspectable from the debug overlay.int pending_count() const;- /// Interval between materialisation ticks. Default 16ms (~60fps frame- /// budget). Tunable for tests.void set_tick_interval_ms(int ms);- /// How many items to drain per tick. Default 4. Lower = smoother UI- /// during a layout load, higher = layout finishes faster.void set_max_per_tick(int n);- /// Default max-per-tick. 4 keeps layout-load under ~16ms per frame- /// budget on the panel constructors that take 2-4ms each (the typical- /// case once factories are warm).static constexpr int kDefaultMaxPerTick = 4;static constexpr int kDefaultTickIntervalMs = 16;@@@ -40,8 -92,16 +58,15 @@@struct Item {QString id;std::function<void()> work;+ // Optional owner. Item is dropped before invocation if the+ // QPointer becomes null (i.e. owner was destroyed). Items+ // enqueued without an owner have a default-constructed+ // QPointer that stays "valid" (it never had a target) — the+ // tick handler runs them unconditionally.+ QPointer<QObject> owner;+ bool has_owner = false;};- // Three priority buckets. Drained in 0 → 1 → 2 order each tick.QQueue<Item> q_priority_0_;QQueue<Item> q_priority_1_;QQueue<Item> q_priority_2_;diff --cc fincept-qt/src/core/symbol/SymbolContext.hindex 0b2ec4ecc,d463424d8..c098c4fe3--- a/fincept-qt/src/core/symbol/SymbolContext.h+++ b/fincept-qt/src/core/symbol/SymbolContext.h@@@ -16,14 -34,32 +34,31 @@@ class SymbolContext : public QObjectpublic:static SymbolContext& instance();+ /// The default slot name. Single slot in v1; the constant exists so+ /// future named slots can land without grepping for the literal.+ /// Stored as `QLatin1String` so it implicitly converts to QString+ /// without needing `QStringLiteral` (which only accepts string+ /// literals, not `const char*` variables) at every call site.+ static inline const QLatin1String kPrimarySlot{"primary"};++ /// Convenience: legacy, slot-less, primary-slot accessors. Identical+ /// behaviour to the slot-aware overloads with `slot=kPrimarySlot`.SymbolRef group_symbol(SymbolGroup g) const;bool has_group_symbol(SymbolGroup g) const;-+ /// No-op when ref matches existing value (signals suppressed).void set_group_symbol(SymbolGroup g, const SymbolRef& ref, QObject* source = nullptr);+ /// Slot-aware accessors. v1 producers may continue to publish on+ /// the primary slot via the legacy overloads above; producers that+ /// want to push a comparison/currency context use these.+ SymbolRef group_slot_symbol(SymbolGroup g, const QString& slot) const;+ bool has_group_slot_symbol(SymbolGroup g, const QString& slot) const;+ void set_group_slot_symbol(SymbolGroup g, const QString& slot, const SymbolRef& ref,+ QObject* source = nullptr);++ /// The most recently touched symbol anywhere in the app (group or not).SymbolRef active() const { return active_; }- /// Reset everything to empty. Called when a fresh workspace is loaded- /// that has no saved group state.void clear();QJsonObject to_json() const;diff --cc fincept-qt/src/core/symbol/SymbolRef.hindex 59aeacc04,dab7aa3c4..7c3018b6c--- a/fincept-qt/src/core/symbol/SymbolRef.h+++ b/fincept-qt/src/core/symbol/SymbolRef.h@@@ -12,9 -29,25 +29,24 @@@ struct SymbolRefQString asset_class;QString exchange;+ /// Decision 3.2 time_range slot. Both fields unset by default. When+ /// only one is set, consumers should treat the unset side as+ /// open-ended ("from start_of_data" / "to now"). Time range is opt-in+ /// per panel — most panels ignore it and look at the symbol only.+ QDateTime time_range_start;+ QDateTime time_range_end;++ /// Decision 3.2 selection slot. Free-form id of the row / cell / sub-+ /// element the publisher highlighted. Empty string = no selection.+ QString selection;+bool is_valid() const { return !symbol.isEmpty(); }+ bool has_time_range() const {+ return time_range_start.isValid() || time_range_end.isValid();+ }+ bool has_selection() const { return !selection.isEmpty(); }- /// Bloomberg-style display: "AAPL US Equity", "BTCUSD Binance Crypto",- /// falling back to the raw symbol if context is unknown.+ /// "AAPL US Equity" / "BTCUSD Binance Crypto"; falls back to raw symbol.QString display() const {QString out = symbol;if (!exchange.isEmpty())@@@ -49,8 -101,11 +100,8 @@@return r;}- /// Convenience for call sites that only have a ticker string; defaults- /// to equity asset class, which matches every existing single-string- /// flow in the codebase.static SymbolRef equity(const QString& sym, const QString& exch = {}) {- return SymbolRef{sym.toUpper(), QStringLiteral("equity"), exch};+ return SymbolRef{sym.toUpper(), QStringLiteral("equity"), exch, {}, {}, {}};}};diff --cc fincept-qt/src/screens/ma_analytics/MAAdvancedPanel.cppindex 84b102bda,10281dcbf..41ea16629--- a/fincept-qt/src/screens/ma_analytics/MAAdvancedPanel.cpp+++ b/fincept-qt/src/screens/ma_analytics/MAAdvancedPanel.cpp@@@ -16,10 -15,10 +16,12 @@@#include <QVBoxLayout>#include <QWidget>+using namespace fincept::services::ma;+namespace fincept::screens {+ using namespace fincept::services::ma;+// ═══════════════════════════════════════════════════════════════════════════════// MODULE 7: ADVANCED ANALYTICS// ═══════════════════════════════════════════════════════════════════════════════diff --cc fincept-qt/src/screens/ma_analytics/MAComparisonPanel.cppindex a1cf82388,933111a8b..33e5ef8b7--- a/fincept-qt/src/screens/ma_analytics/MAComparisonPanel.cpp+++ b/fincept-qt/src/screens/ma_analytics/MAComparisonPanel.cpp@@@ -16,10 -15,10 +16,12 @@@#include <QVBoxLayout>#include <QWidget>+using namespace fincept::services::ma;+namespace fincept::screens {+ using namespace fincept::services::ma;+// ═══════════════════════════════════════════════════════════════════════════════// MODULE 8: DEAL COMPARISON// ═══════════════════════════════════════════════════════════════════════════════diff --cc fincept-qt/src/screens/ma_analytics/MADealsPanel.cppindex 50b59b959,62be13296..bfe7554e2--- a/fincept-qt/src/screens/ma_analytics/MADealsPanel.cpp+++ b/fincept-qt/src/screens/ma_analytics/MADealsPanel.cpp@@@ -16,10 -15,9 +16,11 @@@#include <QVBoxLayout>#include <QWidget>+using namespace fincept::services::ma;+namespace fincept::screens {+ using namespace fincept::services::ma;// ═══════════════════════════════════════════════════════════════════════════════// MODULE 3: DEAL DATABASEdiff --cc fincept-qt/src/screens/ma_analytics/MAFairnessPanel.cppindex e4a29b82b,db2552173..183017aa4--- a/fincept-qt/src/screens/ma_analytics/MAFairnessPanel.cpp+++ b/fincept-qt/src/screens/ma_analytics/MAFairnessPanel.cpp@@@ -16,10 -15,10 +16,12 @@@#include <QVBoxLayout>#include <QWidget>+using namespace fincept::services::ma;+namespace fincept::screens {+ using namespace fincept::services::ma;+// ═══════════════════════════════════════════════════════════════════════════════// MODULE 5: FAIRNESS OPINION// ═══════════════════════════════════════════════════════════════════════════════diff --cc fincept-qt/src/screens/ma_analytics/MAIndustryPanel.cppindex 900113fc9,779b90ac0..00b868def--- a/fincept-qt/src/screens/ma_analytics/MAIndustryPanel.cpp+++ b/fincept-qt/src/screens/ma_analytics/MAIndustryPanel.cpp@@@ -16,10 -15,10 +16,12 @@@#include <QVBoxLayout>#include <QWidget>+using namespace fincept::services::ma;+namespace fincept::screens {+ using namespace fincept::services::ma;+// ═══════════════════════════════════════════════════════════════════════════════// MODULE 6: INDUSTRY METRICS// ═══════════════════════════════════════════════════════════════════════════════diff --cc fincept-qt/src/screens/ma_analytics/MAMergerPanel.cppindex bd4e0154d,7e42ae1c3..973d7c23b--- a/fincept-qt/src/screens/ma_analytics/MAMergerPanel.cpp+++ b/fincept-qt/src/screens/ma_analytics/MAMergerPanel.cpp@@@ -16,10 -15,10 +16,12 @@@#include <QVBoxLayout>#include <QWidget>+using namespace fincept::services::ma;+namespace fincept::screens {+ using namespace fincept::services::ma;+// ═══════════════════════════════════════════════════════════════════════════════// MODULE 2: MERGER ANALYSIS// ═══════════════════════════════════════════════════════════════════════════════diff --cc fincept-qt/src/screens/ma_analytics/MAStartupPanel.cppindex af9a5d557,e87aa82fc..3e679775a--- a/fincept-qt/src/screens/ma_analytics/MAStartupPanel.cpp+++ b/fincept-qt/src/screens/ma_analytics/MAStartupPanel.cpp@@@ -16,10 -15,10 +16,12 @@@#include <QVBoxLayout>#include <QWidget>+using namespace fincept::services::ma;+namespace fincept::screens {+ using namespace fincept::services::ma;+// ═══════════════════════════════════════════════════════════════════════════════QWidget* MAModulePanel::build_startup_panel() {diff --cc fincept-qt/src/screens/ma_analytics/MAValuationPanel.cppindex e345c02d7,f6959ca3f..17db3f986--- a/fincept-qt/src/screens/ma_analytics/MAValuationPanel.cpp+++ b/fincept-qt/src/screens/ma_analytics/MAValuationPanel.cpp@@@ -17,10 -16,9 +17,11 @@@#include <QVBoxLayout>#include <QWidget>+using namespace fincept::services::ma;+namespace fincept::screens {+ using namespace fincept::services::ma;// ═══════════════════════════════════════════════════════════════════════════════// MODULE 1: VALUATION TOOLKITdiff --cc fincept-qt/src/storage/sqlite/migrations/MigrationRunner.hindex 6a26b59ae,5a2c4a1cf..c69e1e11a--- a/fincept-qt/src/storage/sqlite/migrations/MigrationRunner.h+++ b/fincept-qt/src/storage/sqlite/migrations/MigrationRunner.h@@@ -72,5 -72,8 +72,9 @@@ void register_migration_v022()void register_migration_v023();void register_migration_v024();void register_migration_v025();+ void register_migration_v026();+ void register_migration_v027();+ void register_migration_v028();++void register_migration_v029();} // namespace finceptdiff --cc fincept-qt/src/storage/sqlite/migrations/v029_secure_credentials.cppindex ddc7a58ae,000000000..64bbee327mode 100644,000000..100644--- a/fincept-qt/src/storage/sqlite/migrations/v029_secure_credentials.cpp+++ b/fincept-qt/src/storage/sqlite/migrations/v029_secure_credentials.cpp@@@ -1,48 -1,0 +1,52 @@@- // v025_secure_credentials — pure-SQL credential store backing SecureStorage.++// v029_secure_credentials — pure-SQL credential store backing SecureStorage.++//++// Renumbered from v025 → v029 during the merge with a8 (which introduced++// v025_oi_snapshots, v026_strategies, v027_fii_dii, v028_iv_history). This++// migration is otherwise unchanged.+//+// Replaces the OS-native keychain backends (Windows Credential Manager,+// macOS Keychain via SecItem, Linux libsecret/QSettings). Values are+// encrypted at rest with AES-256-GCM; the key is derived from machine-local+// identifiers in SecureStorage.cpp. Schema is intentionally minimal — every+// column is needed to decrypt. `iv` is the AES-GCM nonce (12 bytes) and+// `tag` is the authentication tag (16 bytes); both are stored alongside the+// ciphertext per NIST SP 800-38D.++#include "storage/sqlite/migrations/MigrationRunner.h"++#include <QSqlError>+#include <QSqlQuery>++namespace fincept {+namespace {+- static Result<void> v025_sql(QSqlDatabase& db, const char* stmt) {++static Result<void> v029_sql(QSqlDatabase& db, const char* stmt) {+ QSqlQuery q(db);+ if (!q.exec(stmt))+ return Result<void>::err(q.lastError().text().toStdString());+ return Result<void>::ok();+}+- Result<void> apply_v025(QSqlDatabase& db) {- auto r = v025_sql(db, R"sql(++Result<void> apply_v029(QSqlDatabase& db) {++ auto r = v029_sql(db, R"sql(+ CREATE TABLE IF NOT EXISTS secure_credentials (+ key TEXT PRIMARY KEY,+ ciphertext BLOB NOT NULL,+ iv BLOB NOT NULL,+ tag BLOB NOT NULL,+ updated_at TEXT DEFAULT CURRENT_TIMESTAMP+ )+ )sql");+ return r;+}++} // anonymous namespace+- void register_migration_v025() {++void register_migration_v029() {+ static bool done = false;+ if (done) return;+ done = true;- MigrationRunner::register_migration({25, "secure_credentials", apply_v025});++ MigrationRunner::register_migration({29, "secure_credentials", apply_v029});+}++} // namespace finceptdiff --cc fincept-qt/src/storage/workspace/WorkspaceSnapshotRing.cppindex 417883dba,5158810dd..e611de1ea--- a/fincept-qt/src/storage/workspace/WorkspaceSnapshotRing.cpp+++ b/fincept-qt/src/storage/workspace/WorkspaceSnapshotRing.cpp@@@ -147,20 -147,13 +147,27 @@@ Result<void> WorkspaceSnapshotRing::erareturn Result<void>::ok();}+Result<void> WorkspaceSnapshotRing::rename(qint64 snapshot_id, const QString& name) {+ if (!db_ || !db_->is_open())+ return Result<void>::err("WorkspaceDb not open");+ // Empty name → store NULL so the dialog falls back to the auto-generated+ // timestamp label. Trimming protects against whitespace-only renames.+ const QString trimmed = name.trimmed();+ QVariant value = trimmed.isEmpty() ? QVariant() : QVariant(trimmed);+ auto r = db_->execute("UPDATE workspace_snapshot SET name = ? WHERE snapshot_id = ?",+ {value, snapshot_id});+ if (r.is_err())+ return Result<void>::err(r.error());+ return Result<void>::ok();+}++ bool WorkspaceSnapshotRing::would_throttle_auto() const {+ if (last_auto_ms_ == 0)+ return false;+ const qint64 now_ms = QDateTime::currentMSecsSinceEpoch();+ return (now_ms - last_auto_ms_) < min_interval_ms_;+ }+Result<void> WorkspaceSnapshotRing::trim_auto() {if (!db_ || !db_->is_open())return Result<void>::err("WorkspaceDb not open");diff --cc fincept-qt/src/ui/navigation/ToolBar.cppindex cf091c160,1bff57e8d..c3ae0b8fe--- a/fincept-qt/src/ui/navigation/ToolBar.cpp+++ b/fincept-qt/src/ui/navigation/ToolBar.cpp@@@ -408,8 -447,10 +408,9 @@@ QMenu* ToolBar::build_view_menu()qs_research->setStyleSheet(popup_ss());qs_research->addAction("Equity Research", this, [this]() { emit action_triggered("perspective_research"); });qs_research->addAction("Derivatives", this, [this]() { emit action_triggered("perspective_derivatives"); });+ qs_research->addAction("F&&O", this, [this]() { emit action_triggered("perspective_fno"); });qs_research->addAction("M&&A Analytics", this, [this]() { emit action_triggered("perspective_ma"); });- // Portfolio & Marketspersp->addAction("Portfolio View", this, [this]() { emit action_triggered("perspective_portfolio"); });persp->addAction("Markets View", this, [this]() { emit action_triggered("perspective_markets"); });persp->addAction("News View", this, [this]() { emit action_triggered("perspective_news"); });