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
#pragma once
// Crypto Watchlist — compact 3-column watchlist (Symbol | Price | Chg%)
#include "trading/TradingTypes.h"
#include <QEvent>
#include <QLabel>
#include <QLineEdit>
#include <QMutex>
#include <QTableWidget>
#include <QTimer>
#include <QVector>
#include <QWidget>
namespace fincept::screens::crypto {
struct WatchlistEntry {
QString symbol;
double price = 0.0;
double change_pct = 0.0;
bool has_data = false;
};
class CryptoWatchlist : public QWidget {
Q_OBJECT
public:
explicit CryptoWatchlist(QWidget* parent = nullptr);
void set_symbols(const QStringList& symbols);
void update_prices(const QVector<trading::TickerData>& tickers);
void set_search_results(const QVector<trading::MarketInfo>& markets);
void set_active_symbol(const QString& symbol);
signals:
void symbol_selected(const QString& symbol);
void search_requested(const QString& filter);
protected:
void changeEvent(QEvent* event) override;
private slots:
void on_cell_clicked(int row, int col);
void on_filter_changed(const QString& text);
private:
void rebuild_table();
void retranslateUi();
/// Right-click on a pair: open it in News (searched by coin name) or Equity Research.
void show_row_menu(const QPoint& pos);
QLineEdit* filter_edit_ = nullptr;
QLabel* title_label_ = nullptr;
QLabel* count_label_ = nullptr;
QTableWidget* table_ = nullptr;
// Debounces the exchange-wide market search: every keystroke used to fire its
// own daemon fetch_markets call, and replies could land out of order.
QTimer* search_timer_ = nullptr;
QString pending_search_;
QVector<WatchlistEntry> entries_;
QVector<trading::MarketInfo> search_results_;
QString active_symbol_;
bool showing_search_ = false;
QMutex mutex_;
};
} // namespace fincept::screens::crypto