dxFeed Graal CXX API v7.0.0
Loading...
Searching...
No Matches
CandleSymbol.hpp
1// Copyright (c) 2025 Devexperts LLC.
2// SPDX-License-Identifier: MPL-2.0
3
4#pragma once
5
6#include "../../internal/Conf.hpp"
7
9
10#include "./CandleAlignment.hpp"
11#include "./CandleExchange.hpp"
12#include "./CandlePeriod.hpp"
13#include "./CandlePrice.hpp"
14#include "./CandlePriceLevel.hpp"
15#include "./CandleSession.hpp"
16
17#include <cstdint>
18#include <memory>
19#include <string>
20#include <utility>
21#include <variant>
22
23/**
24 * \addtogroup dxfcpp_candle
25 * @{
26 */
27
29
30/**
31 * The common "variant" type for the candle attribute types
32 */
33using CandleSymbolAttributeVariant =
35
36/**
37 * Symbol that should be used with DXFeedSubscription class to subscribe for Candle events. `DXFeedSubscription` also
38 * accepts a string representation of the candle symbol for subscription.
39 *
40 * <h3>String representation</h3>
41 *
42 * The string representation of the candle symbol consist of a @ref CandleSymbol::getBaseSymbol() "baseSymbol" followed
43 * by an optional '&' with an @ref CandleSymbol::getExchange() "exchange" code letter and followed by an optional list
44 * of comma-separated key=value pairs in curly braces:
45 *
46 * <p>`<baseSymbol> [ '&' <exchange> ] [ '{' <key1>=<value1> [ ',' <key2>=<value2> ] ... '}' ]`
47 *
48 * <p>Properties of the candle symbol correspond to the keys in the string representation in the following way:
49 *
50 * <ul>
51 * <li>Empty key corresponds to @ref CandleSymbol::getPeriod() "period" &mdash; aggregation period of this symbol.
52 * The period value is composed of an optional @ref CandlePeriod::getValue() "value" which defaults to 1 when not
53 * specified, followed by a @ref CandlePeriod::getType() "type" string which is defined by one of the CandleType
54 * values and can be abbreviated to first letters. For example, a daily candle of "IBM" base symbol can be
55 * specified as "IBM{=d}" and 15 minute candle on it as "IBM{=15m}". The shortest possible abbreviation for
56 * CandleType::MONTH is "mo", so the monthly candle can be specified as "IBM{=mo}". When a period is not specified,
57 * then the CandlePeriod::TICK aggregation period is assumed as default. Note that tick aggregation may not be
58 * available on the demo system, which is limited to a subset of symbols and aggregation periods.
59 * <li>"price" key corresponds to @ref CandleSymbol::getPrice() "price" &mdash; price type attribute of this symbol.
60 * The CandlePrice defines possible values with CandlePrice::LAST being default.
61 * For legacy backwards-compatibility purposes, most of the price values cannot be abbreviated, so a one-minute
62 * candle of "EUR/USD" bid price shall be specified with "EUR/USD{=m,price=bid}" candle symbol string. However, the
63 * CandlePrice::SETTLEMENT can be abbreviated to "s", so a daily candle on "/ES" futures settlement prices can be
64 * specified with "/ES{=d,price=s}" string.
65 * <li>"tho" key with a value of "true" corresponds to @ref CandleSymbol::getSession() "session" set to
66 * CandleSession::REGULAR which limits the candle to trading hours only, so a 133 tick candles on "GOOG" base symbol
67 * collected over trading hours only can be specified with "GOOG{=133t,tho=true}" string. Note that the default daily
68 * candles for US equities are special for historical reasons and correspond to the way US equity exchange report their
69 * daily summary data. The volume of the US equity default daily candle corresponds to the total daily traded volume,
70 * while open, high, low, and close correspond to the regular trading hours only.
71 * <li>"a" key corresponds to @ref CandleSymbol::getAlignment() "alignment" &mdash; alignment attribute of this symbol.
72 * The CandleAlignment defines possible values with CandleAlignment::MIDNIGHT being default. The alignment values
73 * can be abbreviated to the first letter. So, a 1 hour candle on a symbol "AAPL" that starts at the regular
74 * trading session at 9:30 am ET can be specified with "AAPL{=h,a=s,tho=true}". Contrast that to
75 * the "AAPL{=h,tho=true}" candle that is aligned at midnight and thus starts at 9:00 am.
76 * <li>"pl" key corresponds to @ref CandleSymbol::getPriceLevel() "price level" &mdash; price level attribute of this
77 * symbol. The CandlePriceLevel defines additional axis to split candles within particular price corridor in addition to
78 * CandlePeriod attribute with the default value `NaN`. So a one-minute candles of "AAPL" with price level 0.1
79 * shall be specified with "AAPL{=m,pl=0.1}".
80 * </ul>
81 *
82 * Keys in the candle symbol are case-sensitive, while values are not. The CandleSymbol::valueOf() method parses any
83 * valid string representation into a candle symbol object. The result of the candle symbol CandleSymbol::toString()
84 * method is always normalized: keys are ordered lexicographically, values are in lower-case and are abbreviated to
85 * their shortest possible form.
86 */
88 static const CandleSymbol NUL;
89
90 private:
91 std::string symbol_{};
92 std::string baseSymbol_{};
93 std::optional<CandleExchange> exchange_{};
94 std::optional<CandlePrice> price_{};
95 std::optional<CandleSession> session_{};
96 std::optional<CandlePeriod> period_{};
97 std::optional<CandleAlignment> alignment_{};
98 std::optional<CandlePriceLevel> priceLevel_{};
99
100 static std::string changeAttribute(const StringLike &symbol,
101 const CandleSymbolAttributeVariant &attribute) noexcept;
102
103 template <typename AttributeIt>
104 static std::string changeAttributes(const StringLike &s, AttributeIt begin, AttributeIt end) noexcept {
105 auto symbol = std::string(s);
106
107 for (auto it = begin; it != end; ++it) {
108 symbol = changeAttribute(symbol, *it);
109 }
110
111 return symbol;
112 }
113
114 static std::string normalize(const StringLike &s) noexcept;
115
116 void initTransientFields(bool force = false) noexcept;
117
118 explicit CandleSymbol(const StringLike &symbol) noexcept;
119
120 CandleSymbol(const StringLike &symbol, const CandleSymbolAttributeVariant &attribute) noexcept;
121
122 template <typename CandleSymbolAttributeIt>
123 CandleSymbol(const StringLike &symbol, CandleSymbolAttributeIt begin, CandleSymbolAttributeIt end) noexcept
124 : symbol_{normalize(changeAttributes(symbol, begin, end))} {
125 initTransientFields();
126 }
127
128 public:
129 /**
130 * Returns base market symbol without attributes.
131 *
132 * @return base market symbol without attributes.
133 */
134 const std::string &getBaseSymbol() const & noexcept;
135
136 /**
137 * Returns exchange attribute of this symbol.
138 *
139 * @return exchange attribute of this symbol.
140 */
141 const std::optional<CandleExchange> &getExchange() const & noexcept;
142
143 /**
144 * Returns the price type attribute of this symbol.
145 *
146 * @return price type attribute of this symbol.
147 */
148 const std::optional<CandlePrice> &getPrice() const & noexcept;
149
150 /**
151 * Returns the session attribute of this symbol.
152 *
153 * @return session attribute of this symbol.
154 */
155 const std::optional<CandleSession> &getSession() const & noexcept;
156
157 /**
158 * Returns the aggregation period of this symbol.
159 *
160 * @return aggregation period of this symbol.
161 */
162 const std::optional<CandlePeriod> &getPeriod() const & noexcept;
163
164 /**
165 * Returns alignment attribute of this symbol.
166 *
167 * @return alignment attribute of this symbol.
168 */
169 const std::optional<CandleAlignment> &getAlignment() const & noexcept;
170
171 /**
172 * Returns the price level attribute of this symbol.
173 *
174 * @return price level attribute of this symbol.
175 */
176 const std::optional<CandlePriceLevel> &getPriceLevel() const & noexcept;
177
178 /**
179 * Returns string representation of this symbol.
180 * The string representation can be transformed back into a symbol object
181 * using the CandleSymbol::valueOf() method.
182 *
183 * @return string representation of this symbol.
184 */
185 const std::string &toString() const & noexcept;
186
187 bool operator==(const CandleSymbol &candleSymbol) const noexcept;
188
189 bool operator<(const CandleSymbol &candleSymbol) const noexcept;
190
191 CandleSymbol(const CandleSymbol &candleSymbol) noexcept;
192 CandleSymbol(CandleSymbol &&candleSymbol) noexcept;
193 CandleSymbol &operator=(const CandleSymbol &candleSymbol) noexcept;
194 CandleSymbol &operator=(CandleSymbol &&candleSymbol) noexcept;
195 CandleSymbol() noexcept;
196 virtual ~CandleSymbol() noexcept;
197
198 /**
199 * Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
200 * Fills the dxFeed Graal SDK structure's fields by the data of the current entity (recursively if necessary).
201 * Returns the pointer to the filled structure.
202 *
203 * @return The pointer to the filled dxFeed Graal SDK structure
204 */
205 virtual void *toGraal() const;
206
207 /**
208 * Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
209 *
210 * @param graalNative The pointer to the dxFeed Graal SDK structure.
211 * @throws InvalidArgumentException
212 */
213 static void freeGraal(void *graalNative);
214
215 /**
216 * Creates an object of the current type and fills it with data from the dxFeed Graal SDK structure.
217 *
218 * @param graalNative The pointer to the dxFeed Graal SDK structure.
219 * @return The object of the current type.
220 * @throws InvalidArgumentException
221 */
222 static CandleSymbol fromGraal(void *graalNative);
223
224 /**
225 * Converts the given string symbol into the candle symbol object.
226 *
227 * @param symbol The string symbol.
228 * @return The candle symbol object.
229 */
230 static CandleSymbol valueOf(const StringLike &symbol) noexcept;
231
232 /**
233 * Converts the given string symbol into the candle symbol object with the specified attribute set.
234 *
235 * @param symbol The string symbol.
236 * @param attribute The attribute to set.
237 * @return The candle symbol object.
238 */
239 static CandleSymbol valueOf(const StringLike &symbol, const CandleSymbolAttributeVariant &attribute) noexcept;
240
241 /**
242 * Converts the given string symbol into the candle symbol object with the specified attribute set (iterators).
243 *
244 * @tparam CandleSymbolAttributeIt The attribute iterator type.
245 * @param symbol The string symbol.
246 * @param begin The beginning of the collection of attributes.
247 * @param end The end of the collection of attributes.
248 * @return
249 */
250 template <typename CandleSymbolAttributeIt>
251 static CandleSymbol valueOf(const StringLike &symbol, CandleSymbolAttributeIt begin,
252 CandleSymbolAttributeIt end) noexcept {
253 return CandleSymbol{symbol, begin, end};
254 }
255
256 /**
257 * Converts the given string symbol into the candle symbol object with the specified attributes set (initializer
258 * list).
259 *
260 * @param symbol The string symbol.
261 * @param attributes More attributes to set.
262 * @return The candle symbol object.
263 */
264 static CandleSymbol valueOf(const StringLike &symbol,
265 std::initializer_list<CandleSymbolAttributeVariant> attributes) noexcept;
266
267 /**
268 * Converts the given string symbol into the candle symbol object with the specified attributes set.
269 *
270 * @tparam CandleSymbolAttributesCollection The collection of attributes type.
271 * @param symbol The string symbol.
272 * @param attributes More attributes to set.
273 * @return The candle symbol object.
274 */
275 template <typename CandleSymbolAttributesCollection>
277 { std::begin(attributes) };
278 { std::end(attributes) };
279 }
283};
284
285inline namespace literals {
286
287/**
288 * String literal that helps to construct CandleSymbol from a char array.
289 *
290 * @param string The char array
291 * @param length Tha char array's length
292 * @return Wrapped string view built on char array
293 */
294CandleSymbol operator""_c(const char *string, size_t length) noexcept;
295
296} // namespace literals
297
299
300/// @}
301
302template <> struct std::hash<dxfcpp::CandleSymbol> {
303 std::size_t operator()(const dxfcpp::CandleSymbol &candleSymbol) const noexcept {
304 return std::hash<std::string>{}(candleSymbol.toString());
305 }
306};
307
#define DXFCPP_MACRO_CONCAT_INNER(a, b)
Definition Common.hpp:129
#define DXFCPP_MACRO_CONCAT(a, b)
Definition Common.hpp:128
#define DXFCPP_MACRO_UNIQUE_NAME(base)
Definition Common.hpp:130
#define DXFCXX_DISABLE_MSC_WARNINGS_POP()
Definition Conf.hpp:31
#define DXFCPP_END_NAMESPACE
Definition Conf.hpp:97
#define DXFCPP_BEGIN_NAMESPACE
Definition Conf.hpp:94
#define DXFCXX_DISABLE_GCC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:47
#define DXFCXX_DISABLE_GCC_WARNINGS_POP()
Definition Conf.hpp:49
#define DXFCXX_DISABLE_MSC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:30
#define DXFCPP_TRACE_ISOLATES
Definition Debug.hpp:19
#define DXFCPP_DEBUG
Definition Debug.hpp:15
#define DXFCPP_TRACE_LISTS
Definition Debug.hpp:22
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_name(dxfc_dxendpoint_builder_t builderHandle, const char *name)
Changes the name used to distinguish multiple endpoints in the same process (GraalVM Isolate) in logs...
Definition DXEndpoint.cpp:692
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_properties(dxfc_dxendpoint_builder_t builder, const dxfc_dxendpoint_property_t **properties, size_t size)
Sets all supported properties from the provided properties object.
Definition DXEndpoint.cpp:725
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_password(dxfc_dxendpoint_t endpoint, const char *password)
Changes password for this endpoint.
Definition DXEndpoint.cpp:973
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_publisher(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxpublisher_t *publisher)
Definition DXEndpoint.cpp:1163
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_supports_property(dxfc_dxendpoint_builder_t builder, const char *key, DXFC_OUT int *supports)
Checks if a property is supported.
Definition DXEndpoint.cpp:752
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_add_state_change_listener(dxfc_dxendpoint_t endpoint, dxfc_dxendpoint_state_change_listener listener)
Adds a listener notified about changes in state property.
Definition DXEndpoint.cpp:1109
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_disconnect(dxfc_dxendpoint_t endpoint)
Terminates all remote network connections.
Definition DXEndpoint.cpp:1024
#define DXFCPP_EXPORT
Definition api.h:35
void * dxfc_dxendpoint_builder_t
The dxFeed endpoint's builder handle.
Definition api.h:207
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_close_and_await_termination(dxfc_dxendpoint_t endpoint)
Closes this endpoint and wait until all pending data processing tasks are completed.
Definition DXEndpoint.cpp:922
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_await_not_connected(dxfc_dxendpoint_t endpoint)
Waits while this endpoint state becomes NOT_CONNECTED or CLOSED.
Definition DXEndpoint.cpp:1075
dxfc_dxendpoint_state_t
Represents the current state of endpoint.
Definition api.h:149
@ DXFC_DXENDPOINT_STATE_CLOSED
Endpoint was closed.
Definition api.h:169
@ DXFC_DXENDPOINT_STATE_NOT_CONNECTED
Endpoint was created by is not connected to remote endpoints.
Definition api.h:153
@ DXFC_DXENDPOINT_STATE_CONNECTING
The connect function was called to establish connection to remove endpoint, but the connection is not...
Definition api.h:159
@ DXFC_DXENDPOINT_STATE_CONNECTED
The connection to the remote endpoint is established.
Definition api.h:164
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_instance(void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Returns a default application-wide singleton instance of dxFeed endpoint with a FEED role.
Definition DXEndpoint.cpp:811
#define DXFC_OUT
Definition api.h:17
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_state(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxendpoint_state_t *state)
Returns the state of this endpoint.
Definition DXEndpoint.cpp:1092
void * dxfc_dxendpoint_t
The dxFeed endpoint handle.
Definition api.h:198
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_property(dxfc_dxendpoint_builder_t builder, const char *key, const char *value)
Sets the specified property.
Definition DXEndpoint.cpp:708
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_free(dxfc_dxendpoint_builder_t builder)
Removes a builder from the registry.
Definition DXEndpoint.cpp:799
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_connect(dxfc_dxendpoint_t endpoint, const char *address)
Connects to the specified remote address.
Definition DXEndpoint.cpp:990
dxfc_error_code_t
List of error codes.
Definition api.h:49
@ DXFC_EC_ERROR
The error returned if the current operation cannot be completed.
Definition api.h:60
@ DXFC_EC_SUCCESS
OK.
Definition api.h:53
@ DXFC_EC_G_ERR
dxFeed Graal Native API error.
Definition api.h:57
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_remove_state_change_listener(dxfc_dxendpoint_t endpoint, dxfc_dxendpoint_state_change_listener listener)
Removes a listener notified about changes in state property.
Definition DXEndpoint.cpp:1135
DXFCPP_EXPORT dxfc_error_code_t dxfc_system_set_property(const char *key, const char *value)
Sets the system property indicated by the specified key.
Definition System.cpp:73
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_build(dxfc_dxendpoint_builder_t builder, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Builds the new dxFeed endpoint instance.
Definition DXEndpoint.cpp:769
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_feed(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxfeed_t *feed)
Definition DXEndpoint.cpp:1158
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_await_processed(dxfc_dxendpoint_t endpoint)
Waits until this endpoint stops processing data (becomes quiescent).
Definition DXEndpoint.cpp:1058
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_close(dxfc_dxendpoint_t endpoint)
Closes this endpoint.
Definition DXEndpoint.cpp:905
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_new_builder(DXFC_OUT dxfc_dxendpoint_builder_t *builder)
Creates a new dxFeed endpoint's builder instance.
Definition DXEndpoint.cpp:659
void(* dxfc_dxendpoint_state_change_listener)(dxfc_dxendpoint_state_t old_state, dxfc_dxendpoint_state_t new_state, void *user_data)
The endpoint current state change listener.
Definition api.h:178
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_reconnect(dxfc_dxendpoint_t endpoint)
Terminates all established network connections and initiates connecting again with the same address.
Definition DXEndpoint.cpp:1007
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_role(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxendpoint_role_t *role)
Returns the role of this endpoint.
Definition DXEndpoint.cpp:939
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_user(dxfc_dxendpoint_t endpoint, const char *user)
Changes username for this endpoint.
Definition DXEndpoint.cpp:956
DXFCPP_EXPORT dxfc_error_code_t dxfc_system_get_property(const char *key, DXFC_OUT char *buffer, size_t buffer_size)
Gets the system property indicated by the specified key.
dxfc_dxendpoint_role_t
Represents the role of an endpoint that was specified during its creation.
Definition api.h:89
@ DXFC_DXENDPOINT_ROLE_PUBLISHER
PUBLISHER endpoint connects to the remote publisher hub (also known as multiplexor) or creates a publ...
Definition api.h:127
@ DXFC_DXENDPOINT_ROLE_STREAM_FEED
STREAM_FEED endpoint is similar to DXFC_DXENDPOINT_ROLE_FEED and also connects to the remote data fee...
Definition api.h:116
@ DXFC_DXENDPOINT_ROLE_FEED
FEED endpoint connects to the remote data feed provider and is optimized for real-time or delayed dat...
Definition api.h:99
@ DXFC_DXENDPOINT_ROLE_STREAM_PUBLISHER
STREAM_PUBLISHER endpoint is similar to DXFC_DXENDPOINT_ROLE_PUBLISHER and also connects to the remot...
Definition api.h:136
@ DXFC_DXENDPOINT_ROLE_LOCAL_HUB
LOCAL_HUB endpoint is a local hub without the ability to establish network connections.
Definition api.h:143
@ DXFC_DXENDPOINT_ROLE_ON_DEMAND_FEED
ON_DEMAND_FEED endpoint is similar to DXFC_DXENDPOINT_ROLE_FEED, but it is designed to be used with d...
Definition api.h:107
void * dxfc_dxpublisher_t
The dxFeed publisher handle.
Definition api.h:217
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_create(void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Creates an endpoint with FEED role.
Definition DXEndpoint.cpp:858
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_instance2(dxfc_dxendpoint_role_t role, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Returns a default application-wide singleton instance of DXEndpoint for a specific role.
Definition DXEndpoint.cpp:834
void * dxfc_dxfeed_t
The dxFeed handle.
Definition api.h:212
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_role(dxfc_dxendpoint_builder_t builder, dxfc_dxendpoint_role_t role)
Sets role for the created dxFeed endpoint.
Definition DXEndpoint.cpp:675
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_create2(dxfc_dxendpoint_role_t role, void *user_data, DXFC_OUT dxfc_dxendpoint_t *endpoint)
Creates an endpoint with a specified role.
Definition DXEndpoint.cpp:881
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_free(dxfc_dxendpoint_t endpoint)
Removes the dxFeed endpoint from the registry.
Definition DXEndpoint.cpp:1168
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_disconnect_and_clear(dxfc_dxendpoint_t endpoint)
Terminates all remote network connections and clears stored data.
Definition DXEndpoint.cpp:1041
Builder class for DXEndpoint that supports additional configuration properties.
Definition DXEndpoint.hpp:850
std::shared_ptr< DXEndpoint > build()
Builds DXEndpoint instance.
Definition DXEndpoint.cpp:335
std::shared_ptr< Builder > withName(const StringLike &name)
Changes the name used to distinguish multiple endpoints in the same process (GraalVM Isolate) in logs...
Definition DXEndpoint.cpp:378
bool supportsProperty(const StringLike &key) const
Checks if a property is supported.
Definition DXEndpoint.cpp:325
std::shared_ptr< Builder > withProperties(Properties &&properties)
Sets all supported properties from the provided properties object.
Definition DXEndpoint.hpp:939
~Builder() noexcept override
Releases the GraalVM handle.
Definition DXEndpoint.cpp:367
std::shared_ptr< Builder > withRole(Role role)
Sets role for the created DXEndpoint.
Definition DXEndpoint.cpp:297
std::shared_ptr< Builder > withProperty(const StringLike &key, const StringLike &value)
Sets the specified property.
Definition DXEndpoint.cpp:310
Subscription for a set of symbols and event types.
Definition DXFeedSubscription.hpp:44
bool containsEventType(const EventTypeEnum &eventType) override
Returns true if this subscription contains the corresponding event type.
Definition DXFeedSubscription.cpp:227
std::size_t addChangeListener(std::shared_ptr< ObservableSubscriptionChangeListener > listener) override
Adds subscription change listener.
Definition DXFeedSubscription.cpp:318
bool isClosed() override
Returns true if this subscription is closed.
Definition DXFeedSubscription.cpp:205
void addSymbols(SymbolIt begin, SymbolIt end) const
Adds the specified collection (using iterators) of symbols to the set of subscribed symbols.
Definition DXFeedSubscription.hpp:433
void close() const
Closes this subscription and makes it permanently detached.
Definition DXFeedSubscription.cpp:214
void setEventsBatchLimit(std::int32_t eventsBatchLimit) const
Sets maximum number of events in the single notification of OnEventHandler.
Definition DXFeedSubscription.cpp:356
std::unordered_set< EventTypeEnum > getEventTypes() override
Returns a set of subscribed event types.
Definition DXFeedSubscription.cpp:223
void setSymbols(std::initializer_list< SymbolWrapper > collection) const
Changes the set of subscribed symbols so that it contains just the symbols from the specified collect...
Definition DXFeedSubscription.cpp:258
void removeSymbols(SymbolIt begin, SymbolIt end) const
Removes the specified collection (using iterators) of symbols from the set of subscribed symbols.
Definition DXFeedSubscription.hpp:505
void removeSymbols(SymbolsCollection &&collection) const
Removes the specified collection of symbols from the set of subscribed symbols.
Definition DXFeedSubscription.hpp:531
static const std::int32_t MAX_BATCH_LIMIT
The maximum events' batch limit for a single notification in OnEventHandler.
Definition DXFeedSubscription.hpp:60
void removeSymbols(const SymbolWrapper &symbolWrapper) const
Removes the specified symbol from the set of subscribed symbols.
Definition DXFeedSubscription.cpp:277
void attach(std::shared_ptr< DXFeed > feed)
Attaches subscription to the specified feed.
Definition DXFeedSubscription.cpp:187
TimePeriod getAggregationPeriod() const
Returns the aggregation period for data for this subscription instance.
Definition DXFeedSubscription.cpp:292
std::string toString() const override
Returns a string representation of the current object.
Definition DXFeedSubscription.cpp:145
static const std::int32_t OPTIMAL_BATCH_LIMIT
The optimal events' batch limit for a single notification in OnEventHandler.
Definition DXFeedSubscription.hpp:55
std::size_t addEventListener(std::function< void(const std::vector< std::shared_ptr< EventT > > &)> &&listener)
Adds typed listener for events.
Definition DXFeedSubscription.hpp:674
void addSymbols(std::initializer_list< SymbolWrapper > collection) const
Adds the specified collection (initializer list) of symbols to the set of subscribed symbols.
Definition DXFeedSubscription.cpp:273
void setSymbols(SymbolsCollection &&collection) const
Changes the set of subscribed symbols so that it contains just the symbols from the specified collect...
Definition DXFeedSubscription.hpp:384
void setAggregationPeriod(const TimePeriod &aggregationPeriod) const
Sets the aggregation period for data.
Definition DXFeedSubscription.cpp:296
static std::shared_ptr< DXFeedSubscription > create(const EventTypeEnum &eventType)
Creates a detached subscription for a single event type.
Definition DXFeedSubscription.cpp:164
std::int32_t getEventsBatchLimit() const
Definition DXFeedSubscription.cpp:352
std::size_t addEventListener(EventListener &&listener)
Adds listener for events.
Definition DXFeedSubscription.hpp:619
static std::shared_ptr< DXFeedSubscription > create(EventTypesCollection &&eventTypes)
Creates a detached subscription for the given collection of event types.
Definition DXFeedSubscription.hpp:260
OnEventHandler & onEvent()
Returns a reference to an incoming events' handler (delegate), to which listeners can be added and re...
Definition DXFeedSubscription.cpp:312
void addSymbols(const SymbolsCollection &collection) const
Adds the specified collection of symbols to the set of subscribed symbols.
Definition DXFeedSubscription.hpp:459
void setSymbols(SymbolIt begin, SymbolIt end) const
Changes the set of subscribed symbols so that it contains just the symbols from the specified collect...
Definition DXFeedSubscription.hpp:358
void setAggregationPeriod(std::int64_t aggregationPeriod) const
Sets the aggregation period for data.
Definition DXFeedSubscription.cpp:304
void removeChangeListener(std::size_t changeListenerId) override
Removes subscription change listener by id.
Definition DXFeedSubscription.cpp:335
std::vector< SymbolWrapper > getDecoratedSymbols() const
Returns a set of decorated symbols (depending on the actual implementation of the subscription).
Definition DXFeedSubscription.cpp:249
void clear() const
Clears the set of subscribed symbols.
Definition DXFeedSubscription.cpp:231
void detach(std::shared_ptr< DXFeed > feed)
Detaches subscription from the specified feed.
Definition DXFeedSubscription.cpp:196
void addSymbols(const SymbolWrapper &symbolWrapper) const
Adds the specified symbol to the set of subscribed symbols.
Definition DXFeedSubscription.cpp:262
void setAggregationPeriod(std::chrono::milliseconds aggregationPeriod) const
Sets the aggregation period for data.
Definition DXFeedSubscription.cpp:300
void removeSymbols(std::initializer_list< SymbolWrapper > collection) const
Removes the specified collection (initializer list) of symbols from the set of subscribed symbols.
Definition DXFeedSubscription.cpp:288
std::vector< SymbolWrapper > getSymbols() const
Returns a set of subscribed symbols (depending on the actual implementation of the subscription).
Definition DXFeedSubscription.cpp:240
Extends DXFeedSubscription to conveniently subscribe to time-series of events for a set of symbols an...
Definition DXFeedSubscription.hpp:785
std::int64_t getFromTime()
Returns the earliest timestamp from which time-series of events shall be received.
Definition DXFeedSubscription.cpp:384
void setFromTime(std::chrono::milliseconds fromTime)
Sets the earliest timestamp from which time-series of events shall be received.
Definition DXFeedSubscription.cpp:395
void setFromTime(std::int64_t fromTime)
Sets the earliest timestamp from which time-series of events shall be received.
Definition DXFeedSubscription.cpp:388
The enumeration type that provides additional information about the dxFeed Graal C++-API event type.
Definition EventTypeEnum.hpp:26
bool isTimeSeries() const noexcept
Definition EventTypeEnum.cpp:148
const std::string & getClassName() const &noexcept
Definition EventTypeEnum.cpp:120
bool isLasting() const noexcept
Definition EventTypeEnum.cpp:140
bool isOnlyIndexed() const noexcept
Definition EventTypeEnum.cpp:152
bool isIndexed() const noexcept
Definition EventTypeEnum.cpp:144
std::uint32_t getId() const noexcept
Definition EventTypeEnum.cpp:112
bool isMarket() const noexcept
Definition EventTypeEnum.cpp:156
const std::string & getName() const &noexcept
Definition EventTypeEnum.cpp:116
Represents a subscription to a specific source of indexed events.
Definition IndexedEventSubscriptionSymbol.hpp:42
virtual const std::unique_ptr< SymbolWrapper > & getEventSymbol() const
Returns the wrapped event symbol (CandleSymbol, WildcardSymbol, etc.).
Definition IndexedEventSubscriptionSymbol.cpp:18
virtual void * toGraal() const
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition IndexedEventSubscriptionSymbol.cpp:26
static IndexedEventSubscriptionSymbol fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the dxFeed Graal SDK structure (rec...
Definition IndexedEventSubscriptionSymbol.cpp:48
virtual const std::unique_ptr< IndexedEventSource > & getSource() const
Returns indexed event source.
Definition IndexedEventSubscriptionSymbol.cpp:22
IndexedEventSubscriptionSymbol(const SymbolWrapper &eventSymbol, const IndexedEventSource &source)
Creates an indexed event subscription symbol with a specified event symbol and source.
Definition IndexedEventSubscriptionSymbol.cpp:12
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition IndexedEventSubscriptionSymbol.cpp:35
virtual std::string toString() const
Returns string representation of this indexed event subscription symbol.
Definition IndexedEventSubscriptionSymbol.cpp:64
TimeSeriesSubscriptionSymbol(const SymbolWrapper &eventSymbol, std::int64_t fromTime)
Creates a time-series subscription symbol with a specified event symbol and subscription time.
void * toGraal() const override
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition TimeSeriesSubscriptionSymbol.cpp:19
std::string toString() const override
Returns string representation of this time-series subscription symbol.
Definition TimeSeriesSubscriptionSymbol.cpp:66
std::int64_t getFromTime() const
Returns the subscription time.
Definition TimeSeriesSubscriptionSymbol.cpp:15
static TimeSeriesSubscriptionSymbol fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the dxFeed Graal SDK structure (rec...
Definition TimeSeriesSubscriptionSymbol.cpp:50
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition TimeSeriesSubscriptionSymbol.cpp:33
Candle alignment attribute of CandleSymbol defines how candles are aligned with respect to time.
Definition CandleAlignment.hpp:37
Exchange attribute of CandleSymbol defines the exchange identifier where data is taken from to build ...
Definition CandleExchange.hpp:34
Period attribute of CandleSymbol defines an aggregation period of the candles.
Definition CandlePeriod.hpp:38
Candle price level attribute of CandleSymbol defines how candles shall be aggregated in respect to a ...
Definition CandlePriceLevel.hpp:45
Price type attribute of CandleSymbol defines the price used to build the candles.
Definition CandlePrice.hpp:39
Symbol that should be used with DXFeedSubscription class to subscribe for Candle events.
Definition CandleSymbol.hpp:87
const std::optional< CandlePeriod > & getPeriod() const &noexcept
Returns the aggregation period of this symbol.
Definition CandleSymbol.cpp:226
const std::optional< CandlePriceLevel > & getPriceLevel() const &noexcept
Returns the price level attribute of this symbol.
Definition CandleSymbol.cpp:234
const std::optional< CandleExchange > & getExchange() const &noexcept
Returns exchange attribute of this symbol.
Definition CandleSymbol.cpp:214
static CandleSymbol valueOf(const StringLike &symbol, const CandleSymbolAttributeVariant &attribute) noexcept
Converts the given string symbol into the candle symbol object with the specified attribute set.
Definition CandleSymbol.cpp:334
const std::string & getBaseSymbol() const &noexcept
Returns base market symbol without attributes.
Definition CandleSymbol.cpp:210
static CandleSymbol valueOf(const StringLike &symbol, std::initializer_list< CandleSymbolAttributeVariant > attributes) noexcept
Converts the given string symbol into the candle symbol object with the specified attributes set (ini...
Definition CandleSymbol.cpp:338
static CandleSymbol valueOf(const StringLike &symbol) noexcept
Converts the given string symbol into the candle symbol object.
Definition CandleSymbol.cpp:330
const std::optional< CandlePrice > & getPrice() const &noexcept
Returns the price type attribute of this symbol.
Definition CandleSymbol.cpp:218
static CandleSymbol valueOf(const StringLike &symbol, CandleSymbolAttributeIt begin, CandleSymbolAttributeIt end) noexcept
Converts the given string symbol into the candle symbol object with the specified attribute set (iter...
Definition CandleSymbol.hpp:251
virtual void * toGraal() const
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition CandleSymbol.cpp:288
const std::string & toString() const &noexcept
Returns string representation of this symbol.
Definition CandleSymbol.cpp:238
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition CandleSymbol.cpp:299
const std::optional< CandleSession > & getSession() const &noexcept
Returns the session attribute of this symbol.
Definition CandleSymbol.cpp:222
static CandleSymbol fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the dxFeed Graal SDK structure.
Definition CandleSymbol.cpp:315
const std::optional< CandleAlignment > & getAlignment() const &noexcept
Returns alignment attribute of this symbol.
Definition CandleSymbol.cpp:230
Mixin for wrapping calls to common promise methods.
Definition Promise.hpp:79
JavaException getException() const
Returns exceptional outcome of computation.
Definition Promise.hpp:127
void cancel() const
This method cancels computation.
Definition Promise.hpp:174
bool hasResult() const
Returns true when computation has completed normally.
Definition Promise.hpp:95
bool isCancelled() const
Returns true when computation was cancelled.
Definition Promise.hpp:114
bool hasException() const
Returns true when a computation has completed exceptionally or was canceled.
Definition Promise.hpp:104
bool awaitWithoutException(const std::chrono::milliseconds &timeoutInMilliseconds) const
Wait for computation to complete or timeout or throw an exception in case of exceptional completion.
Definition Promise.hpp:161
bool isDone() const
Returns true when a computation has completed normally, or exceptionally, or was canceled.
Definition Promise.hpp:85
bool awaitWithoutException(std::int32_t timeoutInMilliseconds) const
Wait for computation to complete or timeout or throw an exception in case of exceptional completion.
Definition Promise.hpp:144
Manages network connections to feed or publisher.
Definition DXEndpoint.hpp:179
bool isClosed() const
Definition DXEndpoint.cpp:511
SimpleHandler< void(DXEndpoint::State, DXEndpoint::State)> & onStateChange() noexcept
Returns the onStateChange handler that can be used to add or remove listeners.
Definition DXEndpoint.cpp:523
static const std::string DXFEED_PASSWORD_PROPERTY
"dxfeed.password"
Definition DXEndpoint.hpp:246
static std::shared_ptr< DXEndpoint > create(Role role)
Creates an endpoint with a specified role.
Definition DXEndpoint.cpp:498
std::shared_ptr< DXFeed > getFeed() const
Definition DXEndpoint.cpp:224
std::shared_ptr< DXEndpoint > password(const StringLike &password)
Changes password for this endpoint.
Definition DXEndpoint.cpp:151
State
Represents the current state of endpoint.
Definition DXEndpoint.hpp:444
@ CLOSED
Endpoint was closed.
Definition DXEndpoint.hpp:464
@ CONNECTING
The connect method was called to establish connection to remove endpoint, but the connection is not e...
Definition DXEndpoint.hpp:454
@ CONNECTED
The connection to the remote endpoint is established.
Definition DXEndpoint.hpp:459
@ NOT_CONNECTED
Endpoint was created by is not connected to remote endpoints.
Definition DXEndpoint.hpp:448
std::shared_ptr< DXEndpoint > user(const StringLike &user)
Changes username for this endpoint.
Definition DXEndpoint.cpp:144
void reconnect() const
Terminates all established network connections and initiates connecting again with the same address.
Definition DXEndpoint.cpp:170
static std::shared_ptr< DXEndpoint > create()
Creates an endpoint with FEED role.
Definition DXEndpoint.cpp:489
void removeStateChangeListener(std::size_t listenerId) noexcept
Removes a listener notified about changes in state property.
Definition DXEndpoint.cpp:519
const std::string & getName() const &noexcept
Definition DXEndpoint.cpp:515
Role
Represents the role of an endpoint that was specified during its creation.
Definition DXEndpoint.hpp:373
@ PUBLISHER
PUBLISHER endpoint connects to the remote publisher hub (also known as multiplexor) or creates a publ...
Definition DXEndpoint.hpp:418
@ STREAM_FEED
STREAM_FEED endpoint is similar to DXEndpoint::FEED and also connects to the remote data feed provide...
Definition DXEndpoint.hpp:406
@ LOCAL_HUB
LOCAL_HUB endpoint is a local hub without the ability to establish network connections.
Definition DXEndpoint.hpp:434
@ ON_DEMAND_FEED
ON_DEMAND_FEED endpoint is similar to DXEndpoint::FEED, but it is designed to be used with OnDemandSe...
Definition DXEndpoint.hpp:397
@ STREAM_PUBLISHER
STREAM_PUBLISHER endpoint is similar to DXEndpoint::PUBLISHER and also connects to the remote publish...
Definition DXEndpoint.hpp:427
@ FEED
FEED endpoint connects to the remote data feed provider and is optimized for real-time or delayed dat...
Definition DXEndpoint.hpp:384
std::string toString() const override
Returns a string representation of the current object.
Definition DXEndpoint.cpp:388
void awaitProcessed() const
Waits until this endpoint stops processing data (becomes quiescent).
Definition DXEndpoint.cpp:206
std::shared_ptr< DXPublisher > getPublisher() const
Definition DXEndpoint.cpp:233
static const std::string DXFEED_WILDCARD_ENABLE_PROPERTY
"dxfeed.wildcard.enable"
Definition DXEndpoint.hpp:274
std::size_t addStateChangeListener(std::function< void(State, State)> listener) noexcept
Adds a listener notified about changes in state property.
Definition DXEndpoint.hpp:619
static const std::string DXENDPOINT_EVENT_TIME_PROPERTY
"dxendpoint.eventTime"
Definition DXEndpoint.hpp:319
static const std::string DXPUBLISHER_THREAD_POOL_SIZE_PROPERTY
"dxpublisher.threadPoolSize"
Definition DXEndpoint.hpp:302
State getState() const
Returns the state of this endpoint.
Definition DXEndpoint.cpp:140
static const std::string DXENDPOINT_STORE_EVERYTHING_PROPERTY
"dxendpoint.storeEverything"
Definition DXEndpoint.hpp:332
void awaitNotConnected() const
Waits while this endpoint state becomes NOT_CONNECTED or CLOSED.
Definition DXEndpoint.cpp:197
static std::shared_ptr< DXEndpoint > getInstance(Role role)
Returns a default application-wide singleton instance of DXEndpoint for a specific role.
Definition DXEndpoint.cpp:471
static const std::string DXFEED_AGGREGATION_PERIOD_PROPERTY
"dxfeed.aggregationPeriod"
Definition DXEndpoint.hpp:265
void close() const
Closes this endpoint.
Definition DXEndpoint.cpp:527
static const std::string DXFEED_THREAD_POOL_SIZE_PROPERTY
"dxfeed.threadPoolSize"
Definition DXEndpoint.hpp:255
void disconnect() const
Terminates all remote network connections.
Definition DXEndpoint.cpp:179
void closeAndAwaitTermination() const
Closes this endpoint and wait until all pending data processing tasks are completed.
Definition DXEndpoint.cpp:215
static std::shared_ptr< DXEndpoint > getInstance()
Returns a default application-wide singleton instance of DXEndpoint with a FEED role.
Definition DXEndpoint.cpp:462
static const std::string DXPUBLISHER_ADDRESS_PROPERTY
"dxpublisher.address"
Definition DXEndpoint.hpp:293
static const std::string DXFEED_USER_PROPERTY
"dxfeed.user"
Definition DXEndpoint.hpp:236
static const std::string NAME_PROPERTY
"name"
Definition DXEndpoint.hpp:196
static const std::string DXSCHEME_ENABLED_PROPERTY_PREFIX
"dxscheme.enabled."
Definition DXEndpoint.hpp:366
static const std::string DXPUBLISHER_PROPERTIES_PROPERTY
"dxpublisher.properties"
Definition DXEndpoint.hpp:283
static const std::string DXSCHEME_NANO_TIME_PROPERTY
"dxscheme.nanoTime"
Definition DXEndpoint.hpp:352
static const std::string DXFEED_ADDRESS_PROPERTY
"dxfeed.address"
Definition DXEndpoint.hpp:226
void disconnectAndClear() const
Terminates all remote network connections and clears stored data.
Definition DXEndpoint.cpp:188
Role getRole() const noexcept
Returns the role of this endpoint.
Definition DXEndpoint.cpp:507
static const std::string DXFEED_PROPERTIES_PROPERTY
"dxfeed.properties"
Definition DXEndpoint.hpp:207
static std::shared_ptr< Builder > newBuilder()
Creates a new Builder instance.
Definition DXEndpoint.cpp:480
std::shared_ptr< DXEndpoint > connect(const StringLike &address)
Connects to the specified remote address.
Definition DXEndpoint.cpp:158
Main entry class for dxFeed API (read it first).
Definition DXFeed.hpp:119
void detachSubscriptionAndClear(const std::shared_ptr< DXFeedSubscription > &subscription) const
Detaches the given subscription from this feed and clears data delivered to this subscription by publ...
Definition DXFeed.cpp:68
std::vector< std::shared_ptr< E > > getTimeSeriesIfSubscribed(const SymbolWrapper &symbol, std::int64_t fromTime) const
Returns time series of events for the specified event type, symbol and a range of time (without an up...
Definition DXFeed.hpp:1006
std::shared_ptr< PromiseList< E > > getLastEventsPromises(std::initializer_list< SymbolWrapper > collection) const
Requests the last events for the specified event type and a collection of symbols.
Definition DXFeed.hpp:722
std::vector< std::shared_ptr< E > > getTimeSeriesIfSubscribed(const SymbolWrapper &symbol, std::chrono::milliseconds fromTime, std::chrono::milliseconds toTime) const
Returns time series of events for the specified event type, symbol and a range of time if there is a ...
Definition DXFeed.hpp:990
std::vector< std::shared_ptr< E > > getTimeSeriesIfSubscribed(const SymbolWrapper &symbol, std::int64_t fromTime, std::int64_t toTime) const
Returns time series of events for the specified event type, symbol and a range of time if there is a ...
Definition DXFeed.hpp:938
std::shared_ptr< DXFeedSubscription > createSubscription(const EventTypeEnum &eventType) const
Creates a new subscription for a single event type that is attached to this feed.
Definition DXFeed.cpp:88
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(std::initializer_list< EventTypeEnum > eventTypes) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.cpp:137
std::shared_ptr< Promise< std::vector< std::shared_ptr< E > > > > getTimeSeriesPromise(const SymbolWrapper &symbol, std::int64_t fromTime, std::int64_t toTime) const
Requests time series of events for the specified event type, symbol and a range of time.
Definition DXFeed.hpp:886
std::shared_ptr< DXFeedSubscription > createSubscription(EventTypeIt begin, EventTypeIt end) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:361
std::shared_ptr< PromiseList< E > > getLastEventsPromises(const SymbolsCollection &collection) const
Requests the last events for the specified event type and a collection of symbols.
Definition DXFeed.hpp:676
std::shared_ptr< E > getLastEventIfSubscribed(const SymbolWrapper &symbol)
Returns the last event for the specified event type and symbol if there is a subscription for it.
Definition DXFeed.hpp:308
std::shared_ptr< DXFeedSubscription > createSubscription(std::initializer_list< EventTypeEnum > eventTypes) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.cpp:101
std::vector< std::shared_ptr< E > > getTimeSeriesIfSubscribed(const SymbolWrapper &symbol, std::chrono::milliseconds fromTime) const
Returns time series of events for the specified event type, symbol and a range of time (without an up...
Definition DXFeed.hpp:1021
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(EventTypeIt begin, EventTypeIt end) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:473
static std::shared_ptr< DXFeed > getInstance()
Returns a default application-wide singleton instance of feed.
Definition DXFeed.cpp:19
std::shared_ptr< E > getLastEvent(std::shared_ptr< E > event)
Returns the last event for the specified event instance.
Definition DXFeed.hpp:248
std::shared_ptr< PromiseList< E > > getLastEventsPromises(SymbolIt begin, SymbolIt end) const
Requests the last events for the specified event type and a collection of symbols.
Definition DXFeed.hpp:629
std::shared_ptr< DXFeedSubscription > createSubscription(const EventTypesCollection &eventTypes) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:411
std::shared_ptr< Promise< std::shared_ptr< E > > > getLastEventPromise(const SymbolWrapper &symbol) const
Requests the last event for the specified event type and symbol.
Definition DXFeed.hpp:581
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(const EventTypesCollection &eventTypes) const
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:540
std::string toString() const override
Returns a string representation of the current object.
Definition DXFeed.cpp:226
std::shared_ptr< Promise< std::vector< std::shared_ptr< E > > > > getIndexedEventsPromise(const SymbolWrapper &symbol, const IndexedEventSource &source) const
Requests a container of indexed events for the specified event type, symbol and source.
Definition DXFeed.hpp:775
void detachSubscription(const std::shared_ptr< DXFeedSubscription > &subscription) const
Detaches the given subscription from this feed.
Definition DXFeed.cpp:48
std::vector< std::shared_ptr< E > > getIndexedEventsIfSubscribed(const SymbolWrapper &symbol, const IndexedEventSource &source) const
Returns a vector of indexed events for the specified event type, symbol and source if there is a subs...
Definition DXFeed.hpp:831
const Collection & getLastEvents(const Collection &events)
Returns the last events for the specified list of event instances.
Definition DXFeed.hpp:269
void attachSubscription(const std::shared_ptr< DXFeedSubscription > &subscription) const
Attaches the given subscription to this feed.
Definition DXFeed.cpp:28
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(const EventTypeEnum &eventType) const
Creates a new subscription for a single event type that is attached to this feed.
Definition DXFeed.cpp:116
Provides API for publishing of events to local or remote DXFeed.
Definition DXPublisher.hpp:60
Mixin for wrapping Promise method calls for a single event.
Definition Promise.hpp:243
std::shared_ptr< E > getResult() const
Returns result of computation.
Definition Promise.hpp:251
std::shared_ptr< E > await() const
Wait for the computation to complete and return its result or throw an exception in case of exception...
Definition Promise.hpp:261
std::shared_ptr< E > await(const std::chrono::milliseconds &timeoutInMilliseconds) const &
Wait for computation to complete or timeout and return its result or throw an exception in case of ex...
Definition Promise.hpp:291
std::shared_ptr< E > await(std::int32_t timeoutInMilliseconds) const &
Wait for computation to complete or timeout and return its result or throw an exception in case of ex...
Definition Promise.hpp:276
Event type parametrized by a symbol.
Definition EventType.hpp:113
virtual const std::optional< Symbol > & getEventSymbolOpt() const &noexcept=0
Returns the event symbol that identifies this event type in subscription.
virtual void setEventSymbol(const Symbol &eventSymbol) noexcept=0
Changes the event symbol that identifies this event type in subscription.
virtual const Symbol & getEventSymbol() const &noexcept=0
Returns the event symbol that identifies this event type in subscription.
Marks all event types that can be received via dxFeed API.
Definition EventType.hpp:36
std::string toString() const override
Returns a string representation of the current object.
Definition api.cpp:67
virtual void * toGraal() const =0
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
virtual std::int64_t getEventTime() const noexcept
Returns time when an event was created or zero when time is not available.
Definition api.cpp:54
virtual void assign(std::shared_ptr< EventType > event)
Replaces the contents of the event.
Definition api.cpp:63
virtual void setEventTime(std::int64_t eventTime) noexcept
Changes event creation time.
Definition api.cpp:58
This marker interface marks subscription symbol classes (like TimeSeriesSubscriptionSymbol) that atta...
Definition FilteredSubscriptionSymbol.hpp:32
The wrapper over CEntryPointErrorsEnum, the error code returned by GraalVM.
Definition GraalException.hpp:26
GraalException(CEntryPointErrorsEnum entryPointErrorsEnum)
Constructs an exception.
Definition GraalException.cpp:8
void handle(ArgTypes... args)
Calls the listeners and pass the args to them.
Definition Handler.hpp:122
std::size_t add(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:156
std::size_t operator%=(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group).
Definition Handler.hpp:208
std::size_t operator+=(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:197
void operator()(ArgTypes... args)
Calls the listeners and pass the ars to them.
Definition Handler.hpp:146
Handler(std::size_t mainFuturesSize=MAIN_FUTURES_DEFAULT_SIZE) noexcept
Creates the new handler by specified size of circular buffer of futures.
Definition Handler.hpp:84
void operator-=(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:236
std::size_t addLowPriority(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group) It will be called after the "main" liste...
Definition Handler.hpp:177
void remove(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:217
Represents an indexed collection of up-to-date information about some condition or state of an extern...
Definition IndexedEvent.hpp:46
Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Definition InvalidArgumentException.hpp:23
A wrapper over the interceptable Java exceptions thrown by the dxFeed Native Graal SDK.
Definition JavaException.hpp:25
static void throwIfJavaThreadExceptionExists()
Throws a JavaException if it exists (i.e. intercepted by Graal SDK)
Definition JavaException.cpp:31
static JavaException create(void *exceptionHandle)
Creates an exception using native (GraalVM) Java exception handle.
Definition JavaException.cpp:21
JavaException(const StringLike &message, const StringLike &className, const StringLike &stackTrace)
Creates an exception using Java message, className and stack trace.
Definition JavaException.cpp:13
Represents up-to-date information about some condition or state of an external entity that updates in...
Definition LastingEvent.hpp:33
Base class for all market events.
Definition MarketEvent.hpp:29
The listener interface for receiving notifications on the changes of observed subscription.
Definition ObservableSubscriptionChangeListener.hpp:29
Observable set of subscription symbols.
Definition ObservableSubscription.hpp:26
Provides on-demand historical tick data replay controls.
Definition OnDemandService.hpp:77
A list of event receiving results that will be completed normally or exceptionally in the future.
Definition Promise.hpp:441
Result of a computation that will be completed normally or exceptionally in the future.
Definition Promise.hpp:357
A class that represents a promise-based implementation often used for handling asynchronous operation...
Definition Promises.hpp:46
A helper class needed to construct smart pointers to objects and does not allow explicit construction...
Definition SharedEntity.hpp:89
static auto createShared(Args &&...args)
Creates a smart pointer to an object.
Definition SharedEntity.hpp:104
A runtime axception with stacktrace.
Definition RuntimeException.hpp:25
const std::string & getStackTrace() const &
Definition RuntimeException.cpp:83
RuntimeException(const StringLike &message, const StringLike &additionalStackTrace="")
Constructs a runtime exception.
Definition RuntimeException.cpp:67
A base abstract "shared entity" class. Has some helpers for dynamic polymorphism.
Definition SharedEntity.hpp:25
virtual std::string toString() const
Returns a string representation of the current object.
Definition SharedEntity.hpp:78
std::shared_ptr< T > sharedAs() const noexcept
Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nu...
Definition SharedEntity.hpp:69
std::shared_ptr< T > sharedAs() noexcept
Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nu...
Definition SharedEntity.hpp:58
bool is() const noexcept
Checks that the pointer to the current type could be converted to type T* In other words: whether typ...
Definition SharedEntity.hpp:39
std::size_t operator+=(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:379
void remove(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:399
void handle(ArgTypes... args)
Calls the listeners and pass the args to them.
Definition Handler.hpp:317
void operator()(ArgTypes... args)
Calls the listeners and pass the ars to them.
Definition Handler.hpp:328
std::size_t addLowPriority(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group) It will be called after the "main" liste...
Definition Handler.hpp:359
void operator-=(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:418
std::size_t operator%=(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group).
Definition Handler.hpp:390
SimpleHandler() noexcept
Creates the new handler.
Definition Handler.hpp:289
std::size_t add(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:338
Universal functional object that allows searching std::unordered_map for string-like keys.
Definition StringUtils.hpp:111
A simple wrapper around strings or something similar to strings to reduce the amount of code for meth...
Definition Common.hpp:842
A lightweight wrapper around strings or string-like inputs.
Definition StringUtils.hpp:27
Common string constants used across the library.
Definition StringUtils.hpp:128
static const std::string NUL
Textual representation of a null / missing string: "<null>".
Definition StringUtils.hpp:133
static const std::string EMPTY
Empty string constant: "".
Definition StringUtils.hpp:130
std::optional< CandleSymbol > asCandleSymbol() const noexcept
Definition SymbolWrapper.cpp:239
SymbolWrapper(Symbol &&symbol) noexcept
Constructor for any wrapped symbol.
Definition SymbolWrapper.hpp:160
bool isIndexedEventSubscriptionSymbol() const noexcept
Definition SymbolWrapper.cpp:215
std::string toString() const
Returns a string representation of the current object.
Definition SymbolWrapper.cpp:181
static SymbolWrapper fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the dxFeed Graal SDK structure.
Definition SymbolWrapper.cpp:133
std::string toStringUnderlying() const
Returns a string representation of the underlying object.
Definition SymbolWrapper.cpp:191
std::unique_ptr< void, decltype(&SymbolWrapper::freeGraal)> toGraalUnique() const noexcept
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition SymbolWrapper.cpp:177
bool isStringSymbol() const noexcept
Definition SymbolWrapper.cpp:199
std::optional< IndexedEventSubscriptionSymbol > asIndexedEventSubscriptionSymbol() const noexcept
Definition SymbolWrapper.cpp:219
bool isWildcardSymbol() const noexcept
Definition SymbolWrapper.cpp:207
void * toGraal() const noexcept
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition SymbolWrapper.cpp:165
SymbolWrapper(const IndexedEventSubscriptionSymbol &indexedEventSubscriptionSymbol) noexcept
Constructor for IndexedEventSubscriptionSymbol.
Definition SymbolWrapper.cpp:66
std::string asStringSymbol() const noexcept
Definition SymbolWrapper.cpp:203
SymbolWrapper(const StringSymbol &stringSymbol) noexcept
Constructor for any wrapped string symbol.
Definition SymbolWrapper.cpp:50
std::optional< WildcardSymbol > asWildcardSymbol() const noexcept
Definition SymbolWrapper.cpp:211
SymbolWrapper(const CandleSymbol &candleSymbol) noexcept
Constructor for CandleSymbol.
Definition SymbolWrapper.cpp:84
SymbolWrapper(const WildcardSymbol &wildcardSymbol) noexcept
Constructor for any wrapped wildcard (*) symbol.
Definition SymbolWrapper.cpp:58
bool isTimeSeriesSubscriptionSymbol() const noexcept
Definition SymbolWrapper.cpp:225
SymbolWrapper(const TimeSeriesSubscriptionSymbol &timeSeriesSubscriptionSymbol) noexcept
Constructor for TimeSeriesSubscriptionSymbol.
Definition SymbolWrapper.cpp:75
bool isCandleSymbol() const noexcept
Definition SymbolWrapper.cpp:235
std::optional< TimeSeriesSubscriptionSymbol > asTimeSeriesSubscriptionSymbol() const noexcept
Definition SymbolWrapper.cpp:229
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition SymbolWrapper.cpp:95
const DataType & getData() const noexcept
Definition SymbolWrapper.cpp:243
Value class for a period of time with support for ISO8601 duration format.
Definition TimePeriod.hpp:27
Represents time-series snapshots of some process that is evolving in time or actual events in some ex...
Definition TimeSeriesEvent.hpp:84
Mixin for wrapping Promise method calls for a void.
Definition Promise.hpp:184
void await(std::int32_t timeoutInMilliseconds) const &
Wait for the computation to complete or timeout and return its result or throw an exception in case o...
Definition Promise.hpp:216
void await(const std::chrono::milliseconds &timeoutInMilliseconds) const &
Wait for the computation to complete or timeout and return its result or throw an exception in case o...
Definition Promise.hpp:231
void await() const
Wait for the computation to complete and return its result or throw an exception in case of exception...
Definition Promise.hpp:201
void getResult() const
Returns result of computation.
Definition Promise.hpp:191
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition WildcardSymbol.cpp:43
static const WildcardSymbol & fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the dxFeed Graal SDK structure.
Definition WildcardSymbol.cpp:49
void * toGraal() const noexcept
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition WildcardSymbol.cpp:33
static const WildcardSymbol ALL
Represents [wildcard] subscription to all events of the specific event type.
Definition WildcardSymbol.hpp:12
std::string toString() const
Returns string representation of this wildcard subscription symbol.
Definition WildcardSymbol.cpp:57
static const std::string RESERVED_PREFIX
Symbol prefix that is reserved for wildcard subscriptions.
Definition WildcardSymbol.hpp:32
The simple key-value structure that represents an endpoint's property.
Definition api.h:184
const char * key
The property's key.
Definition api.h:186
const char * value
The property's value.
Definition api.h:188