-
Notifications
You must be signed in to change notification settings - Fork 0
/
Order.h
49 lines (41 loc) · 1.31 KB
/
Order.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "OrderType.h"
#include "Side.h"
#include <cstdint>
#include <stdexcept>
#include <format>
#include <list>
#include "Usings.h"
#include "Constants.h"
class Order {
private:
// Member variables
OrderType _type;
OrderId _id;
Side _side;
Price _price;
Quantity _quantity;
Quantity _initialQty;
Quantity _remainingQty;
public:
// Constructor and member functions declarations
Order(OrderType type, OrderId id, Side side, Price price, Quantity qty)
: _type{ type }, _id{ id }, _side{ side }, _price{ price }, _quantity{ qty }, _initialQty{ qty }, _remainingQty{ qty } {} // setter in c++
Order(OrderId orderId, Side side, Quantity quantity)
: Order(OrderType::Market, orderId, side, Constants::InvalidPrice, quantity)
{}
// getter in c++
OrderId getOrderId() const;
OrderType getOrderType() const;
Side getSide() const;
Price getPrice() const;
Quantity getInitialQty() const; // may not be used
Quantity getQty() const;
Quantity getRemainingQty() const;
Quantity getFilledQty() const;
bool isFilled() const;
void Fill(Quantity qty);
void toGoodTillCancel(Price price);
};
using OrderPtr = std::shared_ptr<Order>;
using OrderPtrs = std::list<OrderPtr>; // a vector is better and show upgrade with vector done