-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOpenfeedClient.java
More file actions
191 lines (163 loc) · 6.61 KB
/
OpenfeedClient.java
File metadata and controls
191 lines (163 loc) · 6.61 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
package org.openfeed.client.api;
import io.netty.channel.ChannelPromise;
import org.openfeed.*;
import org.openfeed.client.api.impl.Subscription;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
public interface OpenfeedClient {
/**
* Blocking call to connect and login.
*/
void connectAndLogin();
/**
* Will drop the connection and re-connect if configured.
*/
void disconnect();
/**
* Will disconnect and shutdown the connection.
*/
void close();
long getCorrelationId();
long getNextCorrelationId();
String getToken();
void logout();
boolean isConnected();
boolean isReConnect();
// Sends InstrumentRequest
void instrumentMarketId(long... marketIds);
void instrument(String... symbols);
void instrument(InstrumentRequest request);
ChannelPromise instrumentChannel(int channelId);
ChannelPromise instrumentExchange(String exchange);
// Instrument Cross reference
void instrumentReference(String... symbols);
void instrumentReferenceMarketId(long... marketIds);
ChannelPromise instrumentReferenceExchange(String exchange);
ChannelPromise instrumentReferenceChannel(int channelId);
// Sends ExchangeRequest which will list available exchanges.
void exchangeRequest();
/**
* Subscribe by Symbol(s).
*
* @param service Type of service, Realtime, Delayed etc...
* @param subscriptionType Quote, Depth, etc..
* @param symbols List of symbols to subscribe to.
* @return Unique Id for subscription
*/
String subscribe(Service service, SubscriptionType subscriptionType, String[] symbols);
/**
* Subscribe by Symbol(s) with multiple subscription types. The subscription types will apply to all symbols.
*
* @param service
* @param subscriptionTypes
* @param symbols
* @return Unique Id for subscription
*/
String subscribe(Service service, SubscriptionType [] subscriptionTypes, String[] symbols);
/**
* Subscribe by Market Id(s).
*
* @param service
* @param subscriptionType
* @param marketId
* @return Unique Id for subscription
*/
String subscribe(Service service, SubscriptionType subscriptionType, long marketId);
String subscribe(Service service, SubscriptionType subscriptionType, long[] marketIds);
String subscribe(Service service, SubscriptionType [] subscriptionTypes, long[] marketIds);
/**
* Send a pre-build SubscriptionRequest
* @param request SubscriptionRequest
*/
void subscribe(SubscriptionRequest request);
/**
* Subscribe for an exchange
* @param service Service - Realtime, Delayed
* @param exchange Exchange Name
* @return subscriptionId
*/
String subscribeExchange(Service service,String exchange);
/**
* Subscribe for an exchange(s)
* @param service
* @param subscriptionType
* @param exchanges
* @return subscriptionId
*/
String subscribeExchange(Service service, SubscriptionType subscriptionType, String[] exchanges);
String subscribeExchange(Service service, SubscriptionType [] subscriptionTypes, String[] exchanges);
String subscribeExchange(Service service, SubscriptionType [] subscriptionTypes, InstrumentDefinition.InstrumentType [] instrumentTypes, String[] exchanges, BulkSubscriptionFilter[] bulkSubscriptionFilters);
/**
*
* @param service
* @param subscriptionType
* @param channelIds
* @return subscriptionId
*/
String subscribeChannel(Service service, SubscriptionType subscriptionType, int[] channelIds);
String subscribeChannel(Service service, SubscriptionType [] subscriptionType, int[] channelIds);
String subscribeChannel(Service service, SubscriptionType [] subscriptionType, InstrumentDefinition.InstrumentType [] instrumentTypes, int[] channelIds, BulkSubscriptionFilter[] bulkSubscriptionFilters);
/**
* Subscribe for Realtime Snapshots at specific interval
* @param symbols Symbols
* @param intervalSec if 0 then only the latest snapshot is sent, otherwise send at specific interval.
* @return subscriptionId
*/
String subscribeSnapshot(String[] symbols, int intervalSec);
/**
* Subscribe for Snapshots
*
* @param service Realtime, Delayed
* @param symbols Symbols
* @param intervalSec if 0 then only the latest snapshot is sent, otherwise send at specific interval.
* @return subscriptionId
*/
String subscribeSnapshot(Service service, String[] symbols, int intervalSec);
/**
* Subscribes for Snapshot at the requested service type
*
* @param service Service Type, can be REAL_TIME_SNAPSHOT or DELAYED_SNAPSHOT
* @param subscriptionType Subscription Type, can be Cumulative Volume
* @param symbols Symbols
* @param intervalSec if 0 then only the latest snapshot is sent, otherwise send at specific interval.
* @return subscriptionId
*/
String subscribeSnapshot(Service service, SubscriptionType subscriptionType, String[] symbols, int intervalSec);
String subscribeSnapshot(Service service, SubscriptionType[] subscriptionType, String[] symbols, int intervalSec);
String subscribeSnapshot(Service service, SubscriptionType subscriptionType, long marketId, int intervalSec);
// Un subscribe
void unSubscribe(Service service, String[] symbols);
void unSubscribe(Service service,SubscriptionType subscriptionType, String[] symbols);
//
void unSubscribe(Service service, long[] openfeedIds);
void unSubscribe(Service service,SubscriptionType subscriptionType, long[] openfeedIds);
//
void unSubscribeExchange(Service service, String[] exchanges);
void unSubscribeExchange(Service service, SubscriptionType subscriptionType, String[] exchanges);
//
void unSubscribeChannel(Service service, int[] channelIds);
/**
* Returns all subscriptions.
*
* @return Subscriptions
*/
Collection<Subscription> getSubscriptions();
/**
* Get subscription by Id
*
* @param subscriptionId Subscription Id returned by subscribe* methods.
* @return Subscription
*/
Subscription getSubscription(String subscriptionId);
void schedule(Runnable task, long delay, TimeUnit timeUnit);
void scheduleAtFixedRate(Runnable task, long delay, long interval, TimeUnit timeUnit);
/**
* Send top level request
* @param request Request
*/
void send(OpenfeedGatewayRequest request);
/**
* Sends a ListSubscriptionsRequest which lists all your active subscriptions.
*/
void listSubscriptionsRequest();
}