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.

Merge pr339: add EquityValuationTab (DCF, Altman Z, Piotroski F, Beneish M)

tilakpatel22fef2ca294883
diff --cc fincept-qt/CMakeLists.txt
index 39999d414,ca62d5882..f4e2a1e7f
--- a/fincept-qt/CMakeLists.txt
+++ b/fincept-qt/CMakeLists.txt
@@@ -1951,7 -1777,10 +1951,9 @@@ set(SCREEN_SOURCE
src/screens/equity_research/EquityFinancialsTab_Views.cpp
src/screens/equity_research/EquityFinancialsTab_Populate.cpp
src/screens/equity_research/EquityAnalysisTab.cpp
+ src/screens/equity_research/EquityValuationTab.h
+ src/screens/equity_research/EquityValuationTab.cpp
src/screens/equity_research/EquityTechnicalsTab.cpp
- src/screens/equity_research/EquityTalippTab.cpp
src/screens/equity_research/EquityPeersTab.cpp
src/screens/equity_research/EquityNewsTab.cpp
src/screens/equity_research/EquitySentimentTab.cpp
diff --cc fincept-qt/src/screens/equity_research/EquityResearchScreen.cpp
index 532d7aed6,5859ba2ef..48e10d16c
--- a/fincept-qt/src/screens/equity_research/EquityResearchScreen.cpp
+++ b/fincept-qt/src/screens/equity_research/EquityResearchScreen.cpp
@@@ -16,7 -22,10 +23,9 @@@
#include "screens/equity_research/EquityOverviewTab.h"
#include "screens/equity_research/EquityPeersTab.h"
#include "screens/equity_research/EquitySentimentTab.h"
-#include "screens/equity_research/EquityTalippTab.h"
#include "screens/equity_research/EquityTechnicalsTab.h"
+
+ #include "screens/equity_research/EquityValuationTab.h"
#include "services/backtesting/BacktestingService.h"
#include "services/equity/EquityResearchService.h"
#include "ui/theme/Theme.h"
@@@ -57,28 -77,19 +78,34 @@@ EquityResearchScreen::EquityResearchScr
services::equity::EquityResearchService::instance().load_symbol(current_symbol_);
});
- // Wire service signals
+ // "connect" wires signals to slots.
+ // When the service finishes loading a quote or stock info,
+ // it emits a signal → our slot functions get called automatically.
auto& svc = services::equity::EquityResearchService::instance();
- connect(&svc, &services::equity::EquityResearchService::quote_loaded,
- this, &EquityResearchScreen::on_quote_loaded);
- connect(&svc, &services::equity::EquityResearchService::info_loaded,
- this, &EquityResearchScreen::on_info_loaded);
+ connect(&svc, &services::equity::EquityResearchService::quote_loaded, this, &EquityResearchScreen::on_quote_loaded);
+ connect(&svc, &services::equity::EquityResearchService::info_loaded, this, &EquityResearchScreen::on_info_loaded);
++ // Financials feed the Valuation tab (DCF / scoring models).
+ connect(&svc, &services::equity::EquityResearchService::financials_loaded,
- this, &EquityResearchScreen::on_financials_loaded);
++ this, &EquityResearchScreen::on_financials_loaded);
+ // Reset the quote bar off "Loading…" when the quote fetch fails (it's otherwise
+ // updated only on the success path, so a failed symbol shows "Loading…" forever).
+ connect(&svc, &services::equity::EquityResearchService::error_occurred, this,
+ [this](const QString& ctx, const QString&) {
+ if (ctx == "Quote" && price_label_)
+ price_label_->setText(tr("Unavailable"));
+ });
+
+ // Keep the BUY/SELL buttons in sync as broker accounts connect/disconnect or
+ // are added/removed, so they appear/disappear without needing a tab re-show.
+ auto& am = trading::AccountManager::instance();
+ connect(&am, &trading::AccountManager::connection_state_changed, this,
+ [this](const QString&, trading::ConnectionState) { update_trade_buttons(); });
+ connect(&am, &trading::AccountManager::account_added, this, [this](const QString&) { update_trade_buttons(); });
+ connect(&am, &trading::AccountManager::account_removed, this, [this](const QString&) { update_trade_buttons(); });
+ connect(&am, &trading::AccountManager::account_updated, this, [this](const QString&) { update_trade_buttons(); });
- // Listen for navigation from CommandBar asset search
+ // Listen on the app-wide event bus for "load this symbol" requests
+ // from other parts of the app (e.g. the command bar search).
EventBus::instance().subscribe("equity_research.load_symbol", [this](const QVariantMap& payload) {
const QString symbol = payload.value("symbol").toString();
if (!symbol.isEmpty())
@@@ -118,18 -142,15 +159,19 @@@ void EquityResearchScreen::build_ui()
vl->setContentsMargins(0, 0, 0, 0);
vl->setSpacing(0);
- vl->addWidget(build_title_bar());
- vl->addWidget(build_quote_bar());
+ vl->addWidget(build_title_bar()); // row 1: "EQUITY RESEARCH AAPL [BACKTEST] [CSV]"
+ vl->addWidget(build_quote_bar()); // row 2: price, change %, volume, H/L, mkt cap
- // ── Tabs ─────────────────────────────────────────────────────────────────
+ // ── Tab Widget ───────────────────────────────────────────────────────────
+ // QTabWidget is the clickable tabs bar + the content area below it.
tab_widget_ = new QTabWidget;
- tab_widget_->setDocumentMode(true); // cleaner look, no border around pane
-
- // Style the tab bar using Qt StyleSheets (similar to CSS)
+ tab_widget_->setDocumentMode(true);
+ // Don't let the style elide tab labels — the macOS tab-bar style hint
+ // defaults to ElideRight, which truncates "OVERVIEW"→"OVERVI…" even when
+ // there's room. Size tabs to their content and only scroll when narrow.
+ tab_widget_->tabBar()->setElideMode(Qt::ElideNone);
+ tab_widget_->tabBar()->setExpanding(false);
+ tab_widget_->setUsesScrollButtons(true);
tab_widget_->setStyleSheet(QString(R"(
QTabWidget::pane { border:0; background:%1; }
QTabBar::tab {
@@@ -138,34 -159,48 +180,45 @@@
font-size:12px; text-transform:uppercase; letter-spacing:1px;
}
QTabBar::tab:selected { color:%4; border-bottom:2px solid %4; }
- QTabBar::tab:hover { color:%5; }
+ QTabBar::tab:hover { color:%5; }
)")
- .arg(ui::colors::BG_BASE(), ui::colors::BG_SURFACE(), ui::colors::TEXT_SECONDARY(),
- ui::colors::AMBER(), ui::colors::TEXT_PRIMARY()));
+ .arg(ui::colors::BG_BASE(), ui::colors::BG_SURFACE(), ui::colors::TEXT_SECONDARY(),
+ ui::colors::AMBER(), ui::colors::TEXT_PRIMARY()));
- overview_tab_ = new EquityOverviewTab;
+ // Create one instance of each tab widget.
+ // Each tab is its own class that knows how to display its own content.
+ overview_tab_ = new EquityOverviewTab;
financials_tab_ = new EquityFinancialsTab;
- analysis_tab_ = new EquityAnalysisTab;
+ analysis_tab_ = new EquityAnalysisTab;
technicals_tab_ = new EquityTechnicalsTab;
- talipp_tab_ = new EquityTalippTab;
- peers_tab_ = new EquityPeersTab;
- news_tab_ = new EquityNewsTab;
- sentiment_tab_ = new EquitySentimentTab;
- valuation_tab_ = new EquityValuationTab; // ← our new tab
-
- // addTab(widget, label) registers each tab.
- // We pass empty QString() as label because retranslateUi() sets
- // the real text — this way tab ORDER never depends on text width.
+ peers_tab_ = new EquityPeersTab;
+ news_tab_ = new EquityNewsTab;
+ sentiment_tab_ = new EquitySentimentTab;
++ valuation_tab_ = new EquityValuationTab;
+
+ // Tab titles are re-set by retranslateUi(); add with placeholder strings
+ // first so the tab order remains fixed regardless of locale text width.
- tab_widget_->addTab(overview_tab_, QString());
- tab_widget_->addTab(financials_tab_, QString());
- tab_widget_->addTab(analysis_tab_, QString());
- tab_widget_->addTab(technicals_tab_, QString());
- tab_widget_->addTab(peers_tab_, QString());
- tab_widget_->addTab(news_tab_, QString());
- tab_widget_->addTab(sentiment_tab_, QString());
-
- connect(tab_widget_, &QTabWidget::currentChanged, this, &EquityResearchScreen::on_tab_changed);
-
- vl->addWidget(tab_widget_, 1);
+ tab_widget_->addTab(overview_tab_, QString()); // index 0
+ tab_widget_->addTab(financials_tab_, QString()); // index 1
+ tab_widget_->addTab(analysis_tab_, QString()); // index 2
+ tab_widget_->addTab(technicals_tab_, QString()); // index 3
- tab_widget_->addTab(talipp_tab_, QString()); // index 4
- tab_widget_->addTab(peers_tab_, QString()); // index 5
- tab_widget_->addTab(news_tab_, QString()); // index 6
- tab_widget_->addTab(sentiment_tab_, QString()); // index 7
- tab_widget_->addTab(valuation_tab_, QString()); // index 8 ← new
++ tab_widget_->addTab(peers_tab_, QString()); // index 4
++ tab_widget_->addTab(news_tab_, QString()); // index 5
++ tab_widget_->addTab(sentiment_tab_, QString()); // index 6
++ tab_widget_->addTab(valuation_tab_, QString()); // index 7 ← new
+
+ // When the user clicks a different tab, call on_tab_changed()
+ connect(tab_widget_, &QTabWidget::currentChanged,
+ this, &EquityResearchScreen::on_tab_changed);
+
+ vl->addWidget(tab_widget_, 1); // "1" = stretch factor, fills remaining height
}
+ // ═══════════════════════════════════════════════════════════════════════════════
+ // build_title_bar()
+ // Builds the top bar: "EQUITY RESEARCH AAPL [BACKTEST] [↓ CSV]"
+ // Returns a QWidget* that build_ui() adds to the layout.
+ // ═══════════════════════════════════════════════════════════════════════════════
QWidget* EquityResearchScreen::build_title_bar() {
auto* container = new QWidget(this);
container->setFixedHeight(48);
@@@ -192,30 -232,7 +250,31 @@@
link_group_);
hl->addWidget(symbol_label_);
+ // BUY / SELL — visible only when a broker is connected (paper or live) and the
+ // current symbol is tradable via the connected (Indian) broker. Clicking opens
+ // the SAME order ticket used in the Equity Trading tab (see on_trade_clicked()).
+ auto make_trade_btn = [&](const QString& text, const QString& color) -> QPushButton* {
+ auto* b = new QPushButton(text, container);
+ b->setCursor(Qt::PointingHandCursor);
+ b->setFixedHeight(24);
+ b->setStyleSheet(
+ QString("QPushButton { background:transparent; color:%1; border:1px solid %1;"
+ "padding:0 14px; font-size:%2px; font-family:%3; font-weight:700; letter-spacing:1px; }"
+ "QPushButton:hover { background:%1; color:%4; }")
+ .arg(color)
+ .arg(ui::fonts::TINY)
+ .arg(ui::fonts::DATA_FAMILY)
+ .arg(ui::colors::BG_BASE()));
+ b->setVisible(false);
+ hl->addWidget(b);
+ return b;
+ };
+ buy_btn_ = make_trade_btn(tr("BUY"), ui::colors::POSITIVE());
+ sell_btn_ = make_trade_btn(tr("SELL"), ui::colors::NEGATIVE());
+ connect(buy_btn_, &QPushButton::clicked, this, [this]() { on_trade_clicked(true); });
+ connect(sell_btn_, &QPushButton::clicked, this, [this]() { on_trade_clicked(false); });
+
+ // BACKTEST button — sends user to the backtesting screen with this symbol
auto* backtest_btn = new QPushButton(tr("BACKTEST"), container);
backtest_btn->setCursor(Qt::PointingHandCursor);
backtest_btn->setFixedHeight(24);
@@@ -327,8 -353,18 +395,18 @@@ void EquityResearchScreen::on_info_load
mktcap_label_->setText(tr("MKT CAP: %1").arg(QStringLiteral("—")));
}
}
+ if (valuation_tab_)
- valuation_tab_->set_stock_info(info);
++ valuation_tab_->set_stock_info(info);
}
+ // ═══════════════════════════════════════════════════════════════════════════════
+ // on_tab_changed(int index)
+ // Called every time the user clicks a different tab.
+ // "index" is which tab they clicked (0=Overview, 1=Financials, etc.)
+ //
+ // This is "lazy loading" — we only fetch data for a tab when the user
+ // actually opens it, instead of loading everything upfront.
+ // ═══════════════════════════════════════════════════════════════════════════════
void EquityResearchScreen::on_tab_changed(int index) {
ScreenStateManager::instance().notify_changed(this);
if (current_symbol_.isEmpty())
@@@ -351,17 -387,26 +429,22 @@@
svc.fetch_technicals(current_symbol_);
break;
case 4:
- talipp_tab_->set_symbol(current_symbol_);
- break;
- case 5:
peers_tab_->set_symbol(current_symbol_);
break;
- case 6:
+ case 5:
+ // News tab owns its own fetch (provider-aware) via set_symbol().
news_tab_->set_symbol(current_symbol_);
- svc.fetch_news(current_symbol_);
break;
- case 7:
+ case 6:
sentiment_tab_->set_symbol(current_symbol_);
break;
- default:
- case 8:
- // FIX 3: "set_symbol" not "set symbol" (no space!)
++ case 7:
+ valuation_tab_->set_symbol(current_symbol_);
- // Also fetch financial data needed for scoring models
++ // Fetch the financial data the scoring models (DCF, Altman Z, …) need.
+ svc.fetch_financials(current_symbol_);
break;
+ default:
+ break; // case 0 (Overview) needs no lazy load
}
}
@@@ -370,24 -420,21 +458,23 @@@ void EquityResearchScreen::load_symbol(
if (symbol.isEmpty() || symbol == current_symbol_)
return;
current_symbol_ = symbol;
+ last_price_ = 0.0; // stale until the new symbol's quote arrives
- // Update title bar and quote bar
+ // Update the text in title bar and quote bar immediately
symbol_label_->setText(symbol);
sym_label_->setText(symbol);
price_label_->setText(tr("Loading…"));
+ update_trade_buttons(); // a new symbol may (un)hide BUY/SELL
- // Overview always loads (tab 0 is default)
+ // Overview tab always refreshes (it's the default landing tab)
overview_tab_->set_symbol(symbol);
- // Load data for currently active tab
+ // Also refresh whichever tab is currently open
on_tab_changed(tab_widget_->currentIndex());
- // Trigger quote + info + historical
+ // Tell the service to go fetch quote + info data from the API
services::equity::EquityResearchService::instance().load_symbol(symbol);
- // Subscribe to broker live quote if this is an Indian stock with Fyers connected
if (isVisible())
hub_subscribe_broker_quote();
@@@ -626,16 -673,25 +717,25 @@@ void EquityResearchScreen::retranslateU
tab_widget_->setTabText(1, tr("Financials"));
tab_widget_->setTabText(2, tr("Analysis"));
tab_widget_->setTabText(3, tr("Technicals"));
- tab_widget_->setTabText(4, QStringLiteral("TALIpp")); // library name, not translated
- tab_widget_->setTabText(5, tr("Peers"));
- tab_widget_->setTabText(6, tr("News"));
- tab_widget_->setTabText(7, tr("Sentiment"));
- tab_widget_->setTabText(8, tr("Valuation")); // ← our new tab label
+ tab_widget_->setTabText(4, tr("Peers"));
+ tab_widget_->setTabText(5, tr("News"));
+ tab_widget_->setTabText(6, tr("Sentiment"));
++ tab_widget_->setTabText(7, tr("Valuation"));
}
}
+ // ═══════════════════════════════════════════════════════════════════════════════
+ // save_state / restore_state
+ // Used by the screen manager to remember which symbol and tab were open
+ // when the user closes and reopens the panel.
+ // ═══════════════════════════════════════════════════════════════════════════════
QVariantMap EquityResearchScreen::save_state() const {
- QVariantMap state{{"symbol", current_symbol_}, {"tab_index", tab_widget_ ? tab_widget_->currentIndex() : 0}};
+ QVariantMap state{
+ {"symbol", current_symbol_},
+ {"tab_index", tab_widget_ ? tab_widget_->currentIndex() : 0}
+ };
if (peers_tab_) state["peers"] = peers_tab_->peers_text();
+ if (news_tab_) state["news_provider"] = news_tab_->provider_key();
return state;
}
@@@ -664,35 -718,25 +767,33 @@@ void EquityResearchScreen::restore_stat
void EquityResearchScreen::hub_subscribe_broker_quote() {
hub_unsubscribe_broker_quote();
- if (current_symbol_.isEmpty())
- return;
- // Only Indian stocks are streamable via Fyers
- if (!current_symbol_.endsWith(QStringLiteral(".NS")) && !current_symbol_.endsWith(QStringLiteral(".BO")))
+ if (current_symbol_.isEmpty()) return;
+ if (!current_symbol_.endsWith(QStringLiteral(".NS")) &&
+ !current_symbol_.endsWith(QStringLiteral(".BO")))
return;
+ // Find a connected Indian-region broker account (any — not only Fyers). NSE/
+ // BSE quotes stream through whichever Indian broker the user has live;
+ // hardcoding "fyers" left every other connected broker (Zerodha, Upstox,
+ // AngelOne, …) without research quotes. Pick the first Connected IN broker.
const auto accounts = trading::AccountManager::instance().active_accounts();
- QString fyers_account_id;
+ QString quote_broker_id, quote_account_id;
for (const auto& a : accounts) {
- if (a.broker_id == QStringLiteral("fyers") &&
- a.state == trading::ConnectionState::Connected) {
- fyers_account_id = a.account_id;
+ if (a.state != trading::ConnectionState::Connected)
+ continue;
+ auto* b = trading::BrokerRegistry::instance().get(a.broker_id);
+ if (b && b->profile().region == QLatin1String("IN")) {
+ quote_broker_id = a.broker_id;
+ quote_account_id = a.account_id;
break;
}
}
- if (fyers_account_id.isEmpty()) return;
+ if (quote_account_id.isEmpty())
+ return;
- // Strip .NS/.BO suffix to get plain broker symbol
QString broker_sym = current_symbol_.left(current_symbol_.length() - 3);
- const QString topic = trading::broker_topic(
- QStringLiteral("fyers"), fyers_account_id, QStringLiteral("quote"), broker_sym);
+ const QString topic = trading::broker_topic(quote_broker_id, quote_account_id,
+ QStringLiteral("quote"), broker_sym);
const QString sym = current_symbol_;
datahub::DataHub::instance().subscribe(this, topic, [this, sym](const QVariant& v) {
@@@ -723,111 -765,9 +822,115 @@@ void EquityResearchScreen::hub_unsubscr
if (isVisible())
refresh_timer_->start();
}
+ void EquityResearchScreen::on_financials_loaded(services::equity::FinancialsData data) {
+ if (valuation_tab_)
+ valuation_tab_->set_financials(data);
+ }
-} // namespace fincept::screens
+// ── In-tab trading ──────────────────────────────────────────────────────────
+
+// Resolve a yfinance research symbol to a broker-tradable route, matched against
+// any broker's BrokerProfile.exchanges (works for every region — not a hardcoded
+// IN/US split). `match_exchanges` is the set a broker must serve to trade it;
+// `order_exchange` is what to put on the order (definite for single-venue markets,
+// empty for US where the broker routes by symbol and we can't tell NYSE/NASDAQ
+// apart). Unknown/forex symbols → not routable.
+struct ResearchTradeRoute {
+ QString bare; // broker symbol (suffix stripped)
+ QString order_exchange; // exchange for the order, or empty → broker default
+ QStringList match_exchanges;
+ bool routable = false;
+};
+
+static ResearchTradeRoute research_trade_route(const QString& sym) {
+ ResearchTradeRoute r;
+ r.bare = sym;
+
+ // Single-venue suffixes: map yfinance suffix → broker exchange name.
+ struct Suffix {
+ const char* suffix;
+ const char* exchange;
+ };
+ static const Suffix kSuffixes[] = {
+ {".NS", "NSE"}, {".BO", "BSE"}, {".L", "LSE"}, {".TO", "TSX"},
+ {".HK", "HKEX"}, {".DE", "XETRA"}, {".PA", "EURONEXT"}, {".AS", "EURONEXT"}, {".SW", "SIX"},
+ };
+ for (const auto& s : kSuffixes) {
+ const QString suffix = QLatin1String(s.suffix);
+ if (sym.endsWith(suffix, Qt::CaseInsensitive)) {
+ r.bare = sym.left(sym.length() - suffix.length());
+ r.order_exchange = QLatin1String(s.exchange);
+ r.match_exchanges = {r.order_exchange};
+ r.routable = true;
+ return r;
+ }
+ }
+
+ // No suffix → US listing (yfinance convention, e.g. SPGI/AAPL). Any broker that
+ // offers a US equity venue can trade it; leave the order exchange empty so the
+ // broker's default is used.
+ if (!sym.contains(QLatin1Char('.'))) {
+ r.match_exchanges = {QStringLiteral("NYSE"), QStringLiteral("NASDAQ"), QStringLiteral("AMEX"),
+ QStringLiteral("ARCA"), QStringLiteral("BATS"), QStringLiteral("CBOE")};
+ r.routable = true;
+ return r;
+ }
+
+ return r; // other suffixes (.SS, .KS, …) — not routable via the wired brokers
+}
+
+// True when at least one usable account (paper, or live + Connected) is on a broker
+// that serves one of `match_exchanges`.
+static bool any_usable_broker_trades(const QStringList& match_exchanges) {
+ if (match_exchanges.isEmpty())
+ return false;
+ for (const auto& a : trading::AccountManager::instance().list_accounts()) {
+ if (!a.is_active)
+ continue;
+ if (!(a.trading_mode == QLatin1String("paper") || a.state == trading::ConnectionState::Connected))
+ continue;
+ auto* b = trading::BrokerRegistry::instance().get(a.broker_id);
+ if (!b)
+ continue;
+ const QStringList exchanges = b->profile().exchanges;
+ for (const auto& me : match_exchanges)
+ if (exchanges.contains(me, Qt::CaseInsensitive))
+ return true;
+ }
+ return false;
+}
+
+void EquityResearchScreen::update_trade_buttons() {
+ if (!buy_btn_ || !sell_btn_)
+ return;
+
+ // Show BUY/SELL only when the symbol is routable AND a usable broker actually
+ // trades that market — so SPGI shows for Alpaca/IBKR/Saxo (US venues),
+ // RELIANCE.NS for an Indian broker, and nothing for a forex-only broker.
+ const auto route = research_trade_route(current_symbol_);
+ const bool show = route.routable && any_usable_broker_trades(route.match_exchanges);
+ buy_btn_->setVisible(show);
+ sell_btn_->setVisible(show);
+}
+
+void EquityResearchScreen::on_trade_clicked(bool is_buy) {
+ if (current_symbol_.isEmpty())
+ return;
+
+ const auto route = research_trade_route(current_symbol_);
+ if (!route.routable)
+ return;
+
+ // Hand off to the Equity Trading screen, which owns the order ticket + the
+ // paper/live placement path and routes to a broker that serves match_exchanges.
+ // WindowFrame materialises that screen (hidden, no tab switch) if needed, then
+ // the app-modal ticket pops over this tab.
+ EventBus::instance().publish("equity.open_order_ticket",
+ {{"symbol", route.bare},
+ {"exchange", route.order_exchange},
+ {"match_exchanges", route.match_exchanges},
+ {"is_buy", is_buy},
+ {"price", last_price_}});
+}
+
+} // namespace fincept::screens
diff --cc fincept-qt/src/screens/equity_research/EquityResearchScreen.h
index cd57bd347,a741201c0..8e21793fc
--- a/fincept-qt/src/screens/equity_research/EquityResearchScreen.h
+++ b/fincept-qt/src/screens/equity_research/EquityResearchScreen.h
@@@ -49,12 -46,8 +46,13 @@@ class EquityResearchScreen : public QWi
void on_quote_loaded(services::equity::QuoteData quote);
void on_info_loaded(services::equity::StockInfo info);
void on_tab_changed(int index);
+ // BUY/SELL from the title bar → routes the current symbol to the existing
+ // Equity Trading order ticket (same form + paper/live engine) via EventBus.
+ void on_trade_clicked(bool is_buy);
+ // Opens the "Download Price Data (CSV)" dialog and exports yfinance OHLCV
+ // history for current_symbol_ to a user-chosen file.
void on_download_csv_clicked();
+ void on_financials_loaded(services::equity::FinancialsData data);
private:
void build_ui();
@@@ -65,43 -58,34 +63,41 @@@
void retranslateUi();
void hub_subscribe_broker_quote();
void hub_unsubscribe_broker_quote();
+ // Show the BUY/SELL buttons only when a broker is connected (paper or live)
+ // AND the current symbol is tradable via those (Indian) brokers (.NS/.BO).
+ void update_trade_buttons();
- // Title bar
- QLabel* title_label_ = nullptr;
+ QLabel* title_label_ = nullptr;
QLabel* symbol_label_ = nullptr;
- QLabel* hint_label_ = nullptr;
+ QPushButton* buy_btn_ = nullptr;
+ QPushButton* sell_btn_ = nullptr;
+ QLabel* hint_label_ = nullptr;
- // Quote bar
- QLabel* sym_label_ = nullptr;
- QLabel* price_label_ = nullptr;
+ QLabel* sym_label_ = nullptr;
+ QLabel* price_label_ = nullptr;
QLabel* change_label_ = nullptr;
- QLabel* vol_label_ = nullptr;
- QLabel* hl_label_ = nullptr;
+ QLabel* vol_label_ = nullptr;
+ QLabel* hl_label_ = nullptr;
QLabel* mktcap_label_ = nullptr;
- QLabel* rec_label_ = nullptr;
+ QLabel* rec_label_ = nullptr;
- // Tabs
- QTabWidget* tab_widget_ = nullptr;
- EquityOverviewTab* overview_tab_ = nullptr;
+ QTabWidget* tab_widget_ = nullptr;
+ EquityOverviewTab* overview_tab_ = nullptr;
EquityFinancialsTab* financials_tab_ = nullptr;
- EquityAnalysisTab* analysis_tab_ = nullptr;
+ EquityAnalysisTab* analysis_tab_ = nullptr;
EquityTechnicalsTab* technicals_tab_ = nullptr;
- EquityTalippTab* talipp_tab_ = nullptr;
- EquityPeersTab* peers_tab_ = nullptr;
- EquityNewsTab* news_tab_ = nullptr;
- EquitySentimentTab* sentiment_tab_ = nullptr;
- EquityValuationTab* valuation_tab_ = nullptr;
+ EquityPeersTab* peers_tab_ = nullptr;
+ EquityNewsTab* news_tab_ = nullptr;
+ EquitySentimentTab* sentiment_tab_ = nullptr;
++ EquityValuationTab* valuation_tab_ = nullptr;
- QTimer* refresh_timer_ = nullptr;
- QString current_symbol_;
- QString current_currency_;
- bool hub_broker_active_ = false;
+ QTimer* refresh_timer_ = nullptr;
+ QString current_symbol_;
+ QString current_currency_;
+ double last_price_ = 0.0; // freshest quote price, seeds the order ticket
+ bool hub_broker_active_ = false;
+
+ // Symbol group link — SymbolGroup::None when unlinked.
SymbolGroup link_group_ = SymbolGroup::None;
};