-
Notifications
You must be signed in to change notification settings - Fork 0
/
trade.cpp
61 lines (50 loc) · 1.28 KB
/
trade.cpp
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
49
50
51
52
53
54
55
56
57
58
59
60
#include "trade.h"
Trade::Trade(Order::OrderType type, BigDecimal tradableAmount, CurrencyPair currencyPair,
BigDecimal price, Date timestamp, String id, String orderId)
: type_(type), tradableAmount_(tradableAmount), currencyPair_(currencyPair),
price_(price), timestamp_(timestamp), id_(id), orderId_(orderId)
{}
Order::OrderType Trade::getType() const
{
return type_;
}
BigDecimal Trade::getTradableAmount() const
{
return tradableAmount_;
}
CurrencyPair Trade::getCurrencyPair() const
{
return currencyPair_;
}
BigDecimal Trade::getPrice() const
{
return price_;
}
Date Trade::getTimestamp() const
{
return timestamp_;
}
String Trade::getId() const
{
return id_;
}
String Trade::getOrderId() const
{
return orderId_;
}
String Trade::toString() const
{
String typeStr = (type_ == Order::ASK) ? "ASK" : "BID";
return "Trade [type="
+ typeStr
+ ", tradableAmount=" + QString::number(tradableAmount_)
+ ", currencyPair=" + currencyPair_.toString()
+ ", price=" + QString::number(price_)
+ ", timestamp=" + timestamp_.toString()
+ ", id=" + id_ + ", orderId=" + orderId_
+ "]";
}
bool Trade::operator==(const Trade &other) const
{
return id_ == other.id_;
}