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
// Depth Chart — custom-painted bid/ask cumulative area chart
#include <QEvent>
#include <QMutex>
#include <QPair>
#include <QPixmap>
#include <QTimer>
#include <QVector>
#include <QWidget>
namespace fincept::screens::crypto {
class CryptoDepthChart : public QWidget {
Q_OBJECT
public:
explicit CryptoDepthChart(QWidget* parent = nullptr);
void set_data(const QVector<QPair<double, double>>& bids, const QVector<QPair<double, double>>& asks, double spread,
double spread_pct);
protected:
void paintEvent(QPaintEvent* event) override;
void resizeEvent(QResizeEvent* event) override;
void showEvent(QShowEvent* event) override;
void hideEvent(QHideEvent* event) override;
void changeEvent(QEvent* event) override;
private:
void rebuild_cache();
QVector<QPair<double, double>> bids_;
QVector<QPair<double, double>> asks_;
double spread_ = 0;
QPixmap cache_;
QMutex mutex_;
bool cache_dirty_ = true;
QTimer* repaint_timer_ = nullptr;
};
} // namespace fincept::screens::crypto