-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ttldtor/main
Bring the list of unimplemented functions to comply with Graal Native SDK v1.1.22 and v1.1.23
- Loading branch information
Showing
129 changed files
with
5,585 additions
and
3,500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) 2024 Devexperts LLC. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
BasedOnStyle: LLVM | ||
ColumnLimit: 120 | ||
ContinuationIndentWidth: 4 | ||
IndentPPDirectives: AfterHash | ||
TabWidth: 4 | ||
IndentWidth: 4 | ||
UseTab: Never | ||
AllowShortBlocksOnASingleLine: Never | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortLambdasOnASingleLine: None | ||
AllowShortLoopsOnASingleLine: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
### C++ template | ||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
### C template | ||
# Prerequisites | ||
*.d | ||
|
||
# Object files | ||
*.o | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Linker output | ||
*.ilk | ||
*.map | ||
*.exp | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
||
# Debug files | ||
*.dSYM/ | ||
*.su | ||
*.idb | ||
*.pdb | ||
|
||
# Kernel Module Compile Results | ||
*.mod* | ||
*.cmd | ||
.tmp_versions/ | ||
modules.order | ||
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
|
||
cmake-build-*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,73 @@ | ||
// Copyright © 2023 Devexperts LLC. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. | ||
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
// Copyright (c) 2024 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#include <iostream> | ||
#include <chrono> | ||
#include <iostream> | ||
#include <thread> | ||
|
||
#include "api/dxfg_api.h" | ||
|
||
void c_print(graal_isolatethread_t *thread, dxfg_event_type_list *events, void *user_data) { | ||
for (int i = 0; i < events->size; ++i) { | ||
auto pEvent = events->elements ? events->elements[i] : nullptr; | ||
if (pEvent && pEvent->clazz == DXFG_EVENT_QUOTE) { | ||
const auto* quote = (const dxfg_quote_t*) pEvent; | ||
printf( | ||
"C: QUOTE{event_symbol=%s, bid_price=%f, bid_time=%lld, ask_price=%f, ask_time=%lld}\n", | ||
quote->market_event.event_symbol, | ||
quote->bid_price, | ||
quote->bid_time, | ||
quote->ask_price, | ||
quote->ask_time | ||
); | ||
for (int i = 0; i < events->size; ++i) { | ||
auto pEvent = events->elements ? events->elements[i] : nullptr; | ||
if (pEvent && pEvent->clazz == DXFG_EVENT_QUOTE) { | ||
const auto *quote = (const dxfg_quote_t *)pEvent; | ||
printf("C: QUOTE{event_symbol=%s, bid_price=%f, bid_time=%lld, ask_price=%f, ask_time=%lld}\n", | ||
quote->market_event.event_symbol, quote->bid_price, quote->bid_time, quote->ask_price, | ||
quote->ask_time); | ||
} | ||
fflush(stdout); | ||
} | ||
fflush(stdout); | ||
} | ||
} | ||
|
||
void endpoint_state_change_listener(graal_isolatethread_t *thread, dxfg_endpoint_state_t old_state, | ||
dxfg_endpoint_state_t new_state, void *user_data) { | ||
printf("C: state %d -> %d\n", old_state, new_state); | ||
printf("C: state %d -> %d\n", old_state, new_state); | ||
} | ||
|
||
void dxEndpointSubscription(graal_isolatethread_t *thread, const char* address, const char* symbol) { | ||
dxfg_endpoint_t* endpoint = dxfg_DXEndpoint_create(thread); | ||
dxfg_DXEndpoint_connect(thread, endpoint, address); | ||
dxfg_feed_t* feed = dxfg_DXEndpoint_getFeed(thread, endpoint); | ||
void dxEndpointSubscription(graal_isolatethread_t *thread, const char *address, const char *symbol) { | ||
dxfg_endpoint_t *endpoint = dxfg_DXEndpoint_create(thread); | ||
dxfg_DXEndpoint_connect(thread, endpoint, address); | ||
dxfg_feed_t *feed = dxfg_DXEndpoint_getFeed(thread, endpoint); | ||
|
||
dxfg_subscription_t* subscription = dxfg_DXFeed_createSubscription(thread, feed, DXFG_EVENT_QUOTE); | ||
dxfg_feed_event_listener_t* listener = dxfg_DXFeedEventListener_new(thread, &c_print, nullptr); | ||
dxfg_DXFeedSubscription_addEventListener(thread, subscription, listener); | ||
dxfg_subscription_t *subscription = dxfg_DXFeed_createSubscription(thread, feed, DXFG_EVENT_QUOTE); | ||
dxfg_feed_event_listener_t *listener = dxfg_DXFeedEventListener_new(thread, &c_print, nullptr); | ||
dxfg_DXFeedSubscription_addEventListener(thread, subscription, listener); | ||
|
||
dxfg_endpoint_state_change_listener_t* stateListener = | ||
dxfg_PropertyChangeListener_new(thread, endpoint_state_change_listener, nullptr); | ||
dxfg_DXEndpoint_addStateChangeListener(thread, endpoint, stateListener); | ||
dxfg_endpoint_state_change_listener_t *stateListener = | ||
dxfg_PropertyChangeListener_new(thread, endpoint_state_change_listener, nullptr); | ||
dxfg_DXEndpoint_addStateChangeListener(thread, endpoint, stateListener); | ||
|
||
dxfg_string_symbol_t symbolAAPL; | ||
symbolAAPL.supper.type = STRING; | ||
symbolAAPL.symbol = symbol; | ||
dxfg_string_symbol_t symbolAAPL; | ||
symbolAAPL.supper.type = STRING; | ||
symbolAAPL.symbol = symbol; | ||
|
||
dxfg_DXFeedSubscription_setSymbol(thread, subscription, &symbolAAPL.supper); | ||
std::chrono::seconds seconds(10); | ||
std::this_thread::sleep_for(seconds); | ||
dxfg_DXFeedSubscription_setSymbol(thread, subscription, &symbolAAPL.supper); | ||
std::chrono::seconds seconds(10); | ||
std::this_thread::sleep_for(seconds); | ||
|
||
dxfg_DXFeedSubscription_close(thread, subscription); | ||
dxfg_DXEndpoint_removeStateChangeListener(thread, endpoint, stateListener); | ||
dxfg_DXEndpoint_close(thread, endpoint); | ||
dxfg_JavaObjectHandler_release(thread, &stateListener->handler); | ||
dxfg_JavaObjectHandler_release(thread, &listener->handler); | ||
dxfg_JavaObjectHandler_release(thread, &subscription->handler); | ||
dxfg_JavaObjectHandler_release(thread, &endpoint->handler); | ||
dxfg_DXFeedSubscription_close(thread, subscription); | ||
dxfg_DXEndpoint_removeStateChangeListener(thread, endpoint, stateListener); | ||
dxfg_DXEndpoint_close(thread, endpoint); | ||
dxfg_JavaObjectHandler_release(thread, &stateListener->handler); | ||
dxfg_JavaObjectHandler_release(thread, &listener->handler); | ||
dxfg_JavaObjectHandler_release(thread, &subscription->handler); | ||
dxfg_JavaObjectHandler_release(thread, &endpoint->handler); | ||
} | ||
|
||
int main(int argc, char** argv) { | ||
// load cmd args | ||
const int defaultArgSize = 3; | ||
if (argc < defaultArgSize) { | ||
std::cerr << "Error: expected 2 args: <address:port, symbol>" << std::endl; | ||
return -1; | ||
} | ||
int main(int argc, char **argv) { | ||
// load cmd args | ||
const int defaultArgSize = 3; | ||
if (argc < defaultArgSize) { | ||
std::cerr << "Error: expected 2 args: <address:port, symbol>" << std::endl; | ||
return -1; | ||
} | ||
|
||
const auto address = argv[1]; // "demo.dxfeed.com:7300"; | ||
const auto symbol = argv[2]; // "APPL"; | ||
const auto address = argv[1]; // "demo.dxfeed.com:7300"; | ||
const auto symbol = argv[2]; // "APPL"; | ||
|
||
auto thread = create_thread(); | ||
if (thread != nullptr) { | ||
dxEndpointSubscription(thread, address, symbol); | ||
} | ||
auto thread = create_thread(); | ||
if (thread != nullptr) { | ||
dxEndpointSubscription(thread, address, symbol); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.