-
Notifications
You must be signed in to change notification settings - Fork 1
/
Message.h
251 lines (204 loc) · 5.51 KB
/
Message.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
//
// Message.h
// itch4Parser
//
// Created by Dylan Hurd on 11/3/13.
// Copyright (c) 2013 Dylan Hurd. All rights reserved.
//
#ifndef __itch4Parser__Message__
#define __itch4Parser__Message__
#include <iostream>
using namespace std;
//Consts
// Length = (# of chars in spec)
const int TickerLength = 8;
const int MPIDLength = 4;
const int ReasonLength = 4;
//Standard TimeStamp
class TimeStamp {
protected:
unsigned int seconds;
public:
friend istream& operator>> (istream &input, TimeStamp &ts);
friend ostream& operator<< (ostream &output, TimeStamp &ts);
};
//
// Messages
//
class Message {
public:
TimeStamp ts;
protected:
unsigned int nanoseconds;
char eventCode;
public:
friend istream& operator>> (istream &input, Message &ts);
friend ostream& operator<< (ostream &output, Message &ts);
};
class StockDirectory {
public:
TimeStamp ts;
protected:
unsigned int nanoseconds;
char ticker[TickerLength];
char mktCategory;
char finStatus;
unsigned int roundLotSize;
char roundLotStatus;
public:
friend istream& operator>> (istream &input, StockDirectory &ts);
friend ostream& operator<< (ostream &output, StockDirectory &ts);
};
class StockTradingAction {
public:
TimeStamp ts;
protected:
unsigned int nanoseconds;
char ticker[TickerLength];
char tradingState;
char reason[ReasonLength];
public:
friend istream& operator>> (istream &input, StockTradingAction &ts);
friend ostream& operator<< (ostream &output, StockTradingAction &ts);
};
class ShortSalePriceTest {
public:
TimeStamp ts;
private:
unsigned int nanoseconds;
char ticker[TickerLength];
char regSHOAction;
public:
friend istream& operator>> (istream &input, ShortSalePriceTest &ts);
friend ostream& operator<< (ostream &output, ShortSalePriceTest &ts);
};
class MarketParticipantPosition {
public:
TimeStamp ts;
protected:
unsigned int nanoseconds;
char mpid[MPIDLength];
char ticker[TickerLength];
char mmStatus;
char mmMode;
char mpStatus;
public:
friend istream& operator>> (istream &input, MarketParticipantPosition &ts);
friend ostream& operator<< (ostream &output, MarketParticipantPosition &ts);
};
class BrokenTrade {
protected:
unsigned int nanoseconds;
unsigned long matchNumber;
public:
TimeStamp ts;
friend istream& operator>> (istream &input, BrokenTrade &ts);
friend ostream& operator<< (ostream &output, BrokenTrade &ts);
};
class NetOrderImbalance {
protected:
unsigned int nanoseconds;
unsigned long pairedShares;
unsigned long imbalanceShares;
char direction;
char ticker[TickerLength];
unsigned int farPrice;
unsigned int nearPrice;
unsigned int currentPrice;
char crossType;
char priceVar;
public:
TimeStamp ts;
friend istream& operator>> (istream &input, NetOrderImbalance &ts);
friend ostream& operator<< (ostream &output, NetOrderImbalance &ts);
};
class RetailPriceImprovement {
protected:
unsigned int nanoseconds;
char ticker[TickerLength];
char interest;
public:
TimeStamp ts;
friend istream& operator>> (istream &input, RetailPriceImprovement &ts);
friend ostream& operator<< (ostream &output, RetailPriceImprovement &ts);
};
//
// Orders
//
class Order {
protected:
unsigned int nanoseconds; //nanoseconds since last timestamp
unsigned long refNum; //unique reference number
public:
TimeStamp ts; // last timestamp
};
class AddOrder : public Order {
protected:
char buyStatus;
unsigned int quantity;
char ticker[TickerLength];
unsigned int price;
public:
friend istream& operator>> (istream &input, AddOrder &order);
friend ostream& operator<< (ostream &output, AddOrder &order);
};
class AddMPIDOrder : public AddOrder {
protected:
char mpid[MPIDLength];
public:
friend istream& operator>> (istream &input, AddMPIDOrder &order);
friend ostream& operator<< (ostream &output, AddMPIDOrder &order);
};
class ExecutedOrder : public Order {
protected:
unsigned int quantity;
unsigned long matchNumber;
public:
friend istream& operator>> (istream &input, ExecutedOrder &order);
friend ostream& operator<< (ostream &output, ExecutedOrder &order);
};
class ExecutedPriceOrder : public ExecutedOrder {
protected:
char printable;
unsigned int price;
public:
friend istream& operator>> (istream &input, ExecutedPriceOrder &order);
friend ostream& operator<< (ostream &output, ExecutedPriceOrder &order);
};
class CancelOrder : public Order{
protected:
unsigned int quantity;
public:
friend istream& operator>> (istream &input, CancelOrder &order);
friend ostream& operator<< (ostream &output, CancelOrder &order);
};
class DeleteOrder : public Order {
public:
friend istream& operator>> (istream &input, DeleteOrder &order);
friend ostream& operator<< (ostream &output, DeleteOrder &order);
};
class ReplaceOrder : public Order {
protected:
unsigned long oldRefNum;
unsigned int quantity;
unsigned int price;
public:
friend istream& operator>> (istream &input, ReplaceOrder &order);
friend ostream& operator<< (ostream &output, ReplaceOrder &order);
};
class TradeMessage : public AddOrder {
protected:
unsigned long matchNumber;
public:
friend istream& operator>> (istream &input, TradeMessage &order);
friend ostream& operator<< (ostream &output, TradeMessage &order);
};
class CrossTradeMessage : public TradeMessage {
protected:
unsigned long crossQuantity;
char crossType;
public:
friend istream& operator>> (istream &input, CrossTradeMessage &order);
friend ostream& operator<< (ostream &output, CrossTradeMessage &order);
};
#endif /* defined(__itch4Parser__Message__) */