Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

fix_message.h 6.2 KB

You have to be logged in to leave a comment. Sign In
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
  1. /* Copyright (c) 2012, Chris Winter <wintercni@gmail.com>
  2. * All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * 3. Neither the name of the copyright holder nor the
  13. * names of contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  17. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifndef __FIX_MESSAGE_H__
  28. #define __FIX_MESSAGE_H__
  29. #if __cplusplus
  30. extern "C" {
  31. #endif
  32. /* Field tags. A small subset of those listed beginning on
  33. * page 192 of the FIX 4.2 spec.
  34. */
  35. typedef enum {
  36. FIX_TAG_BEGIN_STRING = 8,
  37. FIX_TAG_BODY_LENGTH = 9,
  38. FIX_TAG_CHECKSUM = 10,
  39. FIX_TAG_CLORDID = 11,
  40. FIX_TAG_HANDLINST = 21,
  41. FIX_TAG_MSG_SEQ_NUM = 34,
  42. FIX_TAG_MSG_TYPE = 35,
  43. FIX_TAG_ORDER_QTY = 38,
  44. FIX_TAG_ORDER_TYPE = 40,
  45. FIX_TAG_PRICE = 44,
  46. FIX_TAG_SENDER_COMP_ID = 49,
  47. FIX_TAG_SENDING_TIME = 52,
  48. FIX_TAG_SIDE = 54,
  49. FIX_TAG_SYMBOL = 55,
  50. FIX_TAG_TARGET_COMP_ID = 56,
  51. FIX_TAG_TRANSACT_TIME = 60,
  52. FIX_TAG_ENCRYPT_METHOD = 98,
  53. FIX_TAG_HEARTBTINT = 108
  54. } FIX_TAG;
  55. /* Message types in FIX.4.2 are enumerated from 0-9,A-Z,a-m (see
  56. * page 154 of FIX 4.2 spec., referenced above).
  57. *
  58. * The enum below is constructed by taking the ASCII value of
  59. * each message type, and subtracting 48, the decimal value of
  60. * the ASCI character '0'.
  61. *
  62. * TODO This enum list is incomplete, and only lists a few
  63. * more of the message types actually supported by the server's
  64. * current capabilities
  65. */
  66. typedef enum {
  67. FIX_MSG_TYPE_HEARTBEAT = 0,
  68. FIX_MSG_TYPE_TEST_REQUEST,
  69. FIX_MSG_TYPE_RESEND_REQUEST,
  70. FIX_MSG_TYPE_REJECT,
  71. FIX_MSG_TYPE_SEQ_RESET,
  72. FIX_MSG_TYPE_LOGOUT,
  73. FIX_MSG_TYPE_INDICATION_OF_INTEREST,
  74. FIX_MSG_TYPE_ADVERT,
  75. FIX_MSG_TYPE_EXEC_REPORT,
  76. FIX_MSG_TYPE_ORDER_CANCEL_REJECT,
  77. FIX_MSG_TYPE_LOGON = 17,
  78. FIX_MSG_TYPE_NEW_ORDER_SINGLE = 20,
  79. FIX_MSG_TYPE_ORDER_CANCEL_REQUEST = 22,
  80. FIX_MSG_TYPE_ORDER_CANCEL_REPLACE_REQUEST,
  81. FIX_MSG_TYPE_ORDER_STATUS_REQUEST,
  82. FIX_MSG_TYPE_PRIVATE = 37,
  83. /* No new messages after this point */
  84. FIX_MSG_TYPE_LAST,
  85. FIX_MSG_TYPE_INVALID
  86. } FIX_MSG_TYPE;
  87. typedef enum {
  88. FIX_ORDER_SIDE_BUY = 1,
  89. FIX_ORDER_SIDE_SELL,
  90. FIX_ORDER_SIDE_BUY_MINUS,
  91. FIX_ORDER_SIDE_SELL_PLUS,
  92. FIX_ORDER_SIDE_SELL_SHORT,
  93. FIX_ORDER_SIDE_SELL_SHORT_EXEMPT,
  94. FIX_ORDER_SIDE_UNDISCLOSED,
  95. FIX_ORDER_SIDE_CROSS,
  96. FIX_ORDER_SIDE_CROSS_SHORT,
  97. /* No new order sides after this point */
  98. FIX_ORDER_SIDE_LAST,
  99. FIX_ORDER_SIDE_INVALID
  100. } FIX_ORDER_SIDE;
  101. typedef enum {
  102. FIX_ORDER_TYPE_MARKET = 1,
  103. FIX_ORDER_TYPE_LIMIT,
  104. FIX_ORDER_TYPE_STOP,
  105. FIX_ORDER_TYPE_STOP_LIMIT,
  106. FIX_ORDER_TYPE_MARKET_ON_CLOSE,
  107. FIX_ORDER_TYPE_WITH_OR_WITHOUT,
  108. FIX_ORDER_TYPE_LIMIT_OR_BETTER,
  109. FIX_ORDER_TYPE_LIMIT_WITH_OR_WITHOUT,
  110. FIX_ORDER_TYPE_ON_BASIS,
  111. FIX_ORDER_TYPE_ON_CLOSE = 17,
  112. FIX_ORDER_TYPE_LIMIT_ON_CLOSE,
  113. FIX_ORDER_TYPE_FOREX_MARKET,
  114. FIX_ORDER_TYPE_PREV_QUOTED,
  115. FIX_ORDER_TYPE_PREV_INDICATED,
  116. FIX_ORDER_TYPE_FOREX_LIMIT,
  117. FIX_ORDER_TYPE_FOREX_SWAP,
  118. FIX_ORDER_TYPE_FOREX_PREV_QUOTED,
  119. FIX_ORDER_TYPE_FUNARI,
  120. FIX_ORDER_TYPE_PEGGED = 32,
  121. /* No new order types after this point */
  122. FIX_ORDER_TYPE_LAST,
  123. FIX_ORDER_TYPE_INVALID
  124. } FIX_ORDER_TYPE;
  125. typedef enum {
  126. FIX_ENCRYPT_METHOD_NONE = 0,
  127. FIX_ENCRYPT_METHOD_PKCS,
  128. FIX_ENCRYPT_METHOD_DES,
  129. FIX_ENCRYPT_METHOD_PKCS_DES,
  130. FIX_ENCRYPT_METHOD_PGP_DES,
  131. FIX_ENCRYPT_METHOD_PGP_DES_MD5,
  132. FIX_ENCRYPT_METHOD_PEM_DES_MD5,
  133. /* No new encryption methods after this point */
  134. FIX_ENCRYPT_METHOD_LAST,
  135. FIX_ENCRYPT_METHOD_INVALID
  136. } FIX_ENCRYPT_METHOD;
  137. typedef enum {
  138. FIX_HANDL_INST_AUTO_PRIVATE = 1,
  139. FIX_HANDL_INST_AUTO_PUBLIC,
  140. FIX_HANDL_INST_MANUAL,
  141. /* No new handling instructions after this point */
  142. FIX_HANDL_INST_LAST,
  143. FIX_HANDL_INST_INVALID
  144. } FIX_HANDL_INST;
  145. unsigned long fix_message_generate_checksum(const char *buf, unsigned long len);
  146. String* fix_message_generate_header (FIX_MSG_TYPE MsgType,
  147. unsigned long payload_length,
  148. const String *SenderCompId,
  149. const String *TargetCompId,
  150. unsigned long MsgSeqNum);
  151. String* fix_message_generate_trailer (const String *header_and_payload);
  152. String* fix_message_generate_logon (FIX_ENCRYPT_METHOD encrypt_method,
  153. int heart_bt_int);
  154. String* fix_message_generate_new_order_single (String *cl_ord_id,
  155. FIX_HANDL_INST handl_inst,
  156. String *symbol,
  157. FIX_ORDER_SIDE side,
  158. float order_qty,
  159. FIX_ORDER_TYPE type,
  160. float price);
  161. #if __cplusplus
  162. }
  163. #endif
  164. #endif
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...