20#ifndef ORES_QT_ORG_EXPLORER_TRADE_MODEL_HPP
21#define ORES_QT_ORG_EXPLORER_TRADE_MODEL_HPP
26#include <unordered_map>
27#include <QFutureWatcher>
28#include <QAbstractTableModel>
29#include <boost/uuid/uuid.hpp>
30#include "ores.logging/make_logger.hpp"
31#include "ores.qt/ClientManager.hpp"
32#include "ores.qt/PortfolioExplorerTradeModel.hpp"
33#include "ores.trading.api/domain/trade.hpp"
34#include "ores.trading.api/messaging/trade_protocol.hpp"
48 inline static std::string_view logger_name =
49 "ores.qt.org_explorer_trade_model";
51 [[nodiscard]]
static auto& lg() {
53 static auto instance = make_logger(logger_name);
61 CounterpartyShortCode,
74 QObject* parent =
nullptr);
78 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
79 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
80 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
81 QVariant headerData(
int section, Qt::Orientation orientation,
82 int role = Qt::DisplayRole)
const override;
87 void set_filter(std::optional<boost::uuids::uuid> book_id,
88 std::optional<boost::uuids::uuid> business_unit_id);
94 std::unordered_map<std::string, CounterpartyInfo> cpty_map);
104 void load_page(std::uint32_t offset, std::uint32_t limit);
118 void loadError(
const QString& error_message,
const QString& details = {});
121 void onTradesLoaded();
126 std::vector<trading::domain::trade> trades;
127 std::uint32_t total_available_count;
128 QString error_message;
129 QString error_details;
132 void fetch_trades(std::uint32_t offset, std::uint32_t limit);
134 ClientManager* clientManager_;
135 std::vector<trading::domain::trade> items_;
136 QFutureWatcher<FetchResult>* watcher_;
137 std::uint32_t total_available_count_{0};
138 bool is_fetching_{
false};
140 std::optional<boost::uuids::uuid> filter_book_id_;
141 std::optional<boost::uuids::uuid> filter_business_unit_id_;
142 std::unordered_map<std::string, CounterpartyInfo> cpty_map_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:123
Table model for filtered trades in the org/BU tree window.
Definition OrgExplorerTradeModel.hpp:44
const trading::domain::trade * get_trade(int row) const
Get the trade at the given row.
Definition OrgExplorerTradeModel.cpp:253
void refresh()
Refresh trade data from server using current filter.
Definition OrgExplorerTradeModel.cpp:149
std::uint32_t total_available_count() const
Get total available count from last fetch.
Definition OrgExplorerTradeModel.hpp:109
void set_counterparty_map(std::unordered_map< std::string, CounterpartyInfo > cpty_map)
Set the counterparty lookup map (UUID string -> CounterpartyInfo).
Definition OrgExplorerTradeModel.cpp:139
void set_filter(std::optional< boost::uuids::uuid > book_id, std::optional< boost::uuids::uuid > business_unit_id)
Set book / business_unit filter and clear existing data.
Definition OrgExplorerTradeModel.cpp:132
void load_page(std::uint32_t offset, std::uint32_t limit)
Load a specific page.
Definition OrgExplorerTradeModel.cpp:171
Trade capturing FpML Trade Header properties.
Definition trade.hpp:39