Skip to content

Commit

Permalink
[DXFC-402] Implement adding multiple symbols and removing symbols. (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnatolyKalin committed May 30, 2023
1 parent af92d6f commit e412497
Show file tree
Hide file tree
Showing 311 changed files with 6,228 additions and 90,829 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ cmake-build-*/
.idea/
/doc/html/
/doc/latex/

.PVS-Studio/
*.PVS-Studio.*
79 changes: 52 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,76 +10,90 @@ set(CMAKE_C_STANDARD 11)

cmake_policy(SET CMP0135 NEW)

if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(DXFC_IS_ROOT_PROJECT ON)
else()
else ()
set(DXFC_ROOT_PROJECT OFF)
endif()
endif ()

option(DXFC_BUILD_UNIT_TESTS "" ON)

option(DXFC_USE_DXFEED_GRAAL_NATIVE_API_GITHUB "" OFF)
set(DXFEED_GRAAL_NATIVE_API_GITHUB_VERSION "v1.0.5" CACHE STRING "")
set(DXFEED_GRAAL_NATIVE_API_GITHUB_ARCHIVE_VERSION "1.0.0" CACHE STRING "")
set(DXFEED_GRAAL_NATIVE_API_GITHUB_BASE_URL "https://github.com/ttldtor/dxfeed-graal-native-api/releases/download/" CACHE STRING "")

option(DXFC_USE_DXFEED_GRAAL_NATIVE_API_JFROG "" ON)
set(DXFEED_GRAAL_NATIVE_API_VERSION "0.4.0" CACHE STRING "")
set(DXFEED_GRAAL_NATIVE_API_JFROG_BASE_URL "https://dxfeed.jfrog.io/artifactory/maven-open/com/dxfeed/graal-native-api/" CACHE STRING "")
option(DXFC_USE_DXFEED_GRAAL_NATIVE_SDK_JFROG "" ON)
set(DXFEED_GRAAL_NATIVE_SDK_VERSION "1.0.0" CACHE STRING "")
set(DXFEED_GRAAL_NATIVE_SDK_JFROG_BASE_URL "https://dxfeed.jfrog.io/artifactory/maven-open/com/dxfeed/graal-native-sdk/" CACHE STRING "")

include(FetchContent)

if (DEFINED ENV{DXFEED_GRAAL_NATIVE_API_URL})
FetchContent_Declare(DxFeedGraalNativeApi URL $ENV{DXFEED_GRAAL_NATIVE_API_URL})
if (DEFINED ENV{DXFEED_GRAAL_NATIVE_SDK_URL})
FetchContent_Declare(DxFeedGraalNativeSdk URL $ENV{DXFEED_GRAAL_NATIVE_SDK_URL})
else ()
if (DXFC_USE_DXFEED_GRAAL_NATIVE_API_GITHUB)
set(DXFEED_GRAAL_NATIVE_API_URL "${DXFEED_GRAAL_NATIVE_API_GITHUB_BASE_URL}${DXFEED_GRAAL_NATIVE_API_GITHUB_VERSION}/dxfeed-graal-native-api-${DXFEED_GRAAL_NATIVE_API_GITHUB_ARCHIVE_VERSION}")
elseif (DXFC_USE_DXFEED_GRAAL_NATIVE_API_JFROG)
set(DXFEED_GRAAL_NATIVE_API_URL "${DXFEED_GRAAL_NATIVE_API_JFROG_BASE_URL}${DXFEED_GRAAL_NATIVE_API_VERSION}/graal-native-api-${DXFEED_GRAAL_NATIVE_API_VERSION}")
if (DXFC_USE_DXFEED_GRAAL_NATIVE_SDK_JFROG)
set(DXFEED_GRAAL_NATIVE_SDK_URL "${DXFEED_GRAAL_NATIVE_SDK_JFROG_BASE_URL}${DXFEED_GRAAL_NATIVE_SDK_VERSION}/graal-native-sdk-${DXFEED_GRAAL_NATIVE_SDK_VERSION}")
endif ()

if (WIN32)
set(DXFEED_GRAAL_NATIVE_API_URL ${DXFEED_GRAAL_NATIVE_API_URL}-amd64-windows.zip)
set(DXFEED_GRAAL_NATIVE_SDK_URL ${DXFEED_GRAAL_NATIVE_SDK_URL}-amd64-windows.zip)
elseif (APPLE)
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "arm64")
set(DXFEED_GRAAL_NATIVE_API_URL ${DXFEED_GRAAL_NATIVE_API_URL}-aarch64-osx.zip)
set(DXFEED_GRAAL_NATIVE_SDK_URL ${DXFEED_GRAAL_NATIVE_SDK_URL}-aarch64-osx.zip)
else ()
set(DXFEED_GRAAL_NATIVE_API_URL ${DXFEED_GRAAL_NATIVE_API_URL}-x86_64-osx.zip)
set(DXFEED_GRAAL_NATIVE_SDK_URL ${DXFEED_GRAAL_NATIVE_SDK_URL}-x86_64-osx.zip)
endif ()
elseif (UNIX)
set(DXFEED_GRAAL_NATIVE_API_URL ${DXFEED_GRAAL_NATIVE_API_URL}-amd64-linux.zip)
set(DXFEED_GRAAL_NATIVE_SDK_URL ${DXFEED_GRAAL_NATIVE_SDK_URL}-amd64-linux.zip)
else ()
message(ERROR "Unknown platform!")
endif ()

FetchContent_Declare(DxFeedGraalNativeApi URL ${DXFEED_GRAAL_NATIVE_API_URL})
FetchContent_Declare(DxFeedGraalNativeSdk URL ${DXFEED_GRAAL_NATIVE_SDK_URL})
endif ()

FetchContent_MakeAvailable(DxFeedGraalNativeApi)
# DxFeedGraalNativeApi_SOURCE_DIR
FetchContent_MakeAvailable(DxFeedGraalNativeSdk)
# DxFeedGraalNativeSdk_SOURCE_DIR

if (DXFC_USE_CONAN)
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
endif ()

add_subdirectory(third_party/utfcpp-3.2.3)
add_subdirectory(third_party/fmt-9.1.0)
add_subdirectory(third_party/fmt-10.0.0)

# find_package(utf8cpp)
# find_package(fmt)

set(dxFeedNativeAPIInternalSources
src/internal/CEntryPointErrors.cpp
src/internal/Isolate.cpp
src/internal/JavaObjectHandler.cpp
src/internal/EventClassList.cpp
src/internal/SymbolList.cpp
src/internal/Common.cpp
)

set(dxFeedNativeAPIInternalUtilsSources
src/internal/utils/StringUtils.cpp
)

set(dxFeedNativeAPIInternalUtilsDebugSources
src/internal/utils/debug/Debug.cpp
)

set(dxFeedNativeAPIAPISources
src/api/DXEndpoint.cpp
src/api/DXFeed.cpp
src/api/DXFeedSubscription.cpp
)

set(dxFeedNativeAPIAPIOsubSources
src/api/osub/WildcardSymbol.cpp
)

set(dxFeedNativeAPISymbolsSources
src/symbols/SymbolMapper.cpp
src/symbols/StringSymbol.cpp
src/symbols/SymbolWrapper.cpp
)

set(dxFeedNativeAPISystemSources
src/system/System.cpp
)
Expand Down Expand Up @@ -118,19 +132,30 @@ set(dxFeedNativeAPIEventOptionSources

add_library(dxFeedGraalCxxApi
${dxFeedNativeAPIInternalSources}
${dxFeedNativeAPIInternalUtilsSources}
${dxFeedNativeAPIInternalUtilsDebugSources}
${dxFeedNativeAPIAPISources}
${dxFeedNativeAPIAPIOsubSources}
${dxFeedNativeAPISymbolsSources}
${dxFeedNativeAPISystemSources}
${dxFeedNativeAPIEventSources}
${dxFeedNativeAPIEventMarketSources}
${dxFeedNativeAPIEventOptionSources}
src/api.cpp
)

add_library(dxFeedGraalCxxApi_Clang INTERFACE)

if ((${CMAKE_CXX_COMPILER_ID} MATCHES "AppleClang") OR (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang"))
# Ignore undefined template var warning
target_compile_options(dxFeedGraalCxxApi_Clang INTERFACE -Wno-undefined-var-template)
endif ()

target_include_directories(dxFeedGraalCxxApi PUBLIC include)
target_link_libraries(dxFeedGraalCxxApi PUBLIC DxFeedGraalNativeApi utf8cpp fmt::fmt)
target_link_libraries(dxFeedGraalCxxApi PUBLIC DxFeedGraalNativeSdk utf8cpp fmt::fmt PUBLIC dxFeedGraalCxxApi_Clang)

add_custom_command(TARGET dxFeedGraalCxxApi POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:DxFeedGraalNativeApi> $<TARGET_FILE_DIR:dxFeedGraalCxxApi>)
$<TARGET_FILE:DxFeedGraalNativeSdk> $<TARGET_FILE_DIR:dxFeedGraalCxxApi>)

if (DXFC_BUILD_UNIT_TESTS)
include(CTest)
Expand Down
7 changes: 3 additions & 4 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

## Compile-time

- [dxFeed Graal Native SDK](https://github.com/dxFeed/dxfeed-graal-native-sdk) v0.4.0
- [dxFeed Graal Native SDK](https://github.com/dxFeed/dxfeed-graal-native-sdk) v1.0.0
- [utfcpp](https://github.com/nemtrif/utfcpp) v3.2.3
- [fmt](https://github.com/fmtlib/fmt) v9.1.0
- [fmt](https://github.com/fmtlib/fmt) v10.0.0
- [doctest](https://github.com/doctest/doctest) v2.4.11 (Tests)

## Run-time

- [dxFeed Graal Native SDK](https://github.com/dxFeed/dxfeed-graal-native-sdk) v0.4.0
- [fmt](https://github.com/fmtlib/fmt) v9.1.0 (C++)
- [dxFeed Graal Native SDK](https://github.com/dxFeed/dxfeed-graal-native-sdk) v1.0.0
- [doctest](https://github.com/doctest/doctest) v2.4.11 (Tests)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ be downloaded from [Release](https://github.com/dxFeed/dxfeed-graal-cxx-api/rele
by [dxPrice](http://www.devexperts.com/en/products/price.html) model-free computation
- [x] [Underlying](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/option/Underlying.html) is a snapshot of computed
values available for an option underlying symbol based on the market’s option prices
- [x] [Configuration](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/misc/Configuration.html) is an event with an
- [ ] [Configuration](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/misc/Configuration.html) is an event with an
application-specific attachment
- [x] [Message](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/misc/Message.html) is an event with an
- [ ] [Message](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/misc/Message.html) is an event with an
application-specific attachment

### Subscription Symbols
Expand All @@ -278,7 +278,7 @@ be downloaded from [Release](https://github.com/dxFeed/dxfeed-graal-cxx-api/rele
represents subscription to time-series events
- [ ] [IndexedSubscriptionSymbol](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/api/osub/IndexedEventSubscriptionSymbol.html) -
represents subscription to a specific source of indexed events
- [ ] [WildcardSymbol.ALL](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/api/osub/WildcardSymbol.html) - represents a
- [x] [WildcardSymbol.ALL](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/api/osub/WildcardSymbol.html) - represents a
*wildcard* subscription to all events of the specific event type
- [ ] [CandleSymbol](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/candle/CandleSymbol.html) - symbol used
with [DXFeedSubscription](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/api/DXFeedSubscription.html) class to
Expand Down
14 changes: 13 additions & 1 deletion include/dxfeed_graal_cpp_api/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,29 @@

#pragma once

#include "dxfeed_graal_cpp_api/internal/managers/ErrorHandlingManager.hpp"
#include "internal/CEntryPointErrors.hpp"
#include "internal/Common.hpp"
#include "internal/Enum.hpp"
#include "internal/EventClassList.hpp"
#include "internal/Id.hpp"
#include "internal/JavaObjectHandler.hpp"
#include "internal/NonCopyable.hpp"
#include "internal/RawListWrapper.hpp"
#include "internal/SymbolList.hpp"
#include "internal/context/ApiContext.hpp"
#include "internal/managers/DXEndpointManager.hpp"
#include "internal/managers/DXFeedSubscriptionManager.hpp"
#include "internal/managers/EntityManager.hpp"
#include "internal/managers/ErrorHandlingManager.hpp"
#include "internal/utils/StringUtils.hpp"
#include "internal/utils/debug/Debug.hpp"

#include "api/DXEndpoint.hpp"
#include "api/DXFeed.hpp"
#include "api/DXFeedSubscription.hpp"
#include "api/osub/WildcardSymbol.hpp"
#include "event/DXEvent.hpp"
#include "symbols/StringSymbol.hpp"
#include "symbols/SymbolMapper.hpp"
#include "symbols/SymbolWrapper.hpp"
#include "system/System.hpp"
Loading

0 comments on commit e412497

Please sign in to comment.