-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenfeed_api.proto
More file actions
300 lines (276 loc) · 7.37 KB
/
openfeed_api.proto
File metadata and controls
300 lines (276 loc) · 7.37 KB
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
/**
* Copyright (C) 2011-2017 Barchart, Inc. <http://www.barchart.com/>
*
* All rights reserved. Licensed under the OSI BSD License.
*
* http://www.opensource.org/licenses/bsd-license.php
*/
syntax = "proto3";
package org.openfeed;
option java_multiple_files = true;
option java_generate_equals_and_hash = true;
option optimize_for = SPEED;
import "openfeed_instrument.proto";
import "openfeed.proto";
// //////////////////
// Server API
// //////////////////
/// Openfeed Server request
message OpenfeedGatewayRequest {
oneof data {
LoginRequest loginRequest = 1;
LogoutRequest logoutRequest = 2;
SubscriptionRequest subscriptionRequest = 3;
InstrumentRequest instrumentRequest = 4;
InstrumentReferenceRequest instrumentReferenceRequest = 5;
ExchangeRequest exchangeRequest = 6;
ListSubscriptionsRequest listSubscriptionsRequest = 7;
}
}
/// Openfeed Server Response
message OpenfeedGatewayMessage {
oneof data {
LoginResponse loginResponse = 1;
LogoutResponse logoutResponse = 2;
InstrumentResponse instrumentResponse = 3;
InstrumentReferenceResponse instrumentReferenceResponse = 4;
SubscriptionResponse subscriptionResponse = 5;
MarketStatus marketStatus = 6;
HeartBeat heartBeat = 7;
InstrumentDefinition instrumentDefinition = 8;
MarketSnapshot marketSnapshot = 9;
MarketUpdate marketUpdate = 10;
VolumeAtPrice volumeAtPrice = 11;
Ohlc ohlc = 12;
ExchangeResponse exchangeResponse = 13;
InstrumentAction instrumentAction = 14;
ListSubscriptionsResponse listSubscriptionsResponse = 15;
}
}
// ///////////
// Enums
// //////////
enum Result {
UNKNOWN_RESULT = 0;
SUCCESS = 1;
INSTRUMENTS_NOT_FOUND = 112;
JWT_EXPIRED = 113;
JWT_INVALID = 114;
DUPLICATE_LOGIN = 115;
INVALID_SYMBOL = 116;
INVALID_MARKET_ID = 117;
INVALID_EXCHANGE = 118;
INVALID_CHANNEL_ID = 119;
MALFORMED_MESSAGE = 120;
UNEXPECTED_MESSAGE = 121;
NOT_SUBSCRIBED = 122;
DUPLICATE_SUBSCRIPTION = 123;
INVALID_CREDENTIALS = 124;
INSUFFICIENT_PRIVILEGES = 125;
AUTHENTICATION_REQUIRED = 126;
GENERIC_FAILURE = 127;
INVALID_USERNAME = 128;
}
enum SubscriptionType {
ALL = 0;
QUOTE = 1;
QUOTE_PARTICIPANT = 2;
DEPTH_PRICE = 3;
DEPTH_ORDER = 4;
TRADES = 5;
CUMULATIVE_VOLUME = 6;
OHLC = 7;
OHLC_NON_REGULAR = 8;
SETTLEMENT = 9;
}
////////////////////
// Serivce Messages
///////////////////
message Status {
Result result = 1;
string message = 2;
Service service = 3;
}
/// Login
message LoginRequest {
sint64 correlationId = 1;
string username = 2;
string password = 3;
string clientVersion = 4;
sint32 protocolVersion = 5;
/// JSON Web Token
string jwt = 6;
}
message LoginResponse {
sint64 correlationId = 1;
Status status = 2;
string token = 3;
}
/// Logout
message LogoutRequest {
sint64 correlationId = 1;
string token = 3;
}
message LogoutResponse {
sint64 correlationId = 1;
Status status = 2;
}
/// Instrument Definition(s), will stream InstrumentDefinition(s)
message InstrumentRequest {
sint64 correlationId = 1;
string token = 2;
/// Filter on these instrument types
repeated InstrumentDefinition.InstrumentType instrumentType = 3;
/// Filter on these spread types
repeated string spreadType = 4;
/// If version >= 1 then will send InstrumentDefinition in the InstrumentResponse
sint32 version = 5;
oneof request {
string symbol = 10;
sint64 marketId = 11;
string exchange = 12;
sint32 channelId = 13;
}
}
message InstrumentResponse {
sint64 correlationId = 1;
Status status = 2;
sint32 numberOfDefinitions = 3;
//
string symbol = 4;
sint64 marketId = 5;
string exchange = 6;
sint32 channelId = 7;
sint32 exchangeId = 8;
/// Will be set if InstrumentRequest.version >= 1
InstrumentDefinition instrumentDefinition = 15;
}
/// Instrument References, returns InstrumentReferenceResponse(s)
message InstrumentReferenceRequest {
sint64 correlationId = 1;
string token = 2;
oneof request {
string symbol = 10;
sint64 marketId = 11;
string exchange = 12;
sint32 channelId = 13;
}
}
message InstrumentReferenceResponse {
sint64 correlationId = 1;
Status status = 2;
sint32 numberOfDefinitions = 3;
//
sint32 channelId = 4;
sint64 marketId = 5;
string symbol = 6;
string exchange = 7;
string ddfSymbol = 8;
string ddfExchange = 9;
string ddfBaseCode = 10;
string exchangeSymbol = 11;
sint32 exchangeId = 12;
}
/// Exchange Request, returns ExchangeResponse. Gives available exchanges.
message ExchangeRequest {
sint64 correlationId = 1;
string token = 2;
}
message ExchangeResponse {
sint64 correlationId = 1;
Status status = 2;
repeated Exchange exchanges = 3;
message Exchange {
string code = 1;
string description = 2;
repeated string aliases = 3;
sint32 exchangeId = 4;
}
}
/// Symbol type for the subscription filter.
enum SymbolType {
BARCHART = 0;
EXCHANGE = 1;
}
/// Bulk subscription filter.
message BulkSubscriptionFilter {
/// Type of the symbol: Barchart or Exchange. Barchart is the default.
SymbolType symbolType = 1;
/// regular expression pattern for the symbol
string symbolPattern = 2;
}
/// Subscription Request
message SubscriptionRequest {
/// Client-assigned id for this request. Response will include same id
sint64 correlationId = 1;
string token = 2;
/// Preferred service (realtime or delayed). REAL_TIME is the default.
Service service = 3;
bool unsubscribe = 4;
repeated Request requests = 5;
message Request {
oneof data {
string symbol = 1;
sint64 marketId = 2;
string exchange = 3;
sint32 channelId = 4;
}
repeated SubscriptionType subscriptionType = 10;
/// 0 = send only current snapshot once, else send at interval seconds
sint32 snapshotIntervalSeconds = 11;
/// Spreads and Options must be explicitly requested.
repeated InstrumentDefinition.InstrumentType instrumentType = 12;
/// Filter for the exchange and channel subscriptions.
repeated BulkSubscriptionFilter bulkSubscriptionFilter = 13;
/// Filter for Spread Types
repeated string spreadTypeFilter = 14;
/// Do not send instrument(s) on successful subscription
bool subscriptionDoNotSendInstruments = 15;
/// Do not send market snapshot(s) on successful subscription
bool subscriptionDoNotSendSnapshots = 16;
}
}
message SubscriptionResponse {
sint64 correlationId = 1;
Status status = 2;
string symbol = 3;
sint64 marketId = 4;
string exchange = 5;
sint32 channelId = 6;
sint32 numberOfDefinitions = 7;
SubscriptionType subscriptionType = 8;
bool unsubscribe = 9;
sint32 snapshotIntervalSeconds = 10;
}
/// List Subscriptions for a user
message ListSubscriptionsRequest {
sint64 correlationId = 1;
string token = 2;
string username = 3;
}
message ListSubscriptionsResponse {
sint64 correlationId = 1;
Status status = 2;
string username = 3;
repeated Session sessions = 10;
message Session {
/// Nano second unix epoch
sint64 loginTime = 1;
string token = 2;
string clientVersion = 3;
repeated Subscription marketSubscriptions = 10;
repeated Subscription exchangeSubscriptions = 11;
}
message Subscription {
string subscriptionId = 1;
string symbolId = 2;
sint64 marketId = 3;
repeated SymbolCount symbolCounts = 4;
string exchange = 10;
string root = 11;
}
message SymbolCount {
string symbol = 1;
sint32 count = 2;
}
}