20#ifndef ORES_QT_COMPOSITE_INSTRUMENT_FORM_HPP
21#define ORES_QT_COMPOSITE_INSTRUMENT_FORM_HPP
24#include "ores.qt/IInstrumentForm.hpp"
25#include "ores.logging/make_logger.hpp"
26#include "ores.trading.api/domain/composite_instrument.hpp"
27#include "ores.trading.api/domain/composite_leg.hpp"
30class CompositeInstrumentForm;
45 inline static std::string_view logger_name =
46 "ores.qt.composite_instrument_form";
48 [[nodiscard]]
static auto& lg() {
50 static auto instance = make_logger(logger_name);
59 void setUsername(
const std::string& username)
override;
62 const trading::domain::trade_instrument& instrument)
override;
63 void clear()
override;
66 bool has_options,
bool has_extension)
override;
73 const std::string& code,
const std::string& commentary)
override;
77 std::function<
void(
const std::string&
id)> on_success,
78 std::function<
void(
const QString& error)> on_failure)
override;
81 void setupConnections();
82 void populateFromInstrument();
83 void emitProvenance();
84 void onFieldChanged();
86 Ui::CompositeInstrumentForm* ui_;
88 std::string username_;
90 std::vector<trading::domain::composite_leg> legs_;
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
IInstrumentForm subclass owning the composite instrument editor.
Definition CompositeInstrumentForm.hpp:41
void saveInstrument(std::function< void(const std::string &id)> on_success, std::function< void(const QString &error)> on_failure) override
Save the in-flight instrument via the family's NATS request.
Definition CompositeInstrumentForm.cpp:160
bool isLoaded() const override
True after the asynchronous load has populated the form.
Definition CompositeInstrumentForm.cpp:85
void setInstrument(const trading::domain::trade_instrument &instrument) override
Populate the form with the already-resolved instrument.
Definition CompositeInstrumentForm.cpp:103
void writeUiToInstrument() override
Pull the current UI values into the in-flight domain object.
Definition CompositeInstrumentForm.cpp:93
void setUsername(const std::string &username) override
Inject the username stamped on every saved instrument.
Definition CompositeInstrumentForm.cpp:58
void setTradeType(const QString &code, bool has_options, bool has_extension) override
Inform the form which trade type is currently selected.
Definition CompositeInstrumentForm.cpp:70
void setChangeReason(const std::string &code, const std::string &commentary) override
Stamp the change reason on the in-flight instrument before the dialog calls saveInstrument.
Definition CompositeInstrumentForm.cpp:87
void setReadOnly(bool readOnly) override
Toggle read-only on every editable widget.
Definition CompositeInstrumentForm.cpp:78
void setClientManager(ClientManager *cm) override
Inject the NATS client used for load and save round-trips.
Definition CompositeInstrumentForm.cpp:54
bool isDirty() const override
Has the user edited any field since the last load or save?
Definition CompositeInstrumentForm.cpp:84
void clear() override
Reset the form to a blank state ready for create mode.
Definition CompositeInstrumentForm.cpp:62
Pure-virtual interface implemented by every per-family instrument form widget hosted in TradeDetailDi...
Definition IInstrumentForm.hpp:73
Composite instrument economics for CompositeTrade and MultiLegOption ORE product types.
Definition composite_instrument.hpp:38