BetaTrader
A HFT Eco-System
Loading...
Searching...
No Matches
Trade.h
Go to the documentation of this file.
1//
2// Created by sujal on 21-10-2025.
3//
4
5#pragma once
6
7#include "Time.h"
8#include "Types.h"
9
10namespace common {
19 class Trade {
20 public:
31 Trade(TradeID tradeId, Instrument symbol, OrderID buyOrderId,
32 OrderID sellOrderId, const Quantity qty, const Price price,
33 const Timestamp ts)
34 : mTradeId(tradeId), mOrderSymbol(symbol), mBuyOrderId(buyOrderId),
35 mSellOrderId(sellOrderId), mQuantity(qty), mPrice(price),
36 mTimestamp(ts)
37 {}
38
39 public:
41 [[nodiscard]] const TradeID& getTradeId() const { return mTradeId; }
43 [[nodiscard]] const Instrument& getOrderSymbol() const
44 {
45 return mOrderSymbol;
46 }
48 [[nodiscard]] const OrderID& getBuyOrderId() const
49 {
50 return mBuyOrderId;
51 }
53 [[nodiscard]] const OrderID& getSellOrderId() const
54 {
55 return mSellOrderId;
56 }
58 [[nodiscard]] Quantity getQuantity() const { return mQuantity; }
60 [[nodiscard]] Price getPrice() const { return mPrice; }
62 [[nodiscard]] Timestamp getTimestamp() const { return mTimestamp; }
63
64 private:
73 };
74} // namespace common
Represents a single trade execution in the system.
Definition Trade.h:19
Timestamp getTimestamp() const
Gets the trade timestamp.
Definition Trade.h:62
Timestamp mTimestamp
The timestamp of when the trade occurred.
Definition Trade.h:72
Price mPrice
The price at which the trade was executed.
Definition Trade.h:71
Instrument mOrderSymbol
Financial instrument symbol.
Definition Trade.h:66
Quantity getQuantity() const
Gets the trade quantity.
Definition Trade.h:58
TradeID mTradeId
Unique identifier for the trade.
Definition Trade.h:65
const Instrument & getOrderSymbol() const
Gets the financial instrument symbol.
Definition Trade.h:43
const OrderID & getSellOrderId() const
Gets the sell order's unique identifier.
Definition Trade.h:53
OrderID mBuyOrderId
The ID of the buy order involved in the trade.
Definition Trade.h:67
Quantity mQuantity
The quantity of the trade.
Definition Trade.h:70
const TradeID & getTradeId() const
Gets the trade's unique identifier.
Definition Trade.h:41
Price getPrice() const
Gets the trade price.
Definition Trade.h:60
Trade(TradeID tradeId, Instrument symbol, OrderID buyOrderId, OrderID sellOrderId, const Quantity qty, const Price price, const Timestamp ts)
Constructs a new Trade object.
Definition Trade.h:31
OrderID mSellOrderId
Definition Trade.h:68
const OrderID & getBuyOrderId() const
Gets the buy order's unique identifier.
Definition Trade.h:48
Defines type aliases for FIX protocol fields.
Definition Instrument.h:11
std::chrono::system_clock::time_point Timestamp
A type alias for std::chrono::system_clock::time_point.
Definition Time.h:15
double Price
A type alias for price values.
Definition Types.h:130
Instrument
Represents the financial instruments available for trading.
Definition Instrument.h:17
uint64_t OrderID
A type alias for unique order identifiers.
Definition Types.h:134
uint64_t TradeID
A type alias for unique trade identifiers.
Definition Types.h:136
uint64_t Quantity
A type alias for quantity values.
Definition Types.h:132