dxFeed Graal CXX API v4.2.0
Loading...
Searching...
No Matches
DXFeed.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 "../internal/CEntryPointErrors.hpp"
11#include "../internal/Common.hpp"
12#include "../internal/Isolate.hpp"
13#include "../internal/JavaObjectHandle.hpp"
14#include "../internal/managers/EntityManager.hpp"
15#include "../promise/Promise.hpp"
16
18
19#include <memory>
20#include <unordered_set>
21
23
24struct DXEndpoint;
25class EventTypeEnum;
26struct IndexedTxModelImpl;
27struct TimeSeriesTxModelImpl;
28
29/**
30 * Main entry class for dxFeed API (<b>read it first</b>).
31 *
32 * <h3>Sample usage</h3>
33 *
34 * This section gives sample usage scenarios.
35 *
36 * <h4>Default singleton instance</h4>
37 *
38 * There is a singleton instance of the feed that is returned by DXFeed::getInstance() method.
39 * It is created on the first use with default configuration properties that are explained in detail in
40 * documentation for DXEndpoint class in the "Default properties" section.
41 *
42 * <p>In particular,
43 * you can provide a default address to connect and credentials using
44 * "@ref DXEndpoint::DXFEED_ADDRESS_PROPERTY "dxfeed.address"",
45 * "@ref DXEndpoint::DXFEED_USER_PROPERTY "dxfeed.user"", and
46 * "@ref DXEndpoint::DXFEED_PASSWORD_PROPERTY "dxfeed.password""
47 * system properties or by putting them into
48 * "@ref DXEndpoint::DXFEED_PROPERTIES_PROPERTY "dxfeed.properties""
49 * file in the same directory. dxFeed API samples come with a ready-to-use "<b>dxfeed.properties</b>"
50 * file that contains an address of dxFeed demo feed at "<b>demo.dxfeed.com:7300</b>" and
51 * demo access credentials.
52 *
53 * <h4>Subscribe for single event type</h4>
54 *
55 * The following code creates listener that prints mid price for each quote
56 * and subscribes for quotes on SPDR S&P 500 ETF symbol:
57 * <pre><tt>
58 * auto sub = @ref DXFeed "DXFeed"::@ref DXFeed::getInstance() "getInstance"()->@ref DXFeed::createSubscription()
59 * "createSubscription"(Quote::TYPE);
60 *
61 * sub->@ref DXFeedSubscription::addEventListener() "addEventListener"<Quote>([](const auto& quotes) {
62 * for (const auto& quote : quotes) {
63 * std::cout << "Mid = " + (quote->@ref Quote::getBidPrice() "getBidPrice"() + quote->@ref Quote::getAskPrice()
64 * "getAskPrice"()) / 2) << std::endl;
65 * }
66 * });
67 *
68 * sub->@ref DXFeedSubscription::addSymbols() "addSymbols"("SPY");</tt></pre>
69 *
70 * Note, that order of calls is important here. By attaching listeners first and then setting
71 * subscription we ensure that the current quote gets received by the listener. See DXFeedSubscription::addSymbols() for
72 * details. If a set of symbols is changed first, then @ref DXFeedSubscription::addEventListener()
73 * "sub->addEventListener" raises an IllegalStateException in JVM to protected from hard-to-catch bugs with potentially
74 * missed events.
75 *
76 * <h4>Subscribe for multiple event types</h4>
77 *
78 * The following code creates listener that prints each received event and
79 * subscribes for quotes and trades on SPDR S&P 500 ETF symbol:
80 * <pre><tt>
81 * auto sub = @ref DXFeed "DXFeed"::@ref DXFeed::getInstance() "getInstance"()->@ref DXFeed::createSubscription()
82 * "createSubscription"({Quote::TYPE, Trade::TYPE});
83 *
84 * sub->@ref DXFeedSubscription::addEventListener() "addEventListener"([](auto&& events) {
85 * for (const auto& event : events) {
86 * std::cout << event << std::endl;
87 * }
88 * });
89 *
90 * sub->@ref DXFeedSubscription::addSymbols() "addSymbols"("SPY");</tt></pre>
91 *
92 * <h4>Subscribe for event and query periodically its last value</h4>
93 *
94 * The following code subscribes for trades on SPDR S&P 500 ETF symbol and
95 * prints last trade every second.
96 *
97 * <pre><tt>
98 * using namespace std::chrono_literals;
99 *
100 * auto sub = @ref DXFeed "DXFeed"::@ref DXFeed::getInstance() "getInstance"()->@ref DXFeed::createSubscription()
101 * "createSubscription"({Trade::TYPE});
102 *
103 * sub->@ref DXFeedSubscription::addSymbols() "addSymbols"("SPY");
104 *
105 * auto feed = @ref DXFeed "DXFeed"::@ref DXFeed::getInstance() "getInstance"();
106 *
107 * while (true) {
108 * std::cout << System.out.println(feed->@ref DXFeed::getLastEvent() "getLastEvent"(Trade::create("SPY")));
109 * std::this_thread::sleep_for(1000ms);
110 * }</tt></pre>
111 *
112 * <h3>Threads and locks</h3>
113 *
114 * This class is thread-safe and can be used concurrently from multiple threads without external synchronization.
115 */
117 /// The alias to a type of shared pointer to the DXFeed object
118 using Ptr = std::shared_ptr<DXFeed>;
119
120 /// The alias to a type of unique pointer to the DXFeed object
122
123 friend struct DXEndpoint;
124 friend struct TimeSeriesTxModelImpl;
125 friend struct IndexedTxModelImpl;
126
127 private:
128 JavaObjectHandle<DXFeed> handle_;
129 static std::shared_ptr<DXFeed> create(void *feedHandle);
130
131 void *getLastEventPromiseImpl(const EventTypeEnum &eventType, const SymbolWrapper &symbol) const;
132
133 void *getLastEventsPromisesImpl(const EventTypeEnum &eventType, void *graalSymbolList) const;
134
135 void *getIndexedEventsPromiseImpl(const EventTypeEnum &eventType, const SymbolWrapper &symbol,
136 const IndexedEventSource &source) const;
137
138 void *getTimeSeriesPromiseImpl(const EventTypeEnum &eventType, const SymbolWrapper &symbol, std::int64_t fromTime,
139 std::int64_t toTime) const;
140
141 std::shared_ptr<EventType> getLastEventIfSubscribedImpl(const EventTypeEnum &eventType,
142 const SymbolWrapper &symbol) const;
143
144 std::vector<std::shared_ptr<EventType>> getIndexedEventsIfSubscribedImpl(const EventTypeEnum &eventType,
145 const SymbolWrapper &symbol,
146 const IndexedEventSource &source) const;
147
148 std::vector<std::shared_ptr<EventType>> getTimeSeriesIfSubscribedImpl(const EventTypeEnum &eventType,
149 const SymbolWrapper &symbol,
150 std::int64_t fromTime,
151 std::int64_t toTime) const;
152
153 JavaObjectHandle<DXFeedSubscription>
154 createTimeSeriesSubscriptionHandleFromEventClassList(const std::unique_ptr<EventClassList> &list);
155
156 protected:
157 DXFeed() noexcept;
158
159 public:
160 ~DXFeed() noexcept override;
161
162 /**
163 * Returns a default application-wide singleton instance of feed. Most applications use only a single
164 * data-source and should rely on this method to get one. This is a shortcut to
165 * @ref DXEndpoint "DXEndpoint"::@ref DXEndpoint::getInstance() "getInstance()"->@ref DXEndpoint::getFeed()
166 * "getFeed()".
167 *
168 * @return The DXFeed instance
169 */
170 static std::shared_ptr<DXFeed> getInstance();
171
172 /**
173 * Attaches the given subscription to this feed. This method does nothing if the
174 * corresponding subscription is already attached to this feed.
175 *
176 * <p> This feed publishes data to the attached subscription.
177 * Application can attach event listener via DXFeedSubscription::addEventListener to get notified about data changes
178 * and can change its data subscription via DXFeedSubscription methods.
179 *
180 * <h3>Implementation notes</h3>
181 *
182 * This method adds a non-serializable ObservableSubscriptionChangeListener for the given subscription
183 * via DXFeedSubscription::addChangeListener method.
184 *
185 * @param subscription The subscription.
186 * @see DXFeedSubscription
187 */
188 void attachSubscription(std::shared_ptr<DXFeedSubscription> subscription);
189
190 /**
191 * Detaches the given subscription from this feed. This method does nothing if the
192 * corresponding subscription is not attached to this feed.
193 *
194 * <h3>Implementation notes</h3>
195 *
196 * This method removes ObservableSubscriptionChangeListener from the given subscription
197 * via DXFeedSubscription::removeChangeListener method.
198 *
199 * @param subscription The subscription.
200 * @see DXFeedSubscription
201 */
202 void detachSubscription(std::shared_ptr<DXFeedSubscription> subscription);
203
204 /**
205 * Detaches the given subscription from this feed and clears data delivered to this subscription
206 * by publishing empty events. This method does nothing if the
207 * corresponding subscription is not attached to this feed.
208 *
209 * @param subscription The subscription.
210 * @see DXFeed::detachSubscription()
211 */
212 void detachSubscriptionAndClear(std::shared_ptr<DXFeedSubscription> subscription);
213
214 /**
215 * Returns the last event for the specified event instance.
216 * This method works only for event types that implement LastingEvent marker interface.
217 * This method <b>does not</b> make any remote calls to the uplink data provider.
218 * It just retrieves last received event from the local cache of this feed.
219 * The events are stored in the cache only if there is some attached DXFeedSubscription that is subscribed to the
220 * corresponding symbol and event type.
221 * WildcardSymbol::ALL subscription does not count for that purpose.
222 *
223 * <p>Use @ref ::getLastEventPromise() "getLastEventPromise" method if an event needs to be requested in the absence
224 * of subscription.
225 *
226 * <p> This method fills in the values for the last event into the `event argument.
227 * If the last event is not available for any reason (no subscription, no connection to uplink, etc.)
228 * then the event object is not changed.
229 * This method always returns the same `event` instance that is passed to it as an argument.
230 *
231 * <p>This method provides no way to distinguish a case when there is no subscription from the case when
232 * there is a subscription, but the event data have not arrived yet. It is recommended to use
233 * @ref ::getLastEventIfSubscribed() "getLastEventIfSubscribed" method instead of this `getLastEvent` method to
234 * fail-fast in case when the subscription was supposed to be set by the logic of the code, since
235 * @ref ::getLastEventIfSubscribed() "getLastEventIfSubscribed" method returns `std::shared_ptr<E>(nullptr)` when
236 * there is no subscription.
237 *
238 * <p>Note, that this method does not work when DXEndpoint was created with
239 * @ref DXEndpoint::Role::STREAM_FEED "STREAM_FEED" role (never fills in the event).
240 *
241 * @tparam E The type of event.
242 * @param event The event.
243 * @return The same event.
244 */
245 template <Derived<LastingEvent> E> std::shared_ptr<E> getLastEvent(std::shared_ptr<E> event) {
246 if (auto last = getLastEventIfSubscribed<E>(event->getEventSymbol())) {
247 event->assign(last);
248 }
249
250 return event;
251 }
252
253 /**
254 * Returns the last events for the specified list of event instances.
255 * This is a bulk version of @ref ::getLastEvent() "getLastEvent" method.
256 *
257 * <p>Note, that this method does not work when DXEndpoint was created with
258 * @ref DXEndpoint::Role::STREAM_FEED "STREAM_FEED" role.
259 *
260 * @tparam Collection The collection type.
261 * @param events The collection of shared ptrs of events.
262 * @return The same collection of shared ptrs of events.
263 */
264 template <typename Collection, typename Element = std::decay_t<decltype(std::begin(Collection()))>,
265 typename Event = std::decay_t<decltype(*Element())>>
266 const Collection &getLastEvents(const Collection &events) {
267 static_assert(
268 std::is_same_v<Element, std::shared_ptr<Event>> && std::is_base_of_v<LastingEvent, Event>,
269 "The collection element must be of type `std::shared_ptr<Event>`, where `Event` is a descendant of "
270 "`LastingEvent`");
271
272 for (auto e : events) {
273 getLastEvent(e);
274 }
275
276 return events;
277 }
278
279 /**
280 * Returns the last event for the specified event type and symbol if there is a subscription for it.
281 * This method works only for event types that implement LastingEvent marker interface.
282 * This method <b>does not</b> make any remote calls to the uplink data provider.
283 * It just retrieves last received event from the local cache of this feed.
284 * The events are stored in the cache only if there is some attached DXFeedSubscription that is subscribed to the
285 * corresponding event type and symbol.
286 * The subscription can also be permanently defined using DXEndpoint properties.
287 * WildcardSymbol::ALL subscription does not count for that purpose.
288 * If there is no subscription, then this method returns `std::shared_ptr<E>(nullptr)`.
289 *
290 * <p>If there is a subscription, but the event has not arrived from the uplink data provider,
291 * this method returns an non-initialized event object: its @ref EventType#getEventSymbol() "eventSymbol"
292 * property is set to the requested symbol, but all the other properties have their default values.
293 *
294 * <p>Use @ref ::getLastEventPromise() "getLastEventPromise" method if an event needs to be requested in the
295 * absence of subscription.
296 *
297 * <p>Note, that this method does not work when DXEndpoint} was created with @ref DXEndpoint::Role::STREAM_FEED
298 * "STREAM_FEED" role (always returns `std::shared_ptr<E>(nullptr)`).
299 *
300 * @tparam E The type of event.
301 * @param symbol The symbol.
302 * @return the event or `std::shared_ptr<E>(nullptr)` if there is no subscription for the specified event type and
303 * symbol.
304 */
305 template <Derived<LastingEvent> E> std::shared_ptr<E> getLastEventIfSubscribed(const SymbolWrapper &symbol) {
306 // https://youtrack.jetbrains.com/issue/RSCPP-15139
307 // ReSharper disable once CppRedundantTemplateKeyword
308 return getLastEventIfSubscribedImpl(E::TYPE, symbol)->template sharedAs<E>();
309 }
310
311 /**
312 * Creates new subscription for a single event type that is <i>attached</i> to this feed.
313 * This method creates new DXFeedSubscription and invokes DXFeed::attachSubscription().
314 *
315 * Example:
316 * ```cpp
317 * auto sub = dxfcpp::DXFeed::getInstance()->createSubscription(dxfcpp::Quote::TYPE);
318 * ```
319 *
320 * @param eventType The type of event
321 * @return The new subscription
322 */
323 std::shared_ptr<DXFeedSubscription> createSubscription(const EventTypeEnum &eventType);
324
325 /**
326 * Creates new subscription for multiple event types that is <i>attached</i> to this feed.
327 * This method creates new DXFeedSubscription and invokes DXFeed::attachSubscription().
328 *
329 * Example:
330 * ```cpp
331 * auto eventTypes = {dxfcpp::Quote::TYPE, dxfcpp::TimeAndSale::TYPE};
332 *
333 * auto sub = dxfcpp::DXFeed::getInstance()->createSubscription(eventTypes.begin(), eventTypes.end());
334 * ```
335 *
336 * ```cpp
337 * std::vector types{dxfcpp::Quote::TYPE, dxfcpp::Trade::TYPE, dxfcpp::Summary::TYPE};
338 *
339 * auto sub = dxfcpp::DXFeed::getInstance()->createSubscription(types.begin(), types.end());
340 * ```
341 *
342 * ```cpp
343 * std::set types{dxfcpp::Quote::TYPE, dxfcpp::Trade::TYPE, dxfcpp::Summary::TYPE};
344 * auto endpoint = dxfcpp::DXEndpoint::newBuilder()->withRole(dxfcpp::DXEndpoint::Role::FEED)->build();
345 * auto sub = endpoint->getFeed()->createSubscription(eventTypes.begin(), eventTypes.end());
346 *
347 * endpoint->connect("demo.dxfeed.com:7300");
348 * ```
349 *
350 * @tparam EventTypeIt The iterator type of the collection of event types
351 * @param begin The start iterator
352 * @param end The end iterator
353 * @return The new subscription
354 */
355 template <typename EventTypeIt>
356 std::shared_ptr<DXFeedSubscription> createSubscription(EventTypeIt begin, EventTypeIt end) {
357 if constexpr (Debugger::isDebug) {
358 // ReSharper disable once CppDFAUnreachableCode
359 Debugger::debug("{}::createSubscription(eventTypes = " + namesToString(begin, end) + ")");
360 }
361
362 auto sub = DXFeedSubscription::create(begin, end);
363
365
366 return sub;
367 }
368
369 /**
370 * Creates new subscription for multiple event types that is <i>attached</i> to this feed.
371 * This method creates new DXFeedSubscription and invokes DXFeed::attachSubscription().
372 *
373 * Example:
374 * ```cpp
375 * auto sub = dxfcpp::DXFeed::getInstance()->createSubscription({dxfcpp::Quote::TYPE, dxfcpp::TimeAndSale::TYPE});
376 * ```
377 *
378 * @param eventTypes The initializer list of event types
379 * @return The new subscription
380 */
381 std::shared_ptr<DXFeedSubscription> createSubscription(std::initializer_list<EventTypeEnum> eventTypes);
382
383 /**
384 * Creates new subscription for multiple event types that is <i>attached</i> to this feed.
385 * This method creates new DXFeedSubscription and invokes DXFeed::attachSubscription().
386 *
387 * Example:
388 * ```cpp
389 * auto sub = dxfcpp::DXFeed::getInstance()->createSubscription(std::unordered_set{dxfcpp::Quote::TYPE,
390 * dxfcpp::TimeAndSale::TYPE});
391 * ```
392 *
393 * ```cpp
394 * std::vector types = {dxfcpp::Quote::TYPE, dxfcpp::TimeAndSale::TYPE};
395 * auto sub = dxfcpp::DXFeed::getInstance()->createSubscription(types);
396 * ```
397 *
398 * @tparam EventTypesCollection The class of the collection of event types
399 * @param eventTypes The collection of event types
400 * @return The new subscription
401 */
402 template <typename EventTypesCollection>
403 std::shared_ptr<DXFeedSubscription> createSubscription(EventTypesCollection &&eventTypes) {
404 if constexpr (Debugger::isDebug) {
405 // ReSharper disable once CppDFAUnreachableCode
406 Debugger::debug(toString() + "::createSubscription(eventTypes = " +
407 namesToString(std::begin(eventTypes), std::end(eventTypes)) + ")");
408 }
409
410 auto sub = DXFeedSubscription::create(eventTypes);
411
413
414 return sub;
415 }
416
417 /**
418 * Creates new subscription for a single event type that is <i>attached</i> to this feed.
419 * This method creates new DXFeedTimeSeriesSubscription and invokes DXFeed::attachSubscription().
420 *
421 * Example:
422 * ```cpp
423 * auto sub = dxfcpp::DXFeed::getInstance()->createTimeSeriesSubscription(dxfcpp::TimeAndSale::TYPE);
424 * ```
425 *
426 * @param eventType The type of event
427 * @return The new subscription
428 */
430
431 /**
432 * Creates new subscription for multiple event types that is <i>attached</i> to this feed.
433 * This method creates new DXFeedTimeSeriesSubscription and invokes DXFeed::attachSubscription().
434 *
435 * Example:
436 * ```cpp
437 * auto eventTypes = {dxfcpp::Underlying::TYPE, dxfcpp::TimeAndSale::TYPE};
438 *
439 * auto sub = dxfcpp::DXFeed::getInstance()->createTimeSeriesSubscription(eventTypes.begin(), eventTypes.end());
440 * ```
441 *
442 * ```cpp
443 * std::vector types{dxfcpp::Underlying::TYPE, dxfcpp::TimeAndSale::TYPE, dxfcpp::Candle::TYPE};
444 *
445 * auto sub = dxfcpp::DXFeed::getInstance()->createTimeSeriesSubscription(types.begin(), types.end());
446 * ```
447 *
448 * ```cpp
449 * std::set types{dxfcpp::Underlying::TYPE, dxfcpp::TimeAndSale::TYPE, dxfcpp::Candle::TYPE};
450 * auto endpoint = dxfcpp::DXEndpoint::newBuilder()->withRole(dxfcpp::DXEndpoint::Role::FEED)->build();
451 * auto sub = endpoint->getFeed()->createTimeSeriesSubscription(eventTypes.begin(), eventTypes.end());
452 *
453 * endpoint->connect("demo.dxfeed.com:7300");
454 * ```
455 *
456 * @tparam EventTypeIt The iterator type of the collection of event types
457 * @param begin The start iterator
458 * @param end The end iterator
459 * @return The new subscription
460 */
461 template <typename EventTypeIt>
462 std::shared_ptr<DXFeedTimeSeriesSubscription> createTimeSeriesSubscription(EventTypeIt begin, EventTypeIt end) {
463 if constexpr (Debugger::isDebug) {
464 // ReSharper disable once CppDFAUnreachableCode
465 Debugger::debug("{}::createTimeSeriesSubscription(eventTypes = " + namesToString(begin, end) + ")");
466 }
467
468 for (EventTypeIt iter = begin; iter != end; ++iter) {
469 if (!iter->isTimeSeries()) {
470 throw InvalidArgumentException("DXFeed::createTimeSeriesSubscription(): event type " +
471 iter->getClassName() + " is not TimeSeries");
472 }
473 }
474
475 auto list = EventClassList::create(begin, end);
476 auto sub = RequireMakeShared<DXFeedTimeSeriesSubscription>::createShared(
477 begin, end, std::move(createTimeSeriesSubscriptionHandleFromEventClassList(list)));
478 auto id = ApiContext::getInstance()->getManager<EntityManager<DXFeedSubscription>>()->registerEntity(sub);
479
480 dxfcpp::ignoreUnused(id);
481
483
484 return sub;
485 }
486
487 /**
488 * Creates new subscription for multiple event types that is <i>attached</i> to this feed.
489 * This method creates new DXFeedTimeSeriesSubscription and invokes DXFeed::attachSubscription().
490 *
491 * Example:
492 * ```cpp
493 * auto sub = dxfcpp::DXFeed::getInstance()->createTimeSeriesSubscription({dxfcpp::Underlying::TYPE,
494 * dxfcpp::TimeAndSale::TYPE});
495 * ```
496 *
497 * @param eventTypes The initializer list of event types
498 * @return The new subscription
499 */
500 std::shared_ptr<DXFeedTimeSeriesSubscription>
501 createTimeSeriesSubscription(std::initializer_list<EventTypeEnum> eventTypes);
502
503 /**
504 * Creates new subscription for multiple event types that is <i>attached</i> to this feed.
505 * This method creates new DXFeedTimeSeriesSubscription and invokes DXFeed::attachSubscription().
506 *
507 * Example:
508 * ```cpp
509 * auto sub =
510 * dxfcpp::DXFeed::getInstance()->createTimeSeriesSubscription(std::unordered_set{dxfcpp::Underlying::TYPE,
511 * dxfcpp::TimeAndSale::TYPE});
512 * ```
513 *
514 * ```cpp
515 * std::vector types = {dxfcpp::Underlying::TYPE, dxfcpp::TimeAndSale::TYPE};
516 * auto sub = dxfcpp::DXFeed::getInstance()->createTimeSeriesSubscription(types);
517 * ```
518 *
519 * @tparam EventTypesCollection The class of the collection of event types
520 * @param eventTypes The collection of event types
521 * @return The new subscription
522 */
523 template <typename EventTypesCollection>
524 std::shared_ptr<DXFeedTimeSeriesSubscription> createTimeSeriesSubscription(EventTypesCollection &&eventTypes) {
525 if constexpr (Debugger::isDebug) {
526 // ReSharper disable once CppDFAUnreachableCode
527 Debugger::debug(toString() + "::createTimeSeriesSubscription(eventTypes = " +
528 namesToString(std::begin(eventTypes), std::end(eventTypes)) + ")");
529 }
530
531 return createTimeSeriesSubscription(std::begin(eventTypes), std::end(eventTypes));
532 }
533
534 /**
535 * Requests the last event for the specified event type and symbol.
536 * This method works only for event types that implement LastingEvent marker "interface".
537 * This method requests the data from the uplink data provider, creates new event of the specified event type,
538 * and completes the resulting promise with this event.
539 *
540 * <p>The promise is cancelled when the underlying DXEndpoint is @ref DXEndpoint::close() "closed".
541 * If the event is not available for any transient reason (no subscription, no connection to uplink, etc),
542 * then the resulting promise completes when the issue is resolved, which may involve an arbitrarily long wait.
543 * Use Promise::await() method to specify timeout while waiting for promise to complete.
544 * If the event is permanently not available (not supported), then the promise completes exceptionally with
545 * JavaException "IllegalArgumentException".
546 *
547 * <p>There is a bulk version of this method that works much faster for a single event type and multiple symbols.
548 * See getLastEventsPromises() .
549 *
550 * <p>Note, that this method does not work when DXEndpoint was created with @ref DXEndpoint::Role::STREAM_FEED
551 * "STREAM_FEED" role (promise completes exceptionally).
552 *
553 * @tparam E The type of event.
554 * @param symbol The symbol.
555 * @return The promise for the result of the request.
556 */
557 template <Derived<LastingEvent> E>
558 std::shared_ptr<Promise<std::shared_ptr<E>>> getLastEventPromise(const SymbolWrapper &symbol) const {
559 return std::make_shared<Promise<std::shared_ptr<E>>>(getLastEventPromiseImpl(E::TYPE, symbol));
560 }
561
562 /**
563 * Requests the last events for the specified event type and a collection of symbols.
564 * This method works only for event types that implement LastingEvent marker "interface".
565 * This method requests the data from the the uplink data provider,
566 * creates new events of the specified evet type, and completes the resulting promises with these events.
567 *
568 * <p>This is a bulk version of DXFeed::getLastEventPromise() method.
569 *
570 * <p>The promise is cancelled when the the underlying DXEndpoint is @ref DXEndpoint::close() "closed".
571 * If the event is not available for any transient reason (no subscription, no connection to uplink, etc),
572 * then the resulting promise completes when the issue is resolved, which may involve an arbitrarily long wait.
573 * Use Promise::await() method to specify timeout while waiting for promise to complete.
574 * If the event is permanently not available (not supported), then the promise
575 * completes exceptionally with JavaException "IllegalArgumentException".
576 *
577 * <p>Use the following pattern of code to acquire multiple events (either for multiple symbols and/or multiple
578 * events) and wait with a single timeout for all of them:
579 *
580 * ```cpp
581 * std::vector<dxfcpp::SymbolWrapper> symbols{"AAPL&Q", "IBM&Q"};
582 * auto promises = DXFeed::getInstance()->getLastEventsPromises<Quote>(symbols.begin(), symbols.end());
583 *
584 * // combine the list of promises into one with Promises utility method and wait
585 * Promises::allOf(*promises)->awaitWithoutException(std::chrono::seconds(timeout));
586 *
587 * // now iterate the promises to retrieve results
588 * for (const auto& promise : *promises) {
589 * doSomethingWith(promise->getResult()); // InvalidArgumentException if result is nullptr
590 * }
591 * ```
592 *
593 * <p>Note, that this method does not work when DXEndpoint was created with @ref DXEndpoint::Role::STREAM_FEED
594 * "STREAM_FEED" role (promise completes exceptionally).
595 *
596 * @tparam E The event type.
597 * @tparam SymbolIt The symbols collection's iterator type.
598 * @param begin The beginning of the collection of symbols (SymbolWrapper).
599 * @param end The end of the collection of symbols (SymbolWrapper).
600 * @return The list of promises for the result of the requests, one item in list per symbol.
601 */
602 template <Derived<LastingEvent> E, typename SymbolIt>
603 std::shared_ptr<PromiseList<E>> getLastEventsPromises(SymbolIt begin, SymbolIt end) const {
604 auto list = SymbolWrapper::SymbolListUtils::toGraalListUnique(begin, end);
605
606 return PromiseList<E>::create(getLastEventsPromisesImpl(E::TYPE, list.get()));
607 }
608
609 /**
610 * Requests the last events for the specified event type and a collection of symbols.
611 * This method works only for event types that implement LastingEvent marker "interface".
612 * This method requests the data from the the uplink data provider,
613 * creates new events of the specified evet type, and completes the resulting promises with these events.
614 *
615 * <p>This is a bulk version of DXFeed::getLastEventPromise() method.
616 *
617 * <p>The promise is cancelled when the the underlying DXEndpoint is @ref DXEndpoint::close() "closed".
618 * If the event is not available for any transient reason (no subscription, no connection to uplink, etc),
619 * then the resulting promise completes when the issue is resolved, which may involve an arbitrarily long wait.
620 * Use Promise::await() method to specify timeout while waiting for promise to complete.
621 * If the event is permanently not available (not supported), then the promise
622 * completes exceptionally with JavaException "IllegalArgumentException".
623 *
624 * <p>Use the following pattern of code to acquire multiple events (either for multiple symbols and/or multiple
625 * events) and wait with a single timeout for all of them:
626 *
627 * ```cpp
628 * std::vector<dxfcpp::SymbolWrapper> symbols{"AAPL&Q", "IBM&Q"};
629 * auto promises = DXFeed::getInstance()->getLastEventsPromises<Quote>(symbols);
630 *
631 * // combine the list of promises into one with Promises utility method and wait
632 * Promises::allOf(*promises)->awaitWithoutException(std::chrono::seconds(timeout));
633 *
634 * // now iterate the promises to retrieve results
635 * for (const auto& promise : *promises) {
636 * doSomethingWith(promise->getResult()); // InvalidArgumentException if result is nullptr
637 * }
638 * ```
639 *
640 * <p>Note, that this method does not work when DXEndpoint was created with @ref DXEndpoint::Role::STREAM_FEED
641 * "STREAM_FEED" role (promise completes exceptionally).
642 *
643 * @tparam E The event type.
644 * @tparam SymbolsCollection The symbols collection's type.
645 * @param collection The symbols collection.
646 * @return The list of promises for the result of the requests, one item in list per symbol.
647 */
648 template <Derived<LastingEvent> E, ConvertibleToSymbolWrapperCollection SymbolsCollection>
649 std::shared_ptr<PromiseList<E>> getLastEventsPromises(SymbolsCollection &&collection) const {
650 return getLastEventsPromises<E>(std::begin(collection), std::end(collection));
651 }
652
653 /**
654 * Requests the last events for the specified event type and a collection of symbols.
655 * This method works only for event types that implement LastingEvent marker "interface".
656 * This method requests the data from the the uplink data provider,
657 * creates new events of the specified evet type, and completes the resulting promises with these events.
658 *
659 * <p>This is a bulk version of DXFeed::getLastEventPromise() method.
660 *
661 * <p>The promise is cancelled when the the underlying DXEndpoint is @ref DXEndpoint::close() "closed".
662 * If the event is not available for any transient reason (no subscription, no connection to uplink, etc),
663 * then the resulting promise completes when the issue is resolved, which may involve an arbitrarily long wait.
664 * Use Promise::await() method to specify timeout while waiting for promise to complete.
665 * If the event is permanently not available (not supported), then the promise
666 * completes exceptionally with JavaException "IllegalArgumentException".
667 *
668 * <p>Use the following pattern of code to acquire multiple events (either for multiple symbols and/or multiple
669 * events) and wait with a single timeout for all of them:
670 *
671 * ```cpp
672 * auto promises = DXFeed::getInstance()->getLastEventsPromises<Quote>({"AAPL&Q", "IBM&Q"});
673 *
674 * // combine the list of promises into one with Promises utility method and wait
675 * Promises::allOf(*promises)->awaitWithoutException(std::chrono::seconds(timeout));
676 *
677 * // now iterate the promises to retrieve results
678 * for (const auto& promise : *promises) {
679 * doSomethingWith(promise->getResult()); // InvalidArgumentException if result is nullptr
680 * }
681 * ```
682 *
683 * <p>Note, that this method does not work when DXEndpoint was created with @ref DXEndpoint::Role::STREAM_FEED
684 * "STREAM_FEED" role (promise completes exceptionally).
685 *
686 * @tparam E The event type.
687 * @param collection The symbols collection.
688 * @return The list of promises for the result of the requests, one item in list per symbol.
689 */
690 template <Derived<LastingEvent> E>
691 std::shared_ptr<PromiseList<E>> getLastEventsPromises(std::initializer_list<SymbolWrapper> collection) const {
692 return getLastEventsPromises<E>(collection.begin(), collection.end());
693 }
694
695 /**
696 * Requests a container of indexed events for the specified event type, symbol, and source.
697 * This method works only for event types that implement IndexedEvent "interface".
698 * This method requests the data from the uplink data provider, creates a container of events of the specified
699 * event type `E`, and completes the resulting promise with this container. The events are ordered by @ref
700 * IndexedEvent::getIndex() "index" in the container.
701 *
702 * <p> This method is designed for retrieval of a snapshot only.
703 * Use IndexedEventModel if you need a container of indexed events that updates in real time.
704 *
705 * <p>The promise is cancelled when the underlying DXEndpoint is @ref DXEndpoint::close() "closed".
706 * If the events are not available for any transient reason (no subscription, no connection to uplink, etc.),
707 * then the resulting promise completes when the issue is resolved, which may involve an arbitrarily long wait.
708 * Use Promise::await() method to specify timeout while waiting for promise to complete.
709 * If the events are permanently not available (not supported), then the promise
710 * completes exceptionally with JavaException "IllegalArgumentException".
711 *
712 * <p>Note, that this method does not work when DXEndpoint was created with
713 * @ref DXEndpoint::Role::STREAM_FEED "STREAM_FEED" role (promise completes exceptionally).
714 *
715 * <h3>Event source</h3>
716 *
717 * Use the @ref IndexedEventSource::DEFAULT "DEFAULT" value for `source` with events that do not
718 * have multiple sources (like Series). For events with multiple sources (like Order,
719 * AnalyticOrder, OtcMarketsOrder and SpreadOrder), use an event-specific source class (for example, OrderSource).
720 * This method does not support <em>synthetic</em> sources of orders (orders that are automatically
721 * generated from Quote events).
722 *
723 * <p>This method does not accept an instance of IndexedEventSubscriptionSymbol as a `symbol`.
724 * The later class is designed for use with DXFeedSubscription and to observe source-specific subscription
725 * in DXPublisher.
726 *
727 * <h3>Event flags and consistent snapshot</h3>
728 *
729 * This method completes promise only when a consistent snapshot of indexed events has been received from
730 * the data feed. The @ref IndexedEvent::getEventFlags() "eventFlags" property of the events in the resulting vector
731 * is always zero.
732 *
733 * <p>Note, that the resulting vector <em>should not</em> be used with DXPublisher::publishEvents() method, because
734 * the latter expects events in a different order and with an appropriate flags set. See documentation on a specific
735 * event class for details on how they should be published.
736 *
737 * @tparam E The type of event.
738 * @param symbol The symbol.
739 * @param source The source.
740 * @return The promise for the result of the request.
741 */
742 template <Derived<IndexedEvent> E>
744 getIndexedEventsPromise(const SymbolWrapper &symbol, const IndexedEventSource &source) const {
745 return std::make_shared<Promise<std::vector<std::shared_ptr<E>>>>(
746 getIndexedEventsPromiseImpl(E::TYPE, symbol, source));
747 }
748
749 /**
750 * Returns a vector of indexed events for the specified event type, symbol, and source if there is a subscription
751 * for it. This method works only for event types that implement IndexedEvent interface. This method <b>does not</b>
752 * make any remote calls to the uplink data provider. It just retrieves last received events from the local cache of
753 * this feed. The events are stored in the cache only if there is some attached DXFeedSubscription that is
754 * subscribed to the corresponding event type, symbol, and source. The subscription can also be permanently defined
755 * using DXEndpoint properties. If there is no subscription, then this method returns an empty vector.
756 * Otherwise, it creates a vector of events of the specified event type `E` and returns it.
757 *
758 * The events are ordered by @ref IndexedEvent::getIndex() "index" in the vector.
759 *
760 * <p>If there is a subscription, but the events have not arrived from the uplink data provider,
761 * this method returns an empty vector.
762 *
763 * <p>Use @ref DXFeed::getIndexedEventsPromise() "getIndexedEventsPromise" method
764 * if events need to be requested in the absence of subscription.
765 *
766 * <p>Note, that this method does not work when DXEndpoint was created with @ref DXEndpoint::Role::STREAM_FEED
767 * "STREAM_FEED" role (always returns an empty vector).
768 *
769 * <h3>Event source</h3>
770 *
771 * Use the @ref IndexedEventSource::DEFAULT "DEFAULT" value for `source` with events that do not
772 * have multiple sources (like Series). For events with multiple sources (like Order, AnalyticOrder,
773 * OtcMarketsOrder and SpreadOrder), use an event-specific source class (for example, OrderSource).
774 * This method does not support <em>synthetic</em> sources of orders (orders that are automatically generated from
775 * Quote events).
776 *
777 * <p>This method does not accept an instance of IndexedEventSubscriptionSymbol as a `symbol`.
778 * The later class is designed for use with DXFeedSubscription and to observe source-specific subscription
779 * in @DXPublisher.
780 *
781 * <h3>Event flags and consistent snapshot</h3>
782 *
783 * This method returns a vector of events that are currently in the cache without any wait or delay, and it <b>does
784 * not</b> guarantee that a consistent snapshot of events is returned. See IndexedEvent documentation for details.
785 * The @ref IndexedEvent::getEventFlags() "eventFlags" property of the events in the resulting vector
786 * is always zero regardless. Use @ref DXFeed::getIndexedEventsPromise() "getIndexedEventsPromise" method
787 * if a consistent snapshot of events needs to be requested.
788 *
789 * <p>Note, that the resulting vector <em>should not</em> be used with DXPublisher::publishEvents() method, because
790 * the latter expects events in a different order and with an appropriate flags set. See documentation on a specific
791 * event class for details on how they should be published.
792 *
793 * @tparam E The type of event.
794 * @param symbol The symbol.
795 * @param source The source.
796 * @return The vector of events or an empty vector if there is no subscription for the specified event
797 * type, symbol, and source.
798 */
799 template <Derived<IndexedEvent> E>
800 std::vector<std::shared_ptr<E>> getIndexedEventsIfSubscribed(const SymbolWrapper &symbol,
801 const IndexedEventSource &source) const {
802 return convertEvents<EventType, E>(getIndexedEventsIfSubscribedImpl(E::TYPE, symbol, source));
803 }
804
805 /**
806 * Requests time series of events for the specified event type, symbol, and a range of time.
807 *
808 * This method works only for event types that implement TimeSeriesEvent "interface".
809 * This method requests the data from the uplink data provider, creates a vector of events of the specified
810 * event type `E`, and completes the resulting promise with this container.
811 *
812 * The events are ordered by @ref TimeSeriesEvent::getTime() "time" in the container.
813 *
814 * <p> This method is designed for retrieval of a snapshot only.
815 * Use TimeSeriesEventModel if you need a vector of time-series events that updates in real time.
816 *
817 * <p>The range and depth of events that are available with this service is typically constrained by
818 * upstream data provider.
819 *
820 * <p>The promise is cancelled when the underlying DXEndpoint is @ref DXEndpoint::close() "closed".
821 *
822 * If events are not available for any transient reason (no subscription, no connection to uplink, etc.),
823 * then the resulting promise completes when the issue is resolved, which may involve an arbitrarily long wait.
824 * Use EventsPromiseMixin::await() method to specify timeout while waiting for promise to complete.
825 * If events are permanently not available (not supported), then the promise
826 * completes exceptionally with JavaException "IllegalArgumentException".
827 *
828 * <p>Note, that this method does not work when DXEndpoint was created with
829 * @ref DXEndpoint::Role::STREAM_FEED "STREAM_FEED" role (promise completes exceptionally).
830 *
831 * <p>This method does not accept an instance of TimeSeriesSubscriptionSymbol as a `symbol`.
832 * The later class is designed for use with DXFeedSubscription and to observe time-series subscription
833 * in DXPublisher.
834 *
835 * <h3>Event flags</h3>
836 *
837 * This method completes promise only when a consistent snapshot of time series has been received from
838 * the data feed. The @ref IndexedEvent::getEventFlags() "eventFlags" property of the events in the resulting
839 * container is always zero.
840 *
841 * <p>Note, that the resulting container <em>should not</em> be used with DXPublisher::publishEvents() method,
842 * because the latter expects events in a different order and with an appropriate flags set. See documentation on a
843 * specific event class for details on how they should be published.
844 *
845 * @tparam E The type of event.
846 * @param symbol The symbol.
847 * @param fromTime The time, inclusive, to request events from (see TimeSeriesEvent::getTime()).
848 * @param toTime The time, inclusive, to request events to (see TimeSeriesEvent::getTime()).
849 * Use `std::numeric_limits<std::int64_t>::max()` or `LLONG_MAX` macro to retrieve events without an
850 * upper limit on time.
851 * @return The promise for the result of the request.
852 */
853 template <Derived<TimeSeriesEvent> E>
855 getTimeSeriesPromise(const SymbolWrapper &symbol, std::int64_t fromTime, std::int64_t toTime) const {
856 return std::make_shared<Promise<std::vector<std::shared_ptr<E>>>>(
857 getTimeSeriesPromiseImpl(E::TYPE, symbol, fromTime, toTime));
858 }
859
860 /**
861 * Returns time series of events for the specified event type, symbol, and a range of time if there is a
862 * subscription for it. This method <b>does not</b> make any remote calls to the uplink data provider. It just
863 * retrieves last received events from the local cache of this feed. The events are stored in the cache only if
864 * there is some attached DXFeedSubscription that is subscribed to the corresponding event type, symbol, and time.
865 * The subscription can also be permanently defined using DXEndpoint properties.
866 * If there is no subscription, then this method returns an empty vector.
867 * Otherwise, it creates a vector of events of the specified event type `E` and returns it.
868 *
869 * The events are ordered by @ref TimeSeriesEvent::getTime() "time" in the vector.
870 *
871 * <p>If there is a subscription, but the events have not arrived from the uplink data provider,
872 * this method returns an empty vector.
873 *
874 * <p>Use @ref DXFeed::getTimeSeriesPromise() "getTimeSeriesPromise" method
875 * if events need to be requested in the absence of subscription.
876 *
877 * <p>Note, that this method does not work when DXEndpoint was created with
878 * @ref DXEndpoint::Role::STREAM_FEED "STREAM_FEED" role (always returns an empty vector).
879 *
880 * <p>This method does not accept an instance of TimeSeriesSubscriptionSymbol as a `symbol`.
881 * The later class is designed for use with DXFeedSubscription and to observe time-series subscription in
882 * DXPublisher.
883 *
884 * <h3>Event flags and consistent snapshot</h3>
885 *
886 * This method returns a vector of events that are currently in the cache without any wait or delay
887 * and it <b>does not</b> guarantee that a consistent snapshot of events is returned.
888 * See IndexedEvent documentation for details.
889 * The @ref IndexedEvent::getEventFlags() "eventFlags" property of the events in the resulting vector
890 * is always zero regardless. Use @ref DXFeed::getTimeSeriesPromise() "getTimeSeriesPromise" method
891 * if a consistent snapshot of events needs to be requested.
892 *
893 * <p>Note, that the resulting vector <em>should not</em> be used with DXPublisher::publishEvents() method, because
894 * the later expects events in a different order and with an appropriate flags set. See documentation on a specific
895 * event class for details on how they should be published.
896 *
897 * @tparam E The type of event.
898 * @param symbol The symbol.
899 * @param fromTime The time, inclusive, to request events from (see TimeSeriesEvent::getTime()).
900 * @param toTime The time, inclusive, to request events to (see TimeSeriesEvent::getTime()).
901 * Use `std::numeric_limits<std::int64_t>::max()` or `LLONG_MAX` macro to retrieve events without an
902 * upper limit on time.
903 * @return the vector of events or an empty vector if there is no subscription for the specified event type, symbol,
904 * and time range.
905 */
906 template <Derived<TimeSeriesEvent> E>
907 std::vector<std::shared_ptr<E>> getTimeSeriesIfSubscribed(const SymbolWrapper &symbol, std::int64_t fromTime,
908 std::int64_t toTime) const {
909 return convertEvents<EventType, E>(getTimeSeriesIfSubscribedImpl(E::TYPE, symbol, fromTime, toTime));
910 }
911
912 /**
913 * Returns time series of events for the specified event type, symbol, and a range of time if there is a
914 * subscription for it. This method <b>does not</b> make any remote calls to the uplink data provider. It just
915 * retrieves last received events from the local cache of this feed. The events are stored in the cache only if
916 * there is some attached DXFeedSubscription that is subscribed to the corresponding event type, symbol, and time.
917 * The subscription can also be permanently defined using DXEndpoint properties.
918 * If there is no subscription, then this method returns an empty vector.
919 * Otherwise, it creates a vector of events of the specified event type `E` and returns it.
920 *
921 * The events are ordered by @ref TimeSeriesEvent::getTime() "time" in the vector.
922 *
923 * <p>If there is a subscription, but the events have not arrived from the uplink data provider,
924 * this method returns an empty vector.
925 *
926 * <p>Use @ref DXFeed::getTimeSeriesPromise() "getTimeSeriesPromise" method
927 * if events need to be requested in the absence of subscription.
928 *
929 * <p>Note, that this method does not work when DXEndpoint was created with
930 * @ref DXEndpoint::Role::STREAM_FEED "STREAM_FEED" role (always returns an empty vector).
931 *
932 * <p>This method does not accept an instance of TimeSeriesSubscriptionSymbol as a `symbol`.
933 * The later class is designed for use with DXFeedSubscription and to observe time-series subscription in
934 * DXPublisher.
935 *
936 * <h3>Event flags and consistent snapshot</h3>
937 *
938 * This method returns a vector of events that are currently in the cache without any wait or delay
939 * and it <b>does not</b> guarantee that a consistent snapshot of events is returned.
940 * See IndexedEvent documentation for details.
941 * The @ref IndexedEvent::getEventFlags() "eventFlags" property of the events in the resulting vector
942 * is always zero regardless. Use @ref DXFeed::getTimeSeriesPromise() "getTimeSeriesPromise" method
943 * if a consistent snapshot of events needs to be requested.
944 *
945 * <p>Note, that the resulting vector <em>should not</em> be used with DXPublisher::publishEvents() method, because
946 * the later expects events in a different order and with an appropriate flags set. See documentation on a specific
947 * event class for details on how they should be published.
948 *
949 * @tparam E The type of event.
950 * @param symbol The symbol.
951 * @param fromTime The time, inclusive, to request events from (see TimeSeriesEvent::getTime()).
952 * @param toTime The time, inclusive, to request events to (see TimeSeriesEvent::getTime()).
953 * Use `std::chrono::milliseconds(std::numeric_limits<std::int64_t>::max())`
954 * or `std::chrono::milliseconds(LLONG_MAX)` to retrieve events without an upper limit on time.
955 * @return the vector of events or an empty vector if there is no subscription for the specified event type, symbol,
956 * and time range.
957 */
958 template <Derived<TimeSeriesEvent> E>
959 std::vector<std::shared_ptr<E>> getTimeSeriesIfSubscribed(const SymbolWrapper &symbol,
960 std::chrono::milliseconds fromTime,
961 std::chrono::milliseconds toTime) const {
962 return getTimeSeriesIfSubscribed<E>(symbol, fromTime.count(), toTime.count());
963 }
964
965 /**
966 * Returns time series of events for the specified event type, symbol, and a range of time (without an upper limit
967 * on time) if there is a subscription for it.
968 * @tparam E The type of event.
969 * @param symbol The symbol.
970 * @param fromTime The time, inclusive, to request events from (see TimeSeriesEvent::getTime()).
971 * @return the vector of events or an empty vector if there is no subscription for the specified event type, symbol,
972 * and time range.
973 */
974 template <Derived<TimeSeriesEvent> E>
975 std::vector<std::shared_ptr<E>> getTimeSeriesIfSubscribed(const SymbolWrapper &symbol,
976 std::int64_t fromTime) const {
977 return getTimeSeriesIfSubscribed<E>(symbol, fromTime, std::numeric_limits<std::int64_t>::max());
978 }
979
980 /**
981 * Returns time series of events for the specified event type, symbol, and a range of time (without an upper limit
982 * on time) if there is a subscription for it.
983 * @tparam E The type of event.
984 * @param symbol The symbol.
985 * @param fromTime The time, inclusive, to request events from (see TimeSeriesEvent::getTime()).
986 * @return the vector of events or an empty vector if there is no subscription for the specified event type, symbol,
987 * and time range.
988 */
989 template <Derived<TimeSeriesEvent> E>
990 std::vector<std::shared_ptr<E>> getTimeSeriesIfSubscribed(const SymbolWrapper &symbol,
991 std::chrono::milliseconds fromTime) const {
992 return getTimeSeriesIfSubscribed<E>(symbol, fromTime.count());
993 }
994
995 std::string toString() const override;
996};
997
999
#define DXFCXX_DISABLE_MSC_WARNINGS_POP()
Definition Conf.hpp:22
#define DXFCPP_CXX20_CONSTEXPR_STRING
Definition Conf.hpp:121
#define DXFCPP_END_NAMESPACE
Definition Conf.hpp:70
#define DXFCPP_BEGIN_NAMESPACE
Definition Conf.hpp:67
#define DXFCXX_DISABLE_GCC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:38
#define DXFCXX_DISABLE_GCC_WARNINGS_POP()
Definition Conf.hpp:40
#define DXFCXX_DISABLE_MSC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:21
#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_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:700
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_password(dxfc_dxendpoint_t endpoint, const char *password)
Changes password for this endpoint.
Definition DXEndpoint.cpp:943
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_publisher(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxpublisher_t *publisher)
Definition DXEndpoint.cpp:1133
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:727
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_add_state_change_listener(dxfc_dxendpoint_t endpoint, dxfc_dxendpoint_state_change_listener listener)
Adds listener that is notified about changes in state property.
Definition DXEndpoint.cpp:1079
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_disconnect(dxfc_dxendpoint_t endpoint)
Terminates all remote network connections.
Definition DXEndpoint.cpp:994
#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:892
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:1045
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 connection is not act...
Definition api.h:159
@ DXFC_DXENDPOINT_STATE_CONNECTED
The connection to 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:785
#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:1062
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:683
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_free(dxfc_dxendpoint_builder_t builder)
Removes a builder from the registry.
Definition DXEndpoint.cpp:773
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:960
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 listener that is notified about changes in state property.
Definition DXEndpoint.cpp:1105
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_builder_with_name(dxfc_dxendpoint_builder_t builder, const char *name)
Changes name that is used to distinguish multiple endpoints in the same process (GraalVM Isolate) in ...
Definition DXEndpoint.cpp:667
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:68
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:744
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_get_feed(dxfc_dxendpoint_t endpoint, DXFC_OUT dxfc_dxfeed_t *feed)
Definition DXEndpoint.cpp:1128
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:1028
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_close(dxfc_dxendpoint_t endpoint)
Closes this endpoint.
Definition DXEndpoint.cpp:875
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_new_builder(DXFC_OUT dxfc_dxendpoint_builder_t *builder)
Creates new dxFeed endpoint's builder instance.
Definition DXEndpoint.cpp:634
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:977
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:909
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_user(dxfc_dxendpoint_t endpoint, const char *user)
Changes username for this endpoint.
Definition DXEndpoint.cpp:926
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 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 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:830
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:807
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:650
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:852
DXFCPP_EXPORT dxfc_error_code_t dxfc_dxendpoint_free(dxfc_dxendpoint_t endpoint)
Removes the dxFeed endpoint from the registry.
Definition DXEndpoint.cpp:1138
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:1011
Builder class for DXEndpoint that supports additional configuration properties.
Definition DXEndpoint.hpp:860
bool supportsProperty(const std::string &key)
Checks if a property is supported.
Definition DXEndpoint.cpp:323
std::shared_ptr< DXEndpoint > build()
Builds DXEndpoint instance.
Definition DXEndpoint.cpp:332
std::shared_ptr< Builder > withProperty(const std::string &key, const std::string &value)
Sets the specified property.
Definition DXEndpoint.cpp:308
std::shared_ptr< Builder > withName(const std::string &name)
Changes name that is used to distinguish multiple endpoints in the same process (GraalVM Isolate) in ...
Definition DXEndpoint.cpp:362
std::shared_ptr< Builder > withProperties(Properties &&properties)
Sets all supported properties from the provided properties object.
Definition DXEndpoint.hpp:949
~Builder() noexcept override
Releases the GraalVM handle.
Definition DXEndpoint.cpp:352
std::shared_ptr< Builder > withRole(Role role)
Sets role for the created DXEndpoint.
Definition DXEndpoint.cpp:296
Subscription for a set of symbols and event types.
Definition DXFeedSubscription.hpp:40
Extends DXFeedSubscription to conveniently subscribe to time-series of events for a set of symbols an...
Definition DXFeedSubscription.hpp:787
The enumeration type that provides additional information about the dxFeed Graal C++-API event type.
Definition EventTypeEnum.hpp:21
bool isTimeSeries() const noexcept
Definition EventTypeEnum.hpp:174
const std::string & getClassName() const &noexcept
Definition EventTypeEnum.hpp:117
bool isLasting() const noexcept
Definition EventTypeEnum.hpp:160
bool isOnlyIndexed() const noexcept
Definition EventTypeEnum.hpp:181
bool isIndexed() const noexcept
Definition EventTypeEnum.hpp:167
std::uint32_t getId() const noexcept
Definition EventTypeEnum.hpp:103
bool isMarket() const noexcept
Definition EventTypeEnum.hpp:188
const std::string & getName() const &noexcept
Definition EventTypeEnum.hpp:110
Source identifier for IndexedEvent.
Definition IndexedEventSource.hpp:22
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition IndexedEventSource.cpp:21
const std::string & name() const noexcept
Returns the string representation of the object.
Definition IndexedEventSource.hpp:90
static IndexedEventSource fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
Definition IndexedEventSource.cpp:32
static const IndexedEventSource DEFAULT
The default source with zero identifier for all events that do not support multiple sources.
Definition IndexedEventSource.hpp:13
std::int32_t id() const noexcept
Returns the source identifier.
Definition IndexedEventSource.hpp:81
virtual void * toGraal() const
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition IndexedEventSource.cpp:15
std::string toString() const
Returns the string representation of the object.
Definition IndexedEventSource.hpp:99
IndexedEventSource(std::int32_t id, std::string name) noexcept
Creates the new IndexedEvent's source by id and name.
Definition IndexedEventSource.hpp:73
Represents subscription to a specific source of indexed events.
Definition IndexedEventSubscriptionSymbol.hpp:40
virtual const std::unique_ptr< SymbolWrapper > & getEventSymbol() const
Returns the wrapped event symbol (CandleSymbol, WildcardSymbol, etc).
Definition IndexedEventSubscriptionSymbol.cpp:16
virtual void * toGraal() const
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition IndexedEventSubscriptionSymbol.cpp:24
static IndexedEventSubscriptionSymbol fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure ...
Definition IndexedEventSubscriptionSymbol.cpp:46
virtual const std::unique_ptr< IndexedEventSource > & getSource() const
Returns indexed event source.
Definition IndexedEventSubscriptionSymbol.cpp:20
IndexedEventSubscriptionSymbol(const SymbolWrapper &eventSymbol, const IndexedEventSource &source)
Creates indexed event subscription symbol with a specified event symbol and source.
Definition IndexedEventSubscriptionSymbol.cpp:10
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition IndexedEventSubscriptionSymbol.cpp:33
virtual std::string toString() const
Returns string representation of this indexed event subscription symbol.
Definition IndexedEventSubscriptionSymbol.cpp:61
static const OrderSource GLBX
CME Globex.
Definition OrderSource.hpp:307
static const OrderSource smfe
Small Exchange.
Definition OrderSource.hpp:371
static const OrderSource bzx
Bats BZX Exchange.
Definition OrderSource.hpp:235
static const OrderSource DEX
Direct-Edge EDGX Exchange.
Definition OrderSource.hpp:202
static const OrderSource NTV
NASDAQ Total View.
Definition OrderSource.hpp:138
static const OrderSource AGGREGATE_ASK
Ask side of an aggregate order book (futures depth and NASDAQ Level II).
Definition OrderSource.hpp:123
static const OrderSource & valueOf(std::int32_t sourceId)
Returns order source for the specified source identifier.
Definition OrderSource.cpp:178
static const OrderSource ESPD
NASDAQ eSpeed.
Definition OrderSource.hpp:162
static const OrderSource CFE
CBOE Futures Exchange.
Definition OrderSource.hpp:347
static const OrderSource ntv
NASDAQ Total View.
Definition OrderSource.hpp:146
static const OrderSource ICE
Intercontinental Exchange.
Definition OrderSource.hpp:178
static const OrderSource BZX
Bats BZX Exchange.
Definition OrderSource.hpp:227
static const OrderSource C2OX
CBOE Options C2 Exchange.
Definition OrderSource.hpp:355
static const OrderSource REGIONAL_ASK
Ask side of a regional Quote.
Definition OrderSource.hpp:111
static const OrderSource REGIONAL_BID
Bid side of a regional Quote.
Definition OrderSource.hpp:104
static const OrderSource ABE
ABE (abe.io) exchange.
Definition OrderSource.hpp:291
static const OrderSource CEUX
Bats Europe DXE Exchange.
Definition OrderSource.hpp:259
static const OrderSource OCEA
Blue Ocean Technologies Alternative Trading System.
Definition OrderSource.hpp:403
static const OrderSource AGGREGATE_BID
Bid side of an aggregate order book (futures depth and NASDAQ Level II).
Definition OrderSource.hpp:117
static const OrderSource BXTR
Bats Europe TRF.
Definition OrderSource.hpp:267
static const OrderSource dex
Direct-Edge EDGX Exchange.
Definition OrderSource.hpp:211
static const OrderSource cedx
Cboe European Derivatives.
Definition OrderSource.hpp:444
static const OrderSource COMPOSITE_ASK
Ask side of a composite Quote.
Definition OrderSource.hpp:97
static const OrderSource XNFI
NASDAQ Fixed Income.
Definition OrderSource.hpp:170
static const OrderSource iex
Investors exchange.
Definition OrderSource.hpp:379
static const OrderSource xeur
Eurex Exchange.
Definition OrderSource.hpp:339
static const OrderSource CEDX
Cboe European Derivatives.
Definition OrderSource.hpp:436
static const OrderSource ISE
International Securities Exchange.
Definition OrderSource.hpp:186
static const OrderSource DEA
Direct-Edge EDGA Exchange.
Definition OrderSource.hpp:194
static const OrderSource glbx
CME Globex.
Definition OrderSource.hpp:315
static const OrderSource BI20
Borsa Istanbul Exchange.
Definition OrderSource.hpp:283
static const OrderSource BYX
Bats BYX Exchange.
Definition OrderSource.hpp:219
static const OrderSource FAIR
FAIR (FairX) exchange.
Definition OrderSource.hpp:299
static const OrderSource BATE
Bats Europe BXE Exchange.
Definition OrderSource.hpp:243
static const OrderSource pink
Pink Sheets.
Definition OrderSource.hpp:412
static const OrderSource DEFAULT
Default source for publishing custom order books.
Definition OrderSource.hpp:130
static const OrderSource NFX
NASDAQ Futures Exchange.
Definition OrderSource.hpp:154
static const OrderSource memx
Members Exchange.
Definition OrderSource.hpp:395
static bool isSpecialSourceId(std::int32_t sourceId) noexcept
Determines whether specified source identifier refers to special order source.
Definition OrderSource.cpp:174
static const OrderSource IST
Borsa Istanbul Exchange.
Definition OrderSource.hpp:275
static const OrderSource ARCA
NYSE Arca traded securities.
Definition OrderSource.hpp:420
static const OrderSource CHIX
Bats Europe CXE Exchange.
Definition OrderSource.hpp:251
static const OrderSource & valueOf(const std::string &name)
Returns order source for the specified source name.
Definition OrderSource.cpp:192
static const OrderSource ERIS
Eris Exchange group of companies.
Definition OrderSource.hpp:323
static const OrderSource XEUR
Eurex Exchange.
Definition OrderSource.hpp:331
static const OrderSource MEMX
Members Exchange.
Definition OrderSource.hpp:387
static const OrderSource COMPOSITE_BID
Bid side of a composite Quote.
Definition OrderSource.hpp:90
static const OrderSource arca
NYSE Arca traded securities.
Definition OrderSource.hpp:428
static const OrderSource SMFE
Small Exchange.
Definition OrderSource.hpp:363
TimeSeriesSubscriptionSymbol(const SymbolWrapper &eventSymbol, std::int64_t fromTime)
Creates 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:63
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 the dxFeed Graal SDK structure ...
Definition TimeSeriesSubscriptionSymbol.cpp:48
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition TimeSeriesSubscriptionSymbol.cpp:32
Candle alignment attribute of CandleSymbol defines how candle are aligned with respect to time.
Definition CandleAlignment.hpp:32
static const CandleAlignment DEFAULT
Default alignment is CandleAlignment::MIDNIGHT.
Definition CandleAlignment.hpp:46
static const CandleAlignment MIDNIGHT
Align candles on midnight.
Definition CandleAlignment.hpp:12
static std::reference_wrapper< const CandleAlignment > getAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol)
Returns candle alignment of the given candle symbol string.
Definition CandleAlignment.cpp:79
static const CandleAlignment SESSION
Align candles on trading sessions.
Definition CandleAlignment.hpp:13
std::string toString() const
Returns string representation of this candle alignment.
Definition CandleAlignment.cpp:37
static std::string normalizeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol)
Returns candle symbol string with the normalized representation of the candle alignment attribute.
Definition CandleAlignment.cpp:91
static const std::string ATTRIBUTE_KEY
The attribute key that is used to store the value of CandleAlignment in a symbol string using methods...
Definition CandleAlignment.hpp:15
std::string changeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol) const override
Returns candle event symbol string with this candle alignment set.
Definition CandleAlignment.cpp:32
static std::reference_wrapper< const CandleAlignment > parse(const dxfcpp::StringLikeWrapper &s)
Parses string representation of candle alignment into object.
Definition CandleAlignment.cpp:53
Exchange attribute of CandleSymbol defines exchange identifier where data is taken from to build the ...
Definition CandleExchange.hpp:30
std::string changeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol) const override
Returns candle event symbol string with this exchange set.
Definition CandleExchange.hpp:65
static const CandleExchange COMPOSITE
Composite exchange where data is taken from all exchanges.
Definition CandleExchange.hpp:11
char getExchangeCode() const noexcept
Returns exchange code.
Definition CandleExchange.hpp:55
static CandleExchange getAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol)
Returns exchange attribute object of the given candle symbol string.
Definition CandleExchange.hpp:101
static const CandleExchange DEFAULT
Default exchange is CandleExchange::COMPOSITE.
Definition CandleExchange.hpp:39
std::string toString() const
Returns string representation of this exchange.
Definition CandleExchange.hpp:76
static CandleExchange valueOf(char exchangeCode) noexcept
Returns exchange attribute object that corresponds to the specified exchange code character.
Definition CandleExchange.hpp:90
Period attribute of CandleSymbol defines aggregation period of the candles.
Definition CandlePeriod.hpp:37
static CandlePeriod parse(const dxfcpp::StringLikeWrapper &s)
Parses string representation of aggregation period into object.
Definition CandlePeriod.hpp:155
double getValue() const noexcept
Returns aggregation period value.
Definition CandlePeriod.hpp:109
static const std::string ATTRIBUTE_KEY
The attribute key that is used to store the value of CandlePeriod in a symbol string using methods of...
Definition CandlePeriod.hpp:53
static const CandlePeriod TICK
Tick aggregation where each candle represents an individual tick.
Definition CandlePeriod.hpp:50
static const CandlePeriod DEFAULT
Default period is CandlePeriod::TICK.
Definition CandlePeriod.hpp:51
std::int64_t getPeriodIntervalMillis() const noexcept
Returns aggregation period in milliseconds as closely as possible.
Definition CandlePeriod.hpp:88
static const CandlePeriod DAY
Day aggregation where each candle represents a day.
Definition CandlePeriod.hpp:51
static CandlePeriod valueOf(double value, const CandleType &type) noexcept
Returns candle period with the given value and type.
Definition CandlePeriod.hpp:188
const CandleType & getType() const &noexcept
Returns aggregation period type.
Definition CandlePeriod.hpp:117
const std::string & toString() const &
Returns string representation of this aggregation period.
Definition CandlePeriod.hpp:131
std::string changeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol) const override
Returns candle event symbol string with this aggregation period set.
Definition CandlePeriod.hpp:97
static std::string normalizeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol)
Returns candle symbol string with the normalized representation of the candle period attribute.
Definition CandlePeriod.hpp:219
static CandlePeriod getAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol) noexcept
Returns candle period of the given candle symbol string.
Definition CandlePeriod.hpp:207
Candle price level attribute of CandleSymbol defines how candles shall be aggregated in respect to pr...
Definition CandlePriceLevel.hpp:40
std::string toString() const
Returns string representation of this price level.
Definition CandlePriceLevel.hpp:80
double getValue() const noexcept
Returns price level value.
Definition CandlePriceLevel.hpp:69
static CandlePriceLevel parse(const dxfcpp::StringLikeWrapper &s)
Parses string representation of candle price level into object.
Definition CandlePriceLevel.hpp:111
static const std::string ATTRIBUTE_KEY
The attribute key that is used to store the value of CandlePriceLevel in a symbol string using method...
Definition CandlePriceLevel.hpp:13
static CandlePriceLevel valueOf(double value)
Returns candle price level with the given value.
Definition CandlePriceLevel.hpp:122
static std::string normalizeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol)
Returns candle symbol string with the normalized representation of the candle price level attribute.
Definition CandlePriceLevel.hpp:149
std::string changeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol) const override
Returns candle event symbol string with this candle price level set.
Definition CandlePriceLevel.hpp:98
static const CandlePriceLevel DEFAULT
Default price level corresponds to NaN (std::numeric_limits<double>::quiet_NaN())
Definition CandlePriceLevel.hpp:11
static CandlePriceLevel getAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol)
Returns candle price level of the given candle symbol string.
Definition CandlePriceLevel.hpp:137
Price type attribute of CandleSymbol defines price that is used to build the candles.
Definition CandlePrice.hpp:34
static std::string normalizeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol)
Returns candle symbol string with the normalized representation of the candle price type attribute.
Definition CandlePrice.hpp:165
static const CandlePrice BID
Quote bid price.
Definition CandlePrice.hpp:12
static const CandlePrice ASK
Quote ask price.
Definition CandlePrice.hpp:13
static const CandlePrice LAST
Last trading price.
Definition CandlePrice.hpp:11
static std::reference_wrapper< const CandlePrice > getAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol) noexcept
Returns candle price type of the given candle symbol string.
Definition CandlePrice.hpp:153
static const CandlePrice MARK
Market price defined as average between quote bid and ask prices.
Definition CandlePrice.hpp:14
static std::reference_wrapper< const CandlePrice > parse(const dxfcpp::StringLikeWrapper &s)
Parses string representation of candle price type into object.
Definition CandlePrice.hpp:123
const std::string & toString() const &noexcept
Returns string representation of this candle price type.
Definition CandlePrice.hpp:107
static const CandlePrice DEFAULT
Default price type is CandlePrice::LAST.
Definition CandlePrice.hpp:65
static const CandlePrice SETTLEMENT
Official settlement price that is defined by exchange or last trading price otherwise.
Definition CandlePrice.hpp:15
std::string changeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol) const override
Returns candle event symbol string with this candle price type set.
Definition CandlePrice.hpp:95
static const std::string ATTRIBUTE_KEY
The attribute key that is used to store the value of CandlePrice in a symbol string using methods of ...
Definition CandlePrice.hpp:18
const std::string & toString() const &noexcept
Returns string representation of this candle session attribute.
Definition CandleSession.hpp:102
std::string changeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol) const override
Returns candle event symbol string with this session attribute set.
Definition CandleSession.hpp:90
static const CandleSession REGULAR
Only regular trading session data is used to build candles.
Definition CandleSession.hpp:45
static std::string normalizeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol) noexcept
Returns candle symbol string with the normalized representation of the candle session attribute.
Definition CandleSession.hpp:159
const SessionFilter & getSessionFilter() const &noexcept
Returns session filter that corresponds to this session attribute.
Definition CandleSession.hpp:81
static std::reference_wrapper< const CandleSession > parse(const dxfcpp::StringLikeWrapper &s)
Parses string representation of candle session attribute into object.
Definition CandleSession.hpp:118
static const CandleSession ANY
All trading sessions are used to build candles.
Definition CandleSession.hpp:44
static std::reference_wrapper< const CandleSession > getAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol)
Returns candle session attribute of the given candle symbol string.
Definition CandleSession.hpp:147
static const std::string ATTRIBUTE_KEY
The attribute key that is used to store the value of CandleSession in a symbol string using methods o...
Definition CandleSession.hpp:60
static const CandleSession DEFAULT
Default trading session is CandleSession::ANY.
Definition CandleSession.hpp:51
Attribute of the CandleSymbol.
Definition CandleSymbolAttribute.hpp:19
virtual std::string changeAttributeForSymbol(const dxfcpp::StringLikeWrapper &symbol) const =0
Returns candle event symbol string with this attribute set.
Symbol that should be used with DXFeedSubscription class to subscribe for Candle events.
Definition CandleSymbol.hpp:83
static CandleSymbol valueOf(std::string symbol, CandleSymbolAttributesCollection &&attributes) noexcept
Converts the given string symbol into the candle symbol object with the specified attributes set.
Definition CandleSymbol.hpp:347
const std::optional< CandlePeriod > & getPeriod() const &noexcept
Returns aggregation period of this symbol.
Definition CandleSymbol.hpp:210
const std::optional< CandlePriceLevel > & getPriceLevel() const &noexcept
Returns price level attribute of this symbol.
Definition CandleSymbol.hpp:228
static CandleSymbol valueOf(std::string 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.hpp:329
const std::optional< CandleExchange > & getExchange() const &noexcept
Returns exchange attribute of this symbol.
Definition CandleSymbol.hpp:183
const std::string & getBaseSymbol() const &noexcept
Returns base market symbol without attributes.
Definition CandleSymbol.hpp:174
static CandleSymbol valueOf(std::string 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:316
const std::optional< CandlePrice > & getPrice() const &noexcept
Returns price type attribute of this symbol.
Definition CandleSymbol.hpp:192
static CandleSymbol valueOf(std::string symbol) noexcept
Converts the given string symbol into the candle symbol object.
Definition CandleSymbol.hpp:291
static CandleSymbol valueOf(std::string symbol, const CandleSymbolAttributeVariant &attribute) noexcept
Converts the given string symbol into the candle symbol object with the specified attribute set.
Definition CandleSymbol.hpp:302
virtual void * toGraal() const
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition CandleSymbol.cpp:11
const std::string & toString() const &noexcept
Returns string representation of this symbol.
Definition CandleSymbol.hpp:239
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition CandleSymbol.cpp:21
const std::optional< CandleSession > & getSession() const &noexcept
Returns session attribute of this symbol.
Definition CandleSymbol.hpp:201
static CandleSymbol fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
Definition CandleSymbol.cpp:36
const std::optional< CandleAlignment > & getAlignment() const &noexcept
Returns alignment attribute of this symbol.
Definition CandleSymbol.hpp:219
Type of the candle aggregation period constitutes CandlePeriod type together its actual value.
Definition CandleType.hpp:27
static const CandleType VOLUME
Certain volume of trades.
Definition CandleType.hpp:76
static const CandleType MONTH
Certain number of months.
Definition CandleType.hpp:61
static const CandleType PRICE_RENKO
Certain price change, calculated according to the following rules:
Definition CandleType.hpp:111
static std::reference_wrapper< const CandleType > parse(const dxfcpp::StringLikeWrapper &s)
Parses string representation of candle type into object.
Definition CandleType.hpp:177
static const CandleType DAY
Certain number of days.
Definition CandleType.hpp:15
std::int64_t getPeriodIntervalMillis() const noexcept
Returns candle type period in milliseconds as closely as possible.
Definition CandleType.hpp:141
static const CandleType WEEK
Certain number of weeks.
Definition CandleType.hpp:16
static const CandleType HOUR
Certain number of hours.
Definition CandleType.hpp:14
static const CandleType PRICE
Certain price change, calculated according to the following rules:
Definition CandleType.hpp:87
static const CandleType TICK
Certain number of ticks.
Definition CandleType.hpp:11
const std::string & toString() const &noexcept
Returns string representation of this candle type.
Definition CandleType.hpp:164
static const CandleType OPTEXP
Certain number of option expirations.
Definition CandleType.hpp:66
static const CandleType SECOND
Certain number of seconds.
Definition CandleType.hpp:12
static const CandleType MINUTE
Certain number of minutes.
Definition CandleType.hpp:13
const std::string & getName() const &noexcept
Returns a name of this candle type.
Definition CandleType.hpp:150
static const CandleType PRICE_MOMENTUM
Certain price change, calculated according to the following rules:
Definition CandleType.hpp:99
static const CandleType YEAR
Certain number of years.
Definition CandleType.hpp:71
Manages network connections to feed or publisher.
Definition DXEndpoint.hpp:186
bool isClosed() const
Definition DXEndpoint.cpp:488
SimpleHandler< void(DXEndpoint::State, DXEndpoint::State)> & onStateChange() noexcept
Returns the onStateChange handler that can be used to add or remove listeners.
Definition DXEndpoint.cpp:500
static const std::string DXFEED_PASSWORD_PROPERTY
"dxfeed.password"
Definition DXEndpoint.hpp:253
static std::shared_ptr< DXEndpoint > create(Role role)
Creates an endpoint with a specified role.
Definition DXEndpoint.cpp:476
void awaitProcessed()
Waits until this endpoint stops processing data (becomes quiescent).
Definition DXEndpoint.cpp:211
State
Represents the current state of endpoint.
Definition DXEndpoint.hpp:451
@ CLOSED
Endpoint was closed.
Definition DXEndpoint.hpp:471
@ CONNECTING
The connect method was called to establish connection to remove endpoint, but connection is not actua...
Definition DXEndpoint.hpp:461
@ CONNECTED
The connection to remote endpoint is established.
Definition DXEndpoint.hpp:466
@ NOT_CONNECTED
Endpoint was created by is not connected to remote endpoints.
Definition DXEndpoint.hpp:455
void disconnectAndClear()
Terminates all remote network connections and clears stored data.
Definition DXEndpoint.cpp:195
void reconnect()
Terminates all established network connections and initiates connecting again with the same address.
Definition DXEndpoint.cpp:179
static std::shared_ptr< DXEndpoint > create()
Creates an endpoint with FEED role.
Definition DXEndpoint.cpp:468
void removeStateChangeListener(std::size_t listenerId) noexcept
Removes listener that is notified about changes in state property.
Definition DXEndpoint.cpp:496
const std::string & getName() const &noexcept
Definition DXEndpoint.cpp:492
Role
Represents the role of endpoint that was specified during its creation.
Definition DXEndpoint.hpp:380
@ PUBLISHER
PUBLISHER endpoint connects to the remote publisher hub (also known as multiplexor) or creates a publ...
Definition DXEndpoint.hpp:425
@ STREAM_FEED
STREAM_FEED endpoint is similar to DXEndpoint::FEED and also connects to the remote data feed provide...
Definition DXEndpoint.hpp:413
@ LOCAL_HUB
LOCAL_HUB endpoint is a local hub without ability to establish network connections.
Definition DXEndpoint.hpp:441
@ ON_DEMAND_FEED
ON_DEMAND_FEED endpoint is similar to DXEndpoint::FEED, but it is designed to be used with OnDemandSe...
Definition DXEndpoint.hpp:404
@ STREAM_PUBLISHER
STREAM_PUBLISHER endpoint is similar to DXEndpoint::PUBLISHER and also connects to the remote publish...
Definition DXEndpoint.hpp:434
@ FEED
FEED endpoint connects to the remote data feed provider and is optimized for real-time or delayed dat...
Definition DXEndpoint.hpp:391
std::string toString() const override
Returns a string representation of the current object.
Definition DXEndpoint.cpp:371
std::shared_ptr< DXFeed > getFeed()
Definition DXEndpoint.cpp:227
static const std::string DXFEED_WILDCARD_ENABLE_PROPERTY
"dxfeed.wildcard.enable"
Definition DXEndpoint.hpp:281
std::size_t addStateChangeListener(std::function< void(State, State)> listener) noexcept
Adds listener that is notified about changes in state property.
Definition DXEndpoint.hpp:628
static const std::string DXENDPOINT_EVENT_TIME_PROPERTY
"dxendpoint.eventTime"
Definition DXEndpoint.hpp:326
static const std::string DXPUBLISHER_THREAD_POOL_SIZE_PROPERTY
"dxpublisher.threadPoolSize"
Definition DXEndpoint.hpp:309
std::shared_ptr< DXEndpoint > connect(const std::string &address)
Connects to the specified remote address.
Definition DXEndpoint.cpp:168
State getState() const
Returns the state of this endpoint.
Definition DXEndpoint.cpp:150
static const std::string DXENDPOINT_STORE_EVERYTHING_PROPERTY
"dxendpoint.storeEverything"
Definition DXEndpoint.hpp:339
static std::shared_ptr< DXEndpoint > getInstance(Role role)
Returns a default application-wide singleton instance of DXEndpoint for a specific role.
Definition DXEndpoint.cpp:452
std::shared_ptr< DXPublisher > getPublisher()
Definition DXEndpoint.cpp:235
static const std::string DXFEED_AGGREGATION_PERIOD_PROPERTY
"dxfeed.aggregationPeriod"
Definition DXEndpoint.hpp:272
std::shared_ptr< DXEndpoint > password(const std::string &password)
Changes password for this endpoint.
Definition DXEndpoint.cpp:161
void close()
Closes this endpoint.
Definition DXEndpoint.cpp:504
static const std::string DXFEED_THREAD_POOL_SIZE_PROPERTY
"dxfeed.threadPoolSize"
Definition DXEndpoint.hpp:262
void awaitNotConnected()
Waits while this endpoint state becomes NOT_CONNECTED or CLOSED.
Definition DXEndpoint.cpp:203
void closeAndAwaitTermination()
Closes this endpoint and wait until all pending data processing tasks are completed.
Definition DXEndpoint.cpp:219
std::shared_ptr< DXEndpoint > user(const std::string &user)
Changes user name for this endpoint.
Definition DXEndpoint.cpp:154
static std::shared_ptr< DXEndpoint > getInstance()
Returns a default application-wide singleton instance of DXEndpoint with a FEED role.
Definition DXEndpoint.cpp:444
static const std::string DXPUBLISHER_ADDRESS_PROPERTY
"dxpublisher.address"
Definition DXEndpoint.hpp:300
static const std::string DXFEED_USER_PROPERTY
"dxfeed.user"
Definition DXEndpoint.hpp:243
static const std::string NAME_PROPERTY
"name"
Definition DXEndpoint.hpp:203
static const std::string DXSCHEME_ENABLED_PROPERTY_PREFIX
"dxscheme.enabled."
Definition DXEndpoint.hpp:373
static const std::string DXPUBLISHER_PROPERTIES_PROPERTY
"dxpublisher.properties"
Definition DXEndpoint.hpp:290
static const std::string DXSCHEME_NANO_TIME_PROPERTY
"dxscheme.nanoTime"
Definition DXEndpoint.hpp:359
static const std::string DXFEED_ADDRESS_PROPERTY
"dxfeed.address"
Definition DXEndpoint.hpp:233
Role getRole() const noexcept
Returns the role of this endpoint.
Definition DXEndpoint.cpp:484
static const std::string DXFEED_PROPERTIES_PROPERTY
"dxfeed.properties"
Definition DXEndpoint.hpp:214
static std::shared_ptr< Builder > newBuilder()
Creates new Builder instance.
Definition DXEndpoint.cpp:460
void disconnect()
Terminates all remote network connections.
Definition DXEndpoint.cpp:187
Main entry class for dxFeed API (read it first).
Definition DXFeed.hpp:116
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 u...
Definition DXFeed.hpp:975
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(EventTypeIt begin, EventTypeIt end)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:462
std::shared_ptr< DXFeedSubscription > createSubscription(std::initializer_list< EventTypeEnum > eventTypes)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.cpp:98
void detachSubscriptionAndClear(std::shared_ptr< DXFeedSubscription > subscription)
Detaches the given subscription from this feed and clears data delivered to this subscription by publ...
Definition DXFeed.cpp:67
std::shared_ptr< DXFeedSubscription > createSubscription(EventTypeIt begin, EventTypeIt end)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:356
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:691
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(const EventTypeEnum &eventType)
Creates new subscription for a single event type that is attached to this feed.
Definition DXFeed.cpp:111
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:959
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:907
void attachSubscription(std::shared_ptr< DXFeedSubscription > subscription)
Attaches the given subscription to this feed.
Definition DXFeed.cpp:29
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:855
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:305
std::shared_ptr< PromiseList< E > > getLastEventsPromises(SymbolsCollection &&collection) const
Requests the last events for the specified event type and a collection of symbols.
Definition DXFeed.hpp:649
std::shared_ptr< DXFeedSubscription > createSubscription(EventTypesCollection &&eventTypes)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:403
std::shared_ptr< DXFeedSubscription > createSubscription(const EventTypeEnum &eventType)
Creates new subscription for a single event type that is attached to this feed.
Definition DXFeed.cpp:86
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 u...
Definition DXFeed.hpp:990
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(EventTypesCollection &&eventTypes)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.hpp:524
static std::shared_ptr< DXFeed > getInstance()
Returns a default application-wide singleton instance of feed.
Definition DXFeed.cpp:21
void detachSubscription(std::shared_ptr< DXFeedSubscription > subscription)
Detaches the given subscription from this feed.
Definition DXFeed.cpp:48
std::shared_ptr< E > getLastEvent(std::shared_ptr< E > event)
Returns the last event for the specified event instance.
Definition DXFeed.hpp:245
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:603
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:558
std::shared_ptr< DXFeedTimeSeriesSubscription > createTimeSeriesSubscription(std::initializer_list< EventTypeEnum > eventTypes)
Creates new subscription for multiple event types that is attached to this feed.
Definition DXFeed.cpp:132
std::string toString() const override
Returns a string representation of the current object.
Definition DXFeed.cpp:217
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:744
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 sub...
Definition DXFeed.hpp:800
const Collection & getLastEvents(const Collection &events)
Returns the last events for the specified list of event instances.
Definition DXFeed.hpp:266
Provides API for publishing of events to local or remote DXFeed.
Definition DXPublisher.hpp:62
Base abstract class for all dxFeed C++ API entities.
Definition Entity.hpp:13
virtual ~Entity() noexcept=default
The default virtual d-tor.
bool isOrderSource() const noexcept
Definition EventSourceWrapper.hpp:242
std::unique_ptr< void, decltype(&EventSourceWrapper::freeGraal)> toGraalUnique() const noexcept
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition EventSourceWrapper.hpp:200
std::string toStringUnderlying() const
Returns a string representation of the underlying object.
Definition EventSourceWrapper.hpp:224
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition EventSourceWrapper.hpp:163
std::string toString() const
Returns a string representation of the current object.
Definition EventSourceWrapper.hpp:209
void * toGraal() const noexcept
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition EventSourceWrapper.hpp:184
static EventSourceWrapper fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
Definition EventSourceWrapper.cpp:40
const DataType & getData() const noexcept
Definition EventSourceWrapper.hpp:266
EventSourceWrapper(const IndexedEventSource &data) noexcept
Constructs a wrapper from IndexedEventSource.
Definition EventSourceWrapper.hpp:145
bool isIndexedEventSource() const noexcept
Definition EventSourceWrapper.hpp:235
std::optional< IndexedEventSource > asIndexedEventSource() const noexcept
Definition EventSourceWrapper.hpp:250
std::optional< OrderSource > asOrderSource() const noexcept
Definition EventSourceWrapper.hpp:259
EventSourceWrapper(const OrderSource &data) noexcept
Constructs a wrapper from OrderSource.
Definition EventSourceWrapper.hpp:153
Event type parametrized by a symbol.
Definition EventType.hpp:116
virtual const std::optional< Symbol > & getEventSymbolOpt() const &noexcept=0
Returns event symbol that identifies this event type in subscription.
virtual void setEventSymbol(const Symbol &eventSymbol) noexcept=0
Changes event symbol that identifies this event type in subscription.
virtual const Symbol & getEventSymbol() const &noexcept=0
Returns event symbol that identifies this event type in subscription.
Marks all event types that can be received via dxFeed API.
Definition EventType.hpp:31
std::string toString() const override
Returns a string representation of the current object.
Definition EventType.hpp:89
virtual std::int64_t getEventTime() const noexcept
Returns time when event was created or zero when time is not available.
Definition EventType.hpp:54
virtual void assign(std::shared_ptr< EventType > event)
Replaces the contents of the event.
Definition EventType.hpp:84
virtual void * toGraal() const =0
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
virtual void setEventTime(std::int64_t) noexcept
Changes event creation time.
Definition EventType.hpp:66
This marker interface marks subscription symbol classes (like TimeSeriesSubscriptionSymbol) that atta...
Definition FilteredSubscriptionSymbol.hpp:27
The wrapper over CEntryPointErrorsEnum, the error code returned by GraalVM.
Definition GraalException.hpp:22
GraalException(CEntryPointErrorsEnum entryPointErrorsEnum)
Constructs an exception.
Definition GraalException.cpp:10
void handle(ArgTypes... args)
Calls the listeners and pass the args to them.
Definition Handler.hpp:123
std::size_t add(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:157
std::size_t operator%=(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group).
Definition Handler.hpp:209
std::size_t operator+=(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:198
void operator()(ArgTypes... args)
Calls the listeners and pass the ars to them.
Definition Handler.hpp:147
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:85
void operator-=(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:237
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:178
void remove(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:218
Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Definition InvalidArgumentException.hpp:21
Represents up-to-date information about some condition or state of an external entity that updates in...
Definition LastingEvent.hpp:28
Helper class to compose and parse symbols for market events.
Definition MarketEventSymbols.hpp:39
static bool hasExchangeCode(const std::string &symbol) noexcept
Returns true is the specified symbol has the exchange code specification.
Definition MarketEventSymbols.hpp:46
static DXFCPP_CXX20_CONSTEXPR_STRING std::string changeBaseSymbol(const std::string &symbol, const std::string &baseSymbol) noexcept
Changes base symbol while leaving exchange code and attributes intact.
Definition MarketEventSymbols.hpp:91
static DXFCPP_CXX20_CONSTEXPR_STRING std::string changeExchangeCode(const std::string &symbol, char exchangeCode) noexcept
Changes exchange code of the specified symbol or removes it if new exchange code is ‘’\0'`.
Definition MarketEventSymbols.hpp:67
static DXFCPP_CXX20_CONSTEXPR_STRING std::string getBaseSymbol(const std::string &symbol) noexcept
Returns base symbol without exchange code and attributes.
Definition MarketEventSymbols.hpp:81
static DXFCPP_CXX20_CONSTEXPR_STRING std::optional< std::string > getAttributeStringByKey(const std::string &symbol, const std::string &key) noexcept
Returns value of the attribute with the specified key.
Definition MarketEventSymbols.hpp:110
static DXFCPP_CXX20_CONSTEXPR_STRING std::string removeAttributeStringByKey(const std::string &symbol, const std::string &key) noexcept
Removes one attribute with the specified key while leaving exchange code and other attributes intact.
Definition MarketEventSymbols.hpp:139
static DXFCPP_CXX20_CONSTEXPR_STRING std::string changeAttributeStringByKey(const std::string &symbol, const std::string &key, const std::string &value) noexcept
Changes value of one attribute value while leaving exchange code and other attributes intact.
Definition MarketEventSymbols.hpp:124
static char getExchangeCode(const std::string &symbol) noexcept
Returns exchange code of the specified symbol or ‘’\0'` if none is defined.
Definition MarketEventSymbols.hpp:56
Provides on-demand historical tick data replay controls.
Definition OnDemandService.hpp:76
A helper class needed to construct smart pointers to objects, and does not allow explicit constructio...
Definition SharedEntity.hpp:89
static auto createShared(Args &&...args)
Creates smart pointer to object.
Definition SharedEntity.hpp:103
A runtime axception with stacktrace.
Definition RuntimeException.hpp:20
RuntimeException(const StringLikeWrapper &message, const StringLikeWrapper &additionalStackTrace="")
Constructs a runtime exception.
Definition RuntimeException.cpp:71
const std::string & getStackTrace() const &
Definition RuntimeException.cpp:85
static const SessionFilter TRADING
Accepts trading sessions only - those with (Session::isTrading() == true).
Definition SessionFilter.hpp:33
static const SessionFilter ANY
Accepts any session - useful for pure schedule navigation.
Definition SessionFilter.hpp:32
static const SessionFilter AFTER_MARKET
Accepts any session with type SessionType::AFTER_MARKET.
Definition SessionFilter.hpp:41
static const SessionFilter REGULAR
Accepts any session with type SessionType::REGULAR.
Definition SessionFilter.hpp:40
SessionFilter(SessionFilterEnum code, std::string name, std::optional< SessionType > type, std::optional< bool > trading) noexcept
Creates filter with specified type and trading flag conditions.
Definition CandleSession.cpp:17
static const SessionFilter NO_TRADING
Accepts any session with type SessionType::NO_TRADING.
Definition SessionFilter.hpp:36
static const SessionFilter NON_TRADING
Accepts non-trading sessions only - those with (Session::isTrading() == false).
Definition SessionFilter.hpp:34
static const SessionFilter PRE_MARKET
Accepts any session with type SessionType::PRE_MARKET.
Definition SessionFilter.hpp:38
bool accept(Session session) const noexcept
Tests whether or not the specified session is an acceptable result.
Definition SessionFilter.hpp:104
std::optional< bool > trading_
Required trading flag, std::nullopt if not relevant.
Definition SessionFilter.hpp:70
std::optional< SessionType > type_
Required type, std::nullopt if not relevant.
Definition SessionFilter.hpp:68
Defines type of session - what kind of trading activity is allowed (if any), what rules are used,...
Definition SessionType.hpp:33
static const SessionType AFTER_MARKET
After-market session type marks extended trading session after regular trading hours.
Definition SessionType.hpp:15
static const SessionType PRE_MARKET
Pre-market session type marks extended trading session before regular trading hours.
Definition SessionType.hpp:13
static const SessionType REGULAR
Regular session type marks regular trading hours session.
Definition SessionType.hpp:14
static const SessionType NO_TRADING
Non-trading session type is used to mark periods of time during which trading is not allowed.
Definition SessionType.hpp:12
bool isTrading() const noexcept
Returns true if trading activity is allowed for this type of session.
Definition SessionType.hpp:70
Base abstract "shared entity" class. Has some helpers for dynamic polymorphism.
Definition SharedEntity.hpp:21
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.
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.
Definition SharedEntity.hpp:56
bool is() const noexcept
Checks that pointer to the current type could be converted to type T* In other words: whether type T ...
Definition SharedEntity.hpp:35
std::size_t operator+=(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:378
void remove(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:398
void handle(ArgTypes... args)
Calls the listeners and pass the args to them.
Definition Handler.hpp:316
void operator()(ArgTypes... args)
Calls the listeners and pass the ars to them.
Definition Handler.hpp:327
SimpleHandler() noexcept=default
Creates the new handler.
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:358
void operator-=(std::size_t id)
Removes a listener by the id.
Definition Handler.hpp:417
std::size_t operator%=(ListenerType &&listener)
Adds the low priority listener (to the "low priority" group).
Definition Handler.hpp:389
std::size_t add(ListenerType &&listener)
Adds the listener to "main" group.
Definition Handler.hpp:337
Universal functional object that allows searching std::unordered_map for string-like keys.
Definition Common.hpp:911
A simple wrapper around strings or something similar to strings to reduce the amount of code for meth...
Definition Common.hpp:794
StringSymbol(std::string_view stringView) noexcept
Constructs StringSymbol from a std::string_view.
Definition StringSymbol.hpp:53
StringSymbol(const char *chars) noexcept
Constructs StringSymbol from a char array.
Definition StringSymbol.hpp:40
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition StringSymbol.cpp:54
std::string toString() const
Returns a string representation of the current object.
Definition StringSymbol.hpp:100
static StringSymbol fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
Definition StringSymbol.cpp:69
void * toGraal() const
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition StringSymbol.cpp:44
std::optional< CandleSymbol > asCandleSymbol() const noexcept
Definition SymbolWrapper.hpp:382
SymbolWrapper(Symbol &&symbol) noexcept
Constructor for any wrapped symbol.
Definition SymbolWrapper.hpp:158
bool isIndexedEventSubscriptionSymbol() const noexcept
Definition SymbolWrapper.hpp:340
std::string toString() const
Returns a string representation of the current object.
Definition SymbolWrapper.hpp:286
static SymbolWrapper fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
Definition SymbolWrapper.cpp:79
std::string toStringUnderlying() const
Returns a string representation of the underlying object.
Definition SymbolWrapper.hpp:301
std::unique_ptr< void, decltype(&SymbolWrapper::freeGraal)> toGraalUnique() const noexcept
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition SymbolWrapper.hpp:277
bool isStringSymbol() const noexcept
Definition SymbolWrapper.hpp:312
std::optional< IndexedEventSubscriptionSymbol > asIndexedEventSubscriptionSymbol() const noexcept
Definition SymbolWrapper.hpp:348
bool isWildcardSymbol() const noexcept
Definition SymbolWrapper.hpp:326
void * toGraal() const noexcept
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition SymbolWrapper.hpp:258
SymbolWrapper(const IndexedEventSubscriptionSymbol &indexedEventSubscriptionSymbol) noexcept
Constructor for IndexedEventSubscriptionSymbol.
Definition SymbolWrapper.hpp:197
const DataType & getData() const noexcept
Definition SymbolWrapper.hpp:389
std::string asStringSymbol() const noexcept
Definition SymbolWrapper.hpp:319
SymbolWrapper(const StringSymbol &stringSymbol) noexcept
Constructor for any wrapped string symbol.
Definition SymbolWrapper.hpp:171
std::optional< WildcardSymbol > asWildcardSymbol() const noexcept
Definition SymbolWrapper.hpp:333
SymbolWrapper(const CandleSymbol &candleSymbol) noexcept
Constructor for CandleSymbol.
Definition SymbolWrapper.hpp:225
SymbolWrapper(const WildcardSymbol &wildcardSymbol) noexcept
Constructor for any wrapped wildcard (*) symbol.
Definition SymbolWrapper.hpp:184
bool isTimeSeriesSubscriptionSymbol() const noexcept
Definition SymbolWrapper.hpp:357
SymbolWrapper(const TimeSeriesSubscriptionSymbol &timeSeriesSubscriptionSymbol) noexcept
Constructor for TimeSeriesSubscriptionSymbol.
Definition SymbolWrapper.hpp:211
bool isCandleSymbol() const noexcept
Definition SymbolWrapper.hpp:374
std::optional< TimeSeriesSubscriptionSymbol > asTimeSeriesSubscriptionSymbol() const noexcept
Definition SymbolWrapper.hpp:365
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition SymbolWrapper.cpp:42
Utility class for parsing and formatting dates and times in ISO-compatible format.
Definition TimeFormat.hpp:29
std::string format(std::int64_t timestamp) const
Converts timestamp into string according to the format.
Definition TimeFormat.cpp:55
static const TimeFormat GMT
An instance of TimeFormat that corresponds to GMT timezone as returned by TimeZone::getTimeZone("GMT"...
Definition TimeFormat.hpp:41
std::int64_t parse(const StringLikeWrapper &value) const
Reads Date from String and returns timestamp.
Definition TimeFormat.cpp:49
static const TimeFormat DEFAULT
An instance of TimeFormat that corresponds to default timezone as returned by TimeZone::getDefault() ...
Definition TimeFormat.hpp:33
Value class for period of time with support for ISO8601 duration format.
Definition TimePeriod.hpp:19
static TimePeriod valueOf(std::chrono::milliseconds value)
Returns TimePeriod with value milliseconds.
Definition TimePeriod.hpp:42
static TimePeriod valueOf(const StringLikeWrapper &value)
Returns TimePeriod represented with a given string.
Definition TimePeriod.cpp:31
std::int64_t getNanos() const
Returns value in nanoseconds.
Definition TimePeriod.cpp:47
static const TimePeriod ZERO
Time-period of zero.
Definition TimePeriod.hpp:23
std::int32_t getSeconds() const
Returns value in seconds.
Definition TimePeriod.cpp:41
std::int64_t getTime() const
Returns value in milliseconds.
Definition TimePeriod.cpp:35
static const TimePeriod UNLIMITED
Time-period of "infinity" (time of std::numeric_limits<std::int64_t>::max() or LLONG_MAX).
Definition TimePeriod.hpp:26
static TimePeriod valueOf(std::int64_t value)
Returns TimePeriod with value milliseconds.
Definition TimePeriod.cpp:27
static void freeGraal(void *graalNative)
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
Definition WildcardSymbol.cpp:25
static const WildcardSymbol & fromGraal(void *graalNative)
Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
Definition WildcardSymbol.cpp:31
void * toGraal() const noexcept
Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Definition WildcardSymbol.cpp:15
static const WildcardSymbol ALL
Represents [wildcard] subscription to all events of the specific event type.
Definition WildcardSymbol.hpp:13
std::string toString() const
Returns string representation of this wildcard subscription symbol.
Definition WildcardSymbol.hpp:94
static const std::string RESERVED_PREFIX
Symbol prefix that is reserved for wildcard subscriptions.
Definition WildcardSymbol.hpp:28
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