Compare commits

...
Author SHA1 Message Date
John Colvin 2e42edc399 build: Port build_sparkd.py over from development branch 2024-08-30 15:29:59 +00:00
John Colvin a8b560475a fix build (sparkd): Fix typo BUILD_ADMIN_WEB_APP -> BUILD_WEB 2024-08-30 15:29:36 +00:00
John Colvin bee0f950ba fix build (sparkd): Use vcpkg toolchain 2024-08-30 15:28:59 +00:00
John Colvin 6f1dc66172 fix build: Fix sparkd rpath and include dirs
* Qualify sparkd include dirs w/ BUILD_INTERFACE
  - INTERFACE_INCLUDE_DIRECTORIES cannot be prefixed in the source dir
    (cmake doesn't allow it)
2024-08-30 15:26:42 +00:00
John Colvin 647737cd14 fix add emumba lic and install script 2024-08-30 15:21:32 +00:00
John Colvin d41ba5643d fix build: Include <cstdint> in a few places 2024-08-30 14:44:49 +00:00
John Colvin 22cbdcebae fix address trivial werrors 2024-08-30 14:43:33 +00:00
John Colvin 634e24bd37 fix build: Remove erroneous file(GLOB_RECURSE) call 2024-08-30 14:42:44 +00:00
John Colvin 6697185376 build (sparkd): Update fmt to 10.2.1 2024-08-30 14:42:17 +00:00
John Colvin d21dc56c6b fix build: Update fmt integration w/ spartan logger
The previous impl broke when we updated fmt to 10.2.1
2024-08-30 14:41:41 +00:00
John Colvin fe5ff75855 fix build: Add a few includes, suppress some werrors
Not sure how this slipped through the cracks, but I'm guessing the build
broke when we upgraded the cpp compilers (to clang 17 and gcc 13).

* Include <cstdint> in a few places
* Suppress -Wstringop-overflow in sparkd-gcc-release build
* Change const char * param to explicit std::string for proper type
  deduction in call to 'std::make_tuple'. For some reason, the gcc build
  was failing with an array-bounds werror (changing the arg fixed it).
2024-08-29 17:32:59 +00:00
John Colvin ad0a1991b2 fix build: Make 'pragma once' the first line in Dispatcher.h
Otherwise we get redefinition errors include caused by duplicate include.
2024-08-29 17:29:16 +00:00
John Colvin 375d349113 cleanup: Remove leftover CMakeDeps
From web build
2024-08-29 17:20:16 +00:00
John Colvin 707914af16 fix build: Address trivial werrors after upgrading to C++ 20
All werrors were about implicit 'this' captures in lambdas
2024-08-29 16:24:05 +00:00
John Colvin dd2da2a1f9 build: Benign changes to remove errors in clang 15 2024-08-29 16:19:56 +00:00
John Colvin 8bab682b5e Add emumba lic and install script for devcontainer 2024-08-29 11:43:58 -04:00
John Colvin 3966a7886e Change externals url from ssh to https style
So we don't need ssh keys to clone it (the builtin credential manager
makes https authentication safe/easy)
2024-08-29 11:12:53 -04:00
John Colvin 033bef4ab6 Add gitattributes to ensure proper line endings for various file types 2024-08-29 10:35:31 -04:00
John Colvin 18a5fd4b1d fix build (client): Change 'WIN32' macros to '_WIN32'
Not sure exactly how this broke, but the WIN32 macro is no longer defined.
2024-08-29 10:25:34 -04:00
John Colvin 6dce2fcde1 refactor: Remove redundant optional.h
It was from a time when Windows std didn't provide the 'optional' header
2024-08-29 10:24:22 -04:00
John Colvin 933faf93c1 Update externals
We removed some deps that are now managed by vcpkg
2024-08-29 10:16:55 -04:00
John Colvin 8b73367805 Set up devcontainer for sparkd
With config from development branch
2024-08-29 10:15:53 -04:00
John Colvin 6d69adb891 Port build configuration over from development branch
It's cleaner here, and makes transitioning between branches easier.
The new build_spark.py uses cmake --preset and dotnet build.
2024-08-29 10:15:53 -04:00
John Colvin aee8ee4033 build: Update nuget packages in Spark.csproj 2024-08-28 23:46:03 -04:00
John Colvin dcc84567c6 fix build (spark client): Remove deps on preview features
Namely, the 'Sum' extension function for an IEnumerable of tuples.
2024-08-28 23:45:33 -04:00
John Colvin 8c2e80097e build (windows): Update to c++ 20 2024-08-28 23:45:02 -04:00
John Colvin 066c950e67 fix build (windows): Update libfmt to 10.2.1 2024-08-28 23:44:25 -04:00
John Colvin 238494989d fix build: Remove unnecessary cpp files from win build 2024-08-28 23:44:19 -04:00
John Colvin 400318af23 build: Add vcpkg submodule 2024-08-28 23:44:07 -04:00
John Colvin aec2b875cb cleanup: Remove unused docker submodules 2024-08-28 23:43:39 -04:00
John Colvin d810b1eee6 Copy 'write_tag_block.sh' over from development
This script is used when we create the devcontainer
2024-01-12 11:55:13 -05:00
John Colvin 027942d206 devcontainer: Name mount dir w/ 'devcontainerId'
To ensure it is unique on the main host (i.e., outside the container). Get rid
of devcontainer_initialize.sh, all it did was run "mkdir". Something this
trivial can be inlined in the devcontainer.json (less indirection this way).
2024-01-12 11:51:00 -05:00
John Colvin 81d07028f3 Gitignore the '.devcontainer' dir (not the json file)
We actually do track a 'devcontainer.json' file (to keep as a template). We
just don't keep it in the '.devcontainer' dir, for the same reason we don't
track the '.vscode' dir: so devs can tailor it to their specific needs.
2024-01-12 11:50:58 -05:00
John Colvin 435a5af0a7 docker: Install kitware-archive-keyring to keep key in sync (for cmake) 2024-01-12 11:50:13 -05:00
124 changed files with 1960 additions and 1051 deletions

No files matched your search

+129
View File
@@ -0,0 +1,129 @@
FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive
# Note installations that take a while (more than 10s)
RUN apt-get update
RUN apt-get install -y ca-certificates
RUN apt-get install -y ccache
RUN apt-get install -y curl
RUN apt-get install -y fish
RUN apt-get install -y gdb
# git-all: ~250s
RUN apt-get install -y git-all
RUN apt-get install -y gnupg
# liblttng-ust-dev: ~30s
RUN apt-get install -y liblttng-ust-dev
RUN apt-get install -y libssh2-1-dev
RUN apt-get install -y locales
RUN apt-get install -y ninja-build
# openssh-server: ~40s
RUN apt-get install -y openssh-server
RUN apt-get install -y pkg-config
RUN apt-get install -y software-properties-common
RUN apt-get install -y sudo
RUN apt-get install -y tzdata
RUN apt-get install -y vim
RUN apt-get install -y zip
# Python: ~30s
RUN apt-get install -y \
python3-pip \
python3-venv \
&& python3 -m pip install --upgrade pip
# GCC
ARG gcc_major=13
RUN \
add-apt-repository ppa:ubuntu-toolchain-r/test \
&& apt-get update \
&& apt-get install -y g++-$gcc_major
# Clang
ARG clang_major=17
RUN \
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key 2> /dev/null \
| gpg --dearmor - \
| tee /usr/share/keyrings/llvm-snapshot.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-$clang_major main" \
| tee -a "/etc/apt/sources.list.d/llvm.list" \
&& apt-get update \
&& apt-get install -y \
clang-$clang_major \
clang-format-$clang_major \
clangd-$clang_major
# CMake
RUN \
curl -fsSL https://apt.kitware.com/keys/kitware-archive-latest.asc 2> /dev/null \
| gpg --dearmor - \
| tee /usr/share/keyrings/kitware-archive-keyring.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \
| tee /etc/apt/sources.list.d/kitware.list > /dev/null \
&& apt-get update \
&& apt-get install -y cmake
# Dotnet
RUN apt-get update && apt-get install -y dotnet7
# Node
ARG node_major=18
RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_major.x nodistro main" \
| tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs
# Emumba (deps)
RUN apt-get update && apt-get -y install rapidjson-dev
# Emumba
COPY emumba /emumba
RUN dpkg -i /emumba/emumba-deribit-connector-3.3.1-Linux.LICENSE_DISABLED.deb \
&& rm -r /emumba
# Pcap
RUN apt-get update && apt-get install -y libpcap0.8-dev
RUN apt-get update && apt-get install -y \
docker.io \
docker-compose \
docker-compose-v2
# Set up default executables (update-alternatives)
RUN \
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$clang_major 100; \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-$clang_major 100; \
update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-$clang_major 100; \
update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-$clang_major 100; \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$gcc_major 100; \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-$gcc_major 100
# Add compiler symlinks for ccache
RUN \
ln -s /usr/bin/ccache /usr/local/bin/clang; \
ln -s /usr/bin/ccache /usr/local/bin/clang++; \
ln -s /usr/bin/ccache /usr/local/bin/clang-$clang_major; \
ln -s /usr/bin/ccache /usr/local/bin/clang++-$clang_major; \
ln -s /usr/bin/ccache /usr/local/bin/gcc; \
ln -s /usr/bin/ccache /usr/local/bin/g++
RUN locale-gen en_US.UTF-8
ARG docker_user="bts"
ARG docker_uid="1000"
ARG docker_pass="bts"
RUN \
groupadd -g "$docker_uid" "$docker_user" \
&& useradd \
-m \
-u "$docker_uid" \
-g "$docker_uid" \
-G sudo \
--password "$(openssl passwd -1 "$docker_pass")" \
"$docker_user"
RUN usermod -aG docker "$docker_user"
+43
View File
@@ -0,0 +1,43 @@
{
"dockerFile": "Dockerfile",
// Creates local dir to mount to HOME in docker
"initializeCommand": "mkdir -p ${localEnv:HOME}/.bts/devcontainer-mounts/${devcontainerId}",
"hostRequirements": {
"memory": "4gb",
"storage": "6gb"
},
"postCreateCommand": "/home/bts/spark/docker/sparkd/dev/devcontainer_post_create.sh",
"containerUser": "bts",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/bts/spark,type=bind",
"workspaceFolder": "/home/bts/spark",
"updateRemoteUserUID": true,
"shutdownAction": "none",
// Note: If running multiple containers on the same host, each must use a
// unique set of ports. Usually we just add 1000 to each port as needed. For
// example, if 8000-8003 is taken, go with 9000-9003, then 10000-10003, etc.
"runArgs": [
"--shm-size",
"2gb",
"--network",
"host"
],
"mounts": [
"source=${localEnv:HOME}/.bts/devcontainer-mounts/${devcontainerId},target=/home/bts,type=bind",
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
],
"customizations": {
"vscode": {
"settings": {
"clangd.arguments": [
"--compile-commands-dir=${workspaceFolder}/build/clang/debug"
]
},
"extensions": [
"eamodio.gitlens",
"llvm-vs-code-extensions.vscode-clangd",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools"
]
}
}
}
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
this_dir="$(realpath "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")"
sudo dpkg -i "$this_dir/emumba-deribit-connector-3.3.1-Linux.LICENSE_DISABLED.deb"
+4
View File
@@ -0,0 +1,4 @@
*.cmd text=auto eol=crlf
*.cs text=auto eol=crlf
*.sh text=auto eol=lf
*.py text=auto eol=lf
+2 -1
View File
@@ -42,7 +42,7 @@ trace_data/
/.ignore
*.rej
.clangd/
*CMakeDeps.cmake
*CMakeDeps*.cmake
/sniper.ipynb
/src/.clang-format
/src/server/sparkd/cmds/spartan/analysis/.ipynb_checkpoints
@@ -51,3 +51,4 @@ trace_data/
/.venv*/*
.cache/
src/web/api/tsconfig.*.g.json
**/.devcontainer
+4 -7
View File
@@ -1,9 +1,6 @@
[submodule "externals"]
path = externals
url = git@bitbucket.org:bluetradesys/externals.git
[submodule "docker/linux"]
path = docker/linux
url = git@bitbucket.org:bluetradesys/linux_docker.git
[submodule "docker/windows"]
path = docker/windows
url = git@bitbucket.org:bluetradesys/windows_docker.git
url = https://bitbucket.org/bluetradesys/externals.git
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
+23 -37
View File
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.12)
project(spark)
set(CMAKE_CXX_STANDARD 20)
if(WIN32)
set(platform "windows")
@@ -13,16 +14,24 @@ set(
CACHE
STRING
"External dependencies root folder (should contain folders: lib, bin, include")
set(SPARK_PYTHON "${EXTERNALS_ROOT}/python")
set(SPARK_BIN "${EXTERNALS_ROOT}/bin")
set(SPARK_INCLUDE "${EXTERNALS_ROOT}/include")
set(SPARK_LIB "${EXTERNALS_ROOT}/lib/${CMAKE_BUILD_TYPE}")
set(EXTERNALS_BIN "${EXTERNALS_ROOT}/bin")
set(EXTERNALS_INCLUDE "${EXTERNALS_ROOT}/include")
set(EXTERNALS_LIB "${EXTERNALS_ROOT}/lib/$<CONFIG>")
set(BUILD_DOCS OFF CACHE BOOL "Build documentation")
set(BUILD_SDK OFF CACHE BOOL "Build the sdk")
set(BUILD_WEB ON CACHE BOOL "Build the web server")
set(EXPORT_MD_CONSUMER OFF CACHE BOOL "Export (extern) C functions for MD consumer interop")
if (WIN32)
set(BUILD_SPARKD OFF CACHE BOOL "Build sparkd")
set(BUILD_WEB OFF CACHE BOOL "Build the web server")
else()
set(BUILD_SPARKD ON CACHE BOOL "Build sparkd")
set(BUILD_WEB ON CACHE BOOL "Build the web server")
endif()
include_directories(BEFORE SYSTEM ${SPARK_INCLUDE} ${EXTERNALS_ROOT}/include/zlib)
link_directories(${SPARK_LIB})
include_directories(BEFORE SYSTEM ${EXTERNALS_INCLUDE} ${EXTERNALS_ROOT}/include/zlib)
link_directories(${EXTERNALS_LIB})
add_compile_definitions(EXPORT_MD_CONSUMER="${EXPORT_MD_CONSUMER}")
if(WIN32)
# flags
set(
@@ -50,10 +59,6 @@ if(WIN32)
# subdirs
add_subdirectory(src/lib)
else()
# make sparkd look for libspark.so in its directory
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH ".")
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install/${CMAKE_BUILD_TYPE}/sparkd")
add_compile_definitions(SPARK_ENABLE_CCAPI)
add_compile_definitions(CCAPI_ENABLE_SERVICE_MARKET_DATA)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_FTX)
@@ -77,37 +82,18 @@ else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wno-undef")
# subdirs
add_subdirectory(src/server/sparkd)
if (BUILD_SPARKD)
add_subdirectory(src/server/sparkd)
add_subdirectory(src/data_files)
endif()
add_subdirectory(src/lib)
if (BUILD_WEB)
add_subdirectory(src/web)
endif()
add_subdirectory(doc/user)
if(BUILD_DOCS)
add_subdirectory(doc/user)
endif()
if(BUILD_SDK)
add_subdirectory(src/sdk)
endif()
add_subdirectory(src/data_files)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/server
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/server
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/src/server/sparkd/sparkd ${CMAKE_BINARY_DIR}/server
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/web ${CMAKE_BINARY_DIR}/server
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/data_files ${CMAKE_BINARY_DIR}/server
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/src/lib/libspark.so ${CMAKE_BINARY_DIR}/server
COMMAND
ln ARGS -sf
${EXTERNALS_ROOT}/lib/Release/libOnixS.IceImpactMulticastPriceFeedHandlerCpp.so.3.16.0.0
${CMAKE_BINARY_DIR}/server
COMMAND ln ARGS -sf ${EXTERNALS_ROOT}/lib/Release/libACE-5.7.5.so ${CMAKE_BINARY_DIR}/server
COMMAND mkdir ARGS -p ${CMAKE_BINARY_DIR}/server/plugins
COMMENT "Creating server runtime layout"
DEPENDS sparkd data_files_dir)
add_custom_target(server_layout ALL DEPENDS ${CMAKE_BINARY_DIR}/server)
install(DIRECTORY "${CMAKE_BINARY_DIR}/server/plugins" DESTINATION bin)
install(FILES "${CMAKE_SOURCE_DIR}/externals/linux/lib/${CMAKE_BUILD_TYPE}/libACE-5.7.5.so" DESTINATION bin)
install(FILES "${CMAKE_SOURCE_DIR}/externals/linux/lib/${CMAKE_BUILD_TYPE}/libOnixS.IceImpactMulticastPriceFeedHandlerCpp.so.3.16.0.0" DESTINATION bin)
install(FILES "${CMAKE_SOURCE_DIR}/externals/src/emumba/sparkd.lic" DESTINATION bin)
endif()
+216
View File
@@ -0,0 +1,216 @@
{
"version": 4,
"cmakeMinimumRequired": {
"major": 3,
"minor": 23,
"patch": 0
},
"configurePresets": [
{
"name": "spark",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/build/${presetName}",
"environment": {
"SPARK_CMAKE_CXX_FLAGS": "/MP /WX /wd4250 /wd4251 /wd4244 /wd4267 /wd4355 /wd4275 /wd4345 /bigobj /EHsc /DCURL_STATICLIB /D_WINSOCK_DEPRECATED_NO_WARNINGS /D__TBB_NO_IMPLICIT_LINKAGE /DBOOST_ALL_NO_LIB /std:c++20 /D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600"
},
"cacheVariables": {
"CMAKE_CXX_FLAGS": "$env{SPARK_CMAKE_CXX_FLAGS}",
"CMAKE_CXX_FLAGS_DEBUG": "$env{SPARK_CMAKE_CXX_FLAGS} /MTd",
"CMAKE_CXX_FLAGS_RELEASE": "$env{SPARK_CMAKE_CXX_FLAGS} /MT",
"CMAKE_CXX_STANDARD": "20",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
"CMAKE_SHARED_LINKER_FLAGS_DEBUG": "/DEBUG",
"CMAKE_SHARED_LINKER_FLAGS_RELEASE": "/OPT:REF /OPT:ICF /LTCG",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake",
"EXTERNALS_ROOT": "${sourceDir}/externals/windows",
"CONFIG_DEFAULTS_PATH": "config/defaults/*.conf",
"DOTNET_BINARY_DIR": "${sourceDir}/build/$<CONFIG>/bin/net7.0;${sourceDir}/build/$<CONFIG>/bin/net7.0-windows",
"EXPORT_MD_CONSUMER": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "sparkd",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"platform": "",
"CMAKE_CXX_STANDARD": "20",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
"CMAKE_EXE_LINKER_FLAGS": "-Wno-undef",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake",
"CONFIG_DEFAULTS_PATH": "config/defaults/*.conf",
"EXTERNALS_ROOT": "${sourceDir}/externals/linux",
"BUILD_SDK": {
"type": "BOOL",
"value": "OFF"
},
"BUILD_WEB": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "sparkd-debug",
"inherits": "sparkd",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": {
"type": "BOOL",
"value": "ON"
},
"CCAPI_LOG_LEVEL": "Info"
}
},
{
"name": "sparkd-release",
"inherits": "sparkd",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CCAPI_LOG_LEVEL": "Warn"
}
},
{
"name": "sparkd-debug-clang",
"inherits": "sparkd-debug",
"displayName": "Sparkd (Debug | Clang)",
"description": "Debug build compiled w/ clang",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_CXX_FLAGS_DEBUG": "-g -fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers --std=c++20 -fdiagnostics-color -DDEBUG"
}
},
{
"name": "sparkd-debug-gcc",
"inherits": "sparkd-debug",
"displayName": "Sparkd (Debug | Gcc)",
"description": "Debug build compiled w/ gcc",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_CXX_FLAGS_DEBUG": "-g -fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers --std=c++20 -fdiagnostics-color -Wno-stringop-overread -DDEBUG"
}
},
{
"name": "sparkd-release-clang",
"inherits": "sparkd-release",
"displayName": "Sparkd (Release | Clang)",
"description": "Release build compiled w/ clang",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_CXX_FLAGS_RELEASE": "-fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers --std=c++20 -fdiagnostics-color -fno-omit-frame-pointer -DNDEBUG -O3"
}
},
{
"name": "sparkd-release-gcc",
"inherits": "sparkd-release",
"displayName": "Sparkd (Release | Gcc)",
"description": "Release build compiled w/ gcc",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_CXX_FLAGS_RELEASE": "-fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers -Wno-stringop-overflow --std=c++20 -fdiagnostics-color -Wno-stringop-overread -Wno-maybe-uninitialized -fno-omit-frame-pointer -DNDEBUG -O3"
}
}
],
"buildPresets": [
{
"name": "spark",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"hidden": true
},
{
"name": "spark-debug",
"displayName": "Spark (Debug)",
"inherits": "spark",
"configurePreset": "spark",
"configuration": "Debug"
},
{
"name": "spark-release",
"displayName": "Spark (Release)",
"inherits": "spark",
"configurePreset": "spark",
"configuration": "Release"
},
{
"name": "sparkd",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"hidden": true
},
{
"name": "sparkd-debug-clang",
"configurePreset": "sparkd-debug-clang",
"displayName": "Sparkd (Debug | Clang)",
"inherits": "sparkd"
},
{
"name": "sparkd-debug-clang-j6",
"configurePreset": "sparkd-debug-clang",
"displayName": "Sparkd (Debug | Clang | jobs=6)",
"inherits": "sparkd",
"jobs": 6
},
{
"name": "sparkd-debug-gcc",
"configurePreset": "sparkd-debug-gcc",
"displayName": "Sparkd (Debug | Gcc)",
"inherits": "sparkd"
},
{
"name": "sparkd-release-clang",
"configurePreset": "sparkd-release-clang",
"displayName": "Sparkd (Release | Clang)",
"inherits": "sparkd"
},
{
"name": "sparkd-release-gcc",
"configurePreset": "sparkd-release-gcc",
"displayName": "Sparkd (Release | Gcc)",
"inherits": "sparkd"
}
]
}
+39
View File
@@ -0,0 +1,39 @@
include(${CMAKE_SOURCE_DIR}/cmake/PackBasic.cmake)
include(GNUInstallDirs)
function(install_basic)
set(_options)
set(_one_value_args)
set(_multi_value_args HEADERS)
cmake_parse_arguments(_ARGS "${_options}" "${_one_value_args}" "${_multi_value_args}" ${ARGN})
if (_ARGS_HEADERS)
set(${PROJECT_NAME}_HEADERS ${_ARGS_HEADERS})
else()
file(
GLOB_RECURSE ${PROJECT_NAME}_HEADERS
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.h
)
endif()
target_sources(${PROJECT_NAME}
PUBLIC
FILE_SET HEADERS FILES ${${PROJECT_NAME}_HEADERS})
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FILE_SET HEADERS DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
EXPORT ${PROJECT_NAME}Targets
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
pack_basic()
endfunction()
+36
View File
@@ -0,0 +1,36 @@
include(CMakePackageConfigHelpers)
function(pack_basic)
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE PROJECT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
if(NOT GIT_FOUND OR PROJECT_VERSION STREQUAL "")
set(PROJECT_VERSION "0.0.0")
endif()
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
endfunction()
+12
View File
@@ -0,0 +1,12 @@
function(print_list var)
set(CMAKE_MESSAGE_INDENT "")
set(_var_str "")
foreach(item IN LISTS ${var})
set(_var_str "${_var_str}\n ${item}")
endforeach()
if ("${ARGN}" STREQUAL "VERBOSE")
message(VERBOSE "***${var}:${_var_str}")
else()
message("***${var}:${_var_str}")
endif()
endfunction()
+2 -2
View File
@@ -1,5 +1,5 @@
set(Protobuf_PROTOC_EXECUTABLE "${SPARK_BIN}/protoc")
set(PROTOBUF_INCLUDE_DIRS "${SPARK_INCLUDE}")
set(Protobuf_PROTOC_EXECUTABLE "${EXTERNALS_BIN}/protoc")
set(PROTOBUF_INCLUDE_DIRS "${EXTERNALS_INCLUDE}")
set(PROTOBUF_STATIC_LIB "libprotobuf")
function(Protobuf_Generate_Cpp SRCS HDRS)
File renamed without changes.
Submodule docker/linux deleted from 6537812262.
+8 -2
View File
@@ -48,9 +48,15 @@ RUN apt-get update && apt-get install -y \
# cmake
RUN \
curl -fsSL https://apt.kitware.com/keys/kitware-archive-latest.asc 2> /dev/null \
| gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg > /dev/null \
&& apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \
| gpg --dearmor - \
| tee /usr/share/keyrings/kitware-archive-keyring.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \
| tee /etc/apt/sources.list.d/kitware.list > /dev/null \
&& apt-get update \
&& rm /usr/share/keyrings/kitware-archive-keyring.gpg \
&& apt-get install -y kitware-archive-keyring \
&& echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs)-rc main" \
| tee -a /etc/apt/sources.list.d/kitware.list >/dev/null \
&& apt-get install -y cmake
# node
+3 -2
View File
@@ -1,6 +1,7 @@
{
"image": "bluetradingsystems/sparkd-dev:latest",
"initializeCommand": "${localWorkspaceFolder}/docker/sparkd/dev/devcontainer_initialize.sh",
// Creates local dir to mount to HOME in docker
"initializeCommand": "mkdir -p ${localEnv:HOME}/.bts/devcontainer-mounts/${devcontainerId}",
"hostRequirements": {
"memory": "4gb",
"storage": "6gb"
@@ -27,6 +28,6 @@
"8003:8003"
],
"mounts": [
"source=${localEnv:HOME}/.sparkd-dev/mounts/sparkd-dev,target=/home/bts,type=bind"
"source=${localEnv:HOME}/.bts/devcontainer-mounts/${devcontainerId},target=/home/bts,type=bind"
]
}
@@ -1,3 +0,0 @@
#!/usr/bin/env bash
mkdir -p "$HOME/.sparkd-dev/mounts/sparkd-dev"
Submodule docker/windows deleted from de7d40c09d.
-5
View File
@@ -4,8 +4,6 @@ VisualStudioVersion = 17.3.32922.545
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "spark_api", "src\client\spark_api\spark_api.csproj", "{DC9A8975-8211-4FC9-A9BA-C8B9D26AD481}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspark", "build\src\lib\libspark.vcxproj", "{FDC3A021-386E-3A2C-A7EB-CBE94A95BE25}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spark", "src\client\spark\Spark.csproj", "{9A4D4D07-1AB6-4B2B-B111-A4F34D6C267E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "sparkcmd", "src\client\sparkcmd\sparkcmd.csproj", "{387566C6-C6F6-412C-A30C-9855BBCB4816}"
@@ -13,9 +11,6 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "spark_core", "src\client\spark_core\spark_core.csproj", "{6E449EB6-20AC-4FA6-B8D9-10F4BB7E1FEE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "spark_sdk", "src\client\spark_sdk\spark_sdk.csproj", "{6963C314-83C4-4667-B0D0-C2F7AE208C29}"
ProjectSection(ProjectDependencies) = postProject
{FDC3A021-386E-3A2C-A7EB-CBE94A95BE25} = {FDC3A021-386E-3A2C-A7EB-CBE94A95BE25}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "spark_test", "src\client\spark_test\spark_test.csproj", "{ECD78CC5-138F-4809-A764-2358C2AC2E82}"
EndProject
@@ -218,10 +218,14 @@ namespace mbts.spark {
background = buy_sell_background_fill_color;
hoverbackground = _mk_hover_bg_brush(dark, _darkbg, 0);
(_num_root_orders, _filled, _quantity) = _root_nodes
.Select(n => (1u, n.filled_quantity(), n.quantity()))
.Sum();
_num_root_orders = 0;
_filled = 0;
_quantity = 0;
foreach (var n in _root_nodes) {
_num_root_orders++;
_filled += n.filled_quantity();
_quantity += n.quantity();
}
if (_num_root_orders == 1) {
var order = _root_nodes.First();
border = _owner.model.order_gateway.factory.get_metadata(order).Color.rgb_brush();
@@ -190,13 +190,24 @@ namespace mbts.analytics {
}
}
void _compute_swipe_sum() =>
(swipe_sum_puts, swipe_sum_calls, swipe_sum_net) = _visible_selected_cells
.SelectMany(tup =>
tup.exps.Select(exp => {
var (p, c, n) = tup.row.get_cell_values(exp);
return (p.if_nan(0), c.if_nan(0), n.if_nan(0));
}))
.Sum();
void _compute_swipe_sum() {
swipe_sum_puts = 0;
swipe_sum_calls = 0;
swipe_sum_net = 0;
foreach (var (row, exps) in _visible_selected_cells) {
foreach (var exp in exps) {
var (p, c, n) = row.get_cell_values(exp);
if (!p.is_nan()) {
swipe_sum_puts += p;
}
if (!c.is_nan()) {
swipe_sum_calls += c;
}
if (!n.is_nan()) {
swipe_sum_net += n;
}
}
}
}
}
}
+32 -20
View File
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
@@ -21,33 +22,39 @@
<RootNamespace>bts</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
<Version>$(major).$(minor).$(patch)</Version>
<Version Condition="'$(version)'=='..'">1.0.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Google.Protobuf" Version="3.24.3" />
<PackageReference Include="IronPython" Version="3.4.1" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="NAudio" Version="2.0.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="OxyPlot.Core" Version="2.1.2" />
<PackageReference Include="OxyPlot.Wpf" Version="2.1.2" />
<PackageReference Include="protobuf-net" Version="3.2.26" />
<PackageReference Include="System.Composition" Version="7.0.0-preview.2.22152.2" />
<PackageReference Include="System.Composition.AttributedModel" Version="7.0.0-preview.2.22152.2" />
<PackageReference Include="System.Composition.Hosting" Version="7.0.0-preview.2.22152.2" />
<PackageReference Include="System.Composition.TypedParts" Version="7.0.0-preview.2.22152.2" />
<PackageReference Include="System.Reactive.Core" Version="5.0.0" />
<PackageReference Include="System.Reactive.Interfaces" Version="5.0.0" />
<PackageReference Include="System.Reactive.Linq" Version="5.0.0" />
<PackageReference Include="System.Reactive.PlatformServices" Version="5.0.0" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<ProjectReference Include="../spark_api/spark_api.csproj" />
<ProjectReference Include="../spark_core/spark_core.csproj" />
<PackageReference Include="Google.Protobuf" Version="3.21.4" />
<PackageReference Include="IronPython" Version="2.7.12" />
<PackageReference Include="NAudio" Version="2.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="protobuf-net" Version="3.1.17" />
<PackageReference Include="OxyPlot.Core" Version="2.1.2" />
<PackageReference Include="OxyPlot.Wpf" Version="2.1.2" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
<PackageReference Include="System.Reactive.Core" Version="6.0.0" />
<PackageReference Include="System.Reactive.Interfaces" Version="6.0.0" />
<PackageReference Include="System.Reactive.Linq" Version="6.0.0" />
<PackageReference Include="System.Reactive.PlatformServices" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\spark_api\spark_api.csproj" />
<ProjectReference Include="..\spark_core\spark_core.csproj" />
</ItemGroup>
<ItemGroup>
@@ -55,15 +62,20 @@
<Resource Include="**/*.png" />
<ConfigDefaults Include="../../lib/config/defaults/*.conf" />
</ItemGroup>
<ItemGroup>
<Resource Remove="logo.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="logo.ico" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Sounds/game_sound_correct.wav" />
<EmbeddedResource Include="Sounds/whistle.wav" />
</ItemGroup>
<Target Name="diagnostic" AfterTargets="PreBuildEvent" />
</Project>
-1
View File
@@ -1 +0,0 @@
set(sources api/analytics/ExpirationDriver.proto;api/analytics/TimeWeightedInterpolatedDriver.proto;api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/domain/Currency.proto;api/domain/SecurityCriteria.proto;api/domain/SecurityCriteriaClause.proto;api/domain/SecurityExpiration.proto;api/domain/SecurityMetadata.proto;api/domain/SecurityMetadataCollection.proto;api/domain/SecurityMetadataItem.proto;api/domain/SecurityType.proto;api/domain/TickDisplaySettings.proto;api/domain/TickFactors.proto;api/domain/Venue.proto;api/io/URL.proto;api/md/MarketDataSubscriptionParams.proto;api/md/binance/BinanceDepthStreamParams.proto;api/md/binance/BinanceMarketDataSubscriptionParams.proto;api/md/deribit/DeribitMarketDataSubscriptionParams.proto;api/md/ftx/FTXDepthStreamParams.proto;api/md/ftx/FTXMarketDataSubscriptionParams.proto;api/md/glbx/GlbxMarketDataSubscriptionParams.proto;api/md/huobi/HuobiMarketDataSubscriptionParams.proto;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/AnalyticsService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MarketDataService.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;communincation/websockets/tests/WebsocketSyncClientTests.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/SecurityMetadataCollection.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/algo_types.proto;config/protos/cme_reference_data.proto;config/protos/exchange_sim_cfg.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/market_data.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/ports.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spartan.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/symbols.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/protos/ui.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain/AggressorSide.cpp;domain/NewOrder.cpp;domain/OrderDefinition.cpp;domain/OrderStatus.cpp;domain/OrderUpdate.cpp;domain/Side.cpp;domain/TimeInForce.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;io/QueryParams.cpp;io/URL.cpp;io/http/CurlHandle.cpp;io/http/HTTPClient.cpp;io/http/HTTPHeaders.cpp;io/http/HTTPRequest.cpp;io/http/HTTPResponse.cpp;io/websocket/WebsocketClient.cpp;io/websocket/WebsocketClientConfiguration.cpp;io/websocket/WebsocketError.cpp;io/websocket/WebsocketMessage.cpp;io/websocket/WebsocketSSLClientInternal.cpp;io/websocket/tests/WebsocketClientTests.cpp;jetfix/codec/FIXArray.cpp;jetfix/common/OutFIX.cpp;jetfix/connection/AsyncReader.cpp;jetfix/connection/IConnection.cpp;jetfix/connection/SocketConnection.cpp;jetfix/gateway/CoreGateway.cpp;jetfix/gateway/JetFIXGatLine truncated
-1
View File
@@ -1 +0,0 @@
set(sources api/analytics/ExpirationDriver.proto;api/analytics/TimeWeightedInterpolatedDriver.proto;api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/domain/Currency.proto;api/domain/SecurityCriteria.proto;api/domain/SecurityCriteriaClause.proto;api/domain/SecurityExpiration.proto;api/domain/SecurityMetadata.proto;api/domain/SecurityMetadataCollection.proto;api/domain/SecurityMetadataItem.proto;api/domain/SecurityType.proto;api/domain/TickDisplayRule.proto;api/domain/TickDisplaySettings.proto;api/domain/TickFactors.proto;api/domain/Venue.proto;api/io/URL.proto;api/md/MarketDataSubscriptionParams.proto;api/md/binance/BinanceDepthStreamParams.proto;api/md/binance/BinanceMarketDataSubscriptionParams.proto;api/md/deribit/DeribitMarketDataSubscriptionParams.proto;api/md/ftx/FTXDepthStreamParams.proto;api/md/ftx/FTXMarketDataSubscriptionParams.proto;api/md/glbx/GlbxMarketDataSubscriptionParams.proto;api/md/huobi/HuobiMarketDataSubscriptionParams.proto;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/AnalyticsService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MarketDataService.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/SecurityMetadataCollection.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/algo_types.proto;config/protos/cme_reference_data.proto;config/protos/exchange_sim_cfg.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/market_data.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/ports.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spartan.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/symbols.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/protos/ui.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;io/QueryParams.cpp;io/URL.cpp;io/http/CurlHandle.cpp;io/http/HTTPClient.cpp;io/http/HTTPHeaders.cpp;io/http/HTTPRequest.cpp;io/http/HTTPResponse.cpp;io/websocket/WebsocketClient.cpp;io/websocket/WebsocketClientConfiguration.cpp;io/websocket/WebsocketError.cpp;io/websocket/WebsocketMessage.cpp;io/websocket/WebsocketSSLClientInternal.cpp;io/websocket/tests/WebsocketClientTests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/CCApiDepthWalker.cpp;md/CCApiListenerAdaptor.cpp;md/CCApiRequestor.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MarketDataLine truncated
+62 -148
View File
@@ -1,170 +1,84 @@
cmake_minimum_required(VERSION 3.5)
project(libspark)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
include(GNUInstallDirs)
include(${CMAKE_SOURCE_DIR}/cmake/safe_dep_glob.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/Protobuf.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GenerateDefaultConfig.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/PrintList.cmake)
# DEPENDENCIES
file(
GLOB_RECURSE Config_Protos
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
config/protos/*.proto
api/domain/SecurityMetadataCollection.proto)
file(
GLOB_RECURSE Service_Protos
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
api/services/*.proto)
file(
GLOB_RECURSE NonConfig_Protos
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.proto)
list(REMOVE_ITEM NonConfig_Protos ${Service_Protos} ${Config_Protos})
file(
GLOB_RECURSE Conf_Defaults
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
config/defaults/*.conf)
if (DEFINED DOTNET_BINARY_DIR OR DEFINED DOTNET_WINDOWS_BINARY_DIR)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/AddCopyBinariesTarget.cmake)
endif()
if(WIN32)
file(
GLOB_RECURSE SparkLib_Sources
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
api/*.cpp
config/*.cpp
domain_model/*.cpp
expression/*.cpp
logging/*.cpp
io/*.cpp
md/*.cpp
os/*.cpp
quickbus/*.cpp
sparkproto/*.cpp
testing/*.cpp
utils/*.cpp)
if(BUILD_SPARKD)
message(FATAL_ERROR "Cannot build sparkd on Windows (Please set BUILD_SPARKD to False)")
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GetWindowsClientSources.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GetWindowsClientLinkLibraries.cmake)
elseif(${BUILD_SPARKD})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GetLinuxServerSources.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GetLinuxServerLinkLibraries.cmake)
else()
file(
GLOB_RECURSE SparkLib_Sources
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.cpp)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GetLinuxClientSources.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GetLinuxClientLinkLibraries.cmake)
endif()
update_deps_file("${SparkLib_Sources};${Config_Protos};${Service_Protos};${NonConfig_Protos};${Conf_Defaults}")
# END DEPENDENCIES
# Cpp sources
set(${PROJECT_NAME}_Sources)
get_cpp_sources(${PROJECT_NAME}_Sources)
print_list(${PROJECT_NAME}_Sources VERBOSE)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${NonConfig_Protos} ${Config_Protos})
service_compiler_generate_cpp(SERVICE_COMPILER_SRCS SERVICE_COMPILER_HDRS ${Service_Protos})
# Proto sources
get_proto_sources(_cfg_protos _non_cfg_protos _service_protos _cfg_defaults)
print_list(_cfg_protos VERBOSE)
print_list(_non_cfg_protos VERBOSE)
print_list(_service_protos VERBOSE)
print_list(_cfg_defaults VERBOSE)
# generate list of config protos
set(config_proto_file ${CMAKE_CURRENT_BINARY_DIR}/config_proto_files.h)
update_deps_file("${${PROJECT_NAME}_Sources};${_cfg_protos};${_service_protos};${_non_cfg_protos};${_cfg_defaults}")
# generate a string with the current config files
set(config_proto_str "const char * config_proto_files[] = { // generated file\n")
foreach(protopath ${Config_Protos})
get_filename_component(protoname ${protopath} NAME)
string(APPEND config_proto_str "\"${protoname}\",\n")
endforeach(protopath)
string(APPEND config_proto_str "} ;\n")
# Generate proto cpp
message(STATUS "Generating proto cpp")
protobuf_generate_cpp(_proto_srcs _proto_hdrs ${_non_cfg_protos} ${_cfg_protos})
service_compiler_generate_cpp(SERVICE_COMPILER_SRCS SERVICE_COMPILER_HDRS ${_service_protos})
message(STATUS "Generating default config")
generate_default_config(_cfg_protos _cfg_defaults)
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_Sources} ${_proto_srcs} ${SERVICE_COMPILER_SRCS})
# compare with file and if there is any difference update the file
set(old_config_proto_str "")
if(EXISTS "${config_proto_file}")
file(READ "${config_proto_file}" old_config_proto_str)
endif()
if(NOT old_config_proto_str STREQUAL config_proto_str)
file(WRITE "${config_proto_file}" "${config_proto_str}")
endif()
# generate static defaults
set(config_defaults_file ${CMAKE_CURRENT_BINARY_DIR}/config_defaults.h)
# Defaults cannot be a single string because the compiler complains about a string longer than 65k
set(config_defaults_str "const char * config_static_defaults[] = { ")
foreach(cfg_file_path ${Conf_Defaults})
file(READ ${cfg_file_path} cfg_file_content)
string(REPLACE "\"" "\\\"" cfg_file_content_escaped ${cfg_file_content})
string(REPLACE "\n" ";" cfg_lines ${cfg_file_content_escaped})
foreach(line ${cfg_lines})
string(APPEND config_defaults_str "\n \"${line}\",")
endforeach(line)
endforeach(cfg_file_path)
string(APPEND config_defaults_str "};")
set(old_defaults_str "")
if(EXISTS ${config_defaults_file})
file(READ ${config_defaults_file} old_defaults_str)
endif()
if(NOT config_defaults_str STREQUAL old_defaults_str)
file(WRITE "${config_defaults_file}" "${config_defaults_str}")
endif()
# lib
if(WIN32)
add_library(libspark SHARED ${SparkLib_Sources} ${PROTO_SRCS} ${SERVICE_COMPILER_SRCS})
else()
add_library(libspark SHARED ${SparkLib_Sources} ${PROTO_SRCS} ${SERVICE_COMPILER_SRCS})
endif()
# include paths
target_include_directories(
libspark PUBLIC
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src)
${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
if(WIN32)
target_link_libraries(
libspark
libcurl
debug
fmtd
optimized
fmt
libtbb
libboost_system
libboost_thread
libboost_filesystem
libboost_regex
libboost_chrono
libboost_date_time
libboost_atomic
libprotobuf
libprotoc
libssl
libcrypto
crypt32)
else()
target_link_libraries(
libspark
protobuf
double-conversion
boost_system
boost_thread
boost_filesystem
boost_regex
boost_chrono
boost_date_time
boost_atomic
SQLiteCpp
sqlite3
curl
uuid
ssl
crypto
fmt
tbb
cryptopp
pugixml
lttng-ust
Pcap++
Packet++
Common++
ssh2
-lrt
-ldl
-lpcap
-static-libgcc
-static-libstdc++
-pthread)
get_link_libraries(_link_libs)
print_list(_link_libs VERBOSE)
target_link_libraries(${PROJECT_NAME} ${_link_libs})
install(TARGETS libspark DESTINATION bin)
# Copy binaries to Dotnet build dirs (for csprojs that depend on libspark)
if (DEFINED DOTNET_BINARY_DIR)
add_copy_binaries_target(
copy_to_dotnet_binary_dir
"${DOTNET_BINARY_DIR}"
"Copy ${PROJECT_NAME} bins to Dotnet build dir")
endif()
if(WIN32)
include(${CMAKE_SOURCE_DIR}/tools/vs_filters.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/vs_filters.cmake)
endif()
foreach(_hdr ${_proto_hdrs})
file(RELATIVE_PATH _relative_path ${CMAKE_CURRENT_BINARY_DIR}/protobufs ${_hdr})
install(FILES ${_hdr} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${_relative_path})
endforeach()
include(${CMAKE_SOURCE_DIR}/cmake/InstallBasic.cmake)
file(
GLOB_RECURSE _hdrs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.h
)
install_basic(HEADERS ${_hdrs})
+5
View File
@@ -0,0 +1,5 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components(@PROJECT_NAME@)
+3 -3
View File
@@ -13,7 +13,7 @@
#include "lib/config/protos/quickbus_cfg.pb.h"
#include "lib/config/protos/system.pb.h"
#ifdef WIN32
#ifdef _WIN32
#include <excpt.h>
#endif
@@ -59,7 +59,7 @@ CAPI Quickbus *api_create_quickbus(const char *qbconfig, long length) {
}
CAPI void api_destroy_quickbus(Quickbus *qbus) {
#ifndef WIN32
#ifndef _WIN32
if (qbus != nullptr) {
delete qbus;
}
@@ -186,7 +186,7 @@ CAPI void api_client_send(
void *extra) {
LOG(Api, Diag, "send rpc {}", ((int64_t)buffer));
std::string strbuf(buffer, buffer_length);
qbus::RPCRequest request(move(strbuf));
qbus::RPCRequest request(std::move(strbuf));
api_client_send_internal(
pclient, std::move(request), cb, rpc_connect_timeout_ms(), extra);
}
+1 -1
View File
@@ -60,7 +60,7 @@ CAPI void api_server_call_callback(
reinterpret_cast<qbus::ReplyHandler **>(ppvhandler);
std::string reply_buffer((const char *)buffer, (size_t)length);
qbus::RPCReplyPtr replyptr =
std::make_shared<qbus::RPCReply>(move(reply_buffer));
std::make_shared<qbus::RPCReply>(std::move(reply_buffer));
(**pphandler)(replyptr);
delete (*pphandler);
*pphandler = nullptr;
+3 -3
View File
@@ -72,7 +72,7 @@ class ClientChannel {
response_buffer + header_size,
response_size - header_size);
if (response->ParseFromZeroCopyStream(&data_stream)) {
on_response(Result<Response>(move(response)));
on_response(Result<Response>(std::move(response)));
return;
}
} else {
@@ -88,12 +88,12 @@ class ClientChannel {
rxcpp::observable<RawUpdate<std::shared_ptr<T>>>
subscribe(int method_id, const char *method, const std::string &qualifier) {
return rxcpp::observable<>::create<RawUpdate<std::shared_ptr<T>>>(
[=](rxcpp::subscriber<RawUpdate<std::shared_ptr<T>>> observer) {
[=, this](rxcpp::subscriber<RawUpdate<std::shared_ptr<T>>> observer) {
StreamAccessRequest request;
request.set_qualifier(qualifier);
send<StreamAccessRequest, StreamAccessResponse>(
method_id, request,
[=](const Result<StreamAccessResponse> &response) {
[=, this](const Result<StreamAccessResponse> &response) {
// There is a race on server startup. If the server is not
// yet we can't return a dead stream if (!response) {
// observer.on_error(
+1 -1
View File
@@ -28,7 +28,7 @@ void QuickbusClientChannel::send_core(
(*on_response)(buffer, length);
delete on_response;
};
OnReply *heap_on_response = new OnReply(move(on_response));
OnReply *heap_on_response = new OnReply(std::move(on_response));
api_client_send(
_pclient, request_envalope.c_str(), request_envalope.size(), trampoline,
heap_on_response);
@@ -11,8 +11,8 @@ using namespace rxcpp::operators;
{{#each service}}
// Constructor
{{name}}::{{name}}(std::unique_ptr<bts::api::ClientChannel> pchannel) : _pchannel(move(pchannel)) {}
{{name}}::{{name}}({{name}}&& other) : _pchannel(move(other._pchannel)) { }
{{name}}::{{name}}(std::unique_ptr<bts::api::ClientChannel> pchannel) : _pchannel(std::move(pchannel)) {}
{{name}}::{{name}}({{name}}&& other) : _pchannel(std::move(other._pchannel)) { }
{{#each method}}
{{#if server_streaming}}
@@ -92,7 +92,7 @@ void Authenticated{{name}}Base::dispatch(const bts::api::RequestHeader& header,
return iter->second;
};
{{/unless}}
return [=](
return [=, this](
const std::vector<{{output_type_cpp}}>* added,
const std::vector<{{output_type_cpp}}>* changed,
std::set<{{key_type.cpptype}}>* removed) mutable {
+1 -1
View File
@@ -43,7 +43,7 @@ void HelloServiceServer::yell_hello(
HelloResponse response;
ShoutRequest sr;
sr.set_msg("hello " + request.name());
_shouter.upper(sr, [=](Result<ShoutResponse> response) {
_shouter.upper(sr, [=, this](Result<ShoutResponse> response) {
if (response.success()) {
HelloResponse hr;
hr.set_message(response.value()->msg());
+15
View File
@@ -0,0 +1,15 @@
function(add_copy_binaries_target tgt_name dest_dir)
set(_dest_files)
foreach (_dest_dir ${dest_dir})
set(_dest_file ${_dest_dir}/${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
list(APPEND _dest_files ${_dest_file})
add_custom_command(
OUTPUT ${_dest_file}
COMMAND ${CMAKE_COMMAND}
ARGS -E copy
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
${_dest_file}
DEPENDS ${PROJECT_NAME})
endforeach()
add_custom_target(${tgt_name} ALL DEPENDS ${_dest_files} COMMENT ${ARGN})
endfunction()
+53
View File
@@ -0,0 +1,53 @@
function(generate_default_config cfg_protos cfg_defaults)
# generate list of config protos
set(_cfg_proto_file ${CMAKE_CURRENT_BINARY_DIR}/config_proto_files.h)
# generate a string with the current config files
set(_cfg_proto_str "const char * config_proto_files[] = { // generated file\n")
foreach(_proto_path ${${cfg_protos}})
get_filename_component(_proto_name ${_proto_path} NAME)
string(APPEND _cfg_proto_str "\"${_proto_name}\",\n")
endforeach(_proto_path)
string(APPEND _cfg_proto_str "} ;\n")
# compare with file and if there is any difference update the file
set(_old_cfg_proto_str "")
if(EXISTS "${_cfg_proto_file}")
file(READ "${_cfg_proto_file}" _old_cfg_proto_str)
endif()
if(NOT _old_cfg_proto_str STREQUAL _cfg_proto_str)
file(WRITE "${_cfg_proto_file}" "${_cfg_proto_str}")
endif()
# generate static defaults
set(_cfg_defaults_file ${CMAKE_CURRENT_BINARY_DIR}/config_defaults.h)
# Defaults cannot be a single string because the compiler complains about a
# string longer than 65k
set(_cfg_defaults_str "const char * config_static_defaults[] = { ")
foreach(_cfg_file_path ${${cfg_defaults}})
file(READ ${_cfg_file_path} _cfg_file_content)
string(REPLACE "\"" "\\\"" _cfg_file_content_escaped ${_cfg_file_content})
string(REPLACE "\n" ";" _cfg_lines ${_cfg_file_content_escaped})
foreach(_line ${_cfg_lines})
string(APPEND _cfg_defaults_str "\n \"${_line}\",")
endforeach(_line)
endforeach(_cfg_file_path)
string(APPEND _cfg_defaults_str "};")
set(_old_cfg_defaults_str "")
if(EXISTS ${_cfg_defaults_file})
file(READ ${_cfg_defaults_file} _old_cfg_defaults_str)
endif()
if(NOT _cfg_defaults_str STREQUAL _old_cfg_defaults_str)
file(WRITE "${_cfg_defaults_file}" "${_cfg_defaults_str}")
endif()
endfunction()
@@ -0,0 +1,23 @@
function(get_link_libraries dest)
set(${dest}
curl
tbb
boost_system
boost_thread
boost_filesystem
boost_regex
boost_chrono
boost_date_time
boost_atomic
protobuf
protoc
ssl
crypto
debug fmtd
optimized fmt
cryptopp
SQLiteCpp
sqlite3
uuid
PARENT_SCOPE)
endfunction()
+172
View File
@@ -0,0 +1,172 @@
function(get_proto_sources cfg_srcs non_cfg_srcs service_srcs cfg_defaults)
file(
GLOB_RECURSE _cfg_srcs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
config/protos/*.proto
api/domain/SecurityMetadataCollection.proto)
file(
GLOB_RECURSE _service_srcs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
api/services/*.proto)
file(
GLOB_RECURSE _non_cfg_srcs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.proto)
list(REMOVE_ITEM _non_cfg_srcs ${_service_srcs} ${_cfg_srcs})
file(
GLOB_RECURSE _cfg_defaults
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CONFIG_DEFAULTS_PATH})
set(_cfg_defaults)
foreach(cfg_path ${CONFIG_DEFAULTS_PATH})
file(
GLOB_RECURSE cfg_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${cfg_path})
list(APPEND _cfg_defaults ${cfg_files})
endforeach()
set(${cfg_srcs} ${_cfg_srcs} PARENT_SCOPE)
set(${non_cfg_srcs} ${_non_cfg_srcs} PARENT_SCOPE)
set(${service_srcs} ${_service_srcs} PARENT_SCOPE)
set(${cfg_defaults} ${_cfg_defaults} PARENT_SCOPE)
endfunction()
function(get_cpp_sources dest)
set(${dest}
api/core/ApiClientInterop.cpp
api/core/ApiServerInterop.cpp
api/md/MarketDataConfigUtils.cpp
api/public/ApiServer.cpp
api/public/ClientChannel.cpp
api/public/QuickbusClientChannel.cpp
api/public/ServerChannel.cpp
api/public/ServiceContext.cpp
api/test/ApiTests.cpp
api/test/HelloServiceServer.cpp
config/ConfigDownloader.cpp
config/ConfigErrorCollector.cpp
config/ConfigPropertyEvaluator.cpp
config/ConfigQuerier.cpp
config/ConfigValueQueue.cpp
config/ConfigurationException.cpp
config/ConfigurationState.cpp
config/PreprocessInputStream.cpp
config/config.cpp
config/tests/HTTPServer.cpp
config/tests/config_ref_tests.cpp
config/tests/config_tests.cpp
config/text_format/text_format.cpp
core/TimeSpan.cpp
core/TimeStamp.cpp
domain/DomainSecurityUtils.cpp
domain/SecurityCriteria.cpp
domain/SecurityCriteriaClause.cpp
domain_model/Security.cpp
domain_model/SecurityTests.cpp
domain_model/sod.cpp
domain_model/tests/domain_tests.cpp
expression/BooleanGrammar.cpp
expression/ExpressionEvaluator.cpp
expression/ParserExceptions.cpp
expression/Value.cpp
expression/tests/expression_parser_tests.cpp
io/http/CurlHandle.cpp
io/http/HTTPClient.cpp
io/http/HTTPHeaders.cpp
io/http/HTTPRequest.cpp
io/http/HTTPResponse.cpp
logging/LoggerHub.cpp
logging/Sink.cpp
logging/logging.cpp
logging/tests/logging_tests.cpp
md/Diag/MDPeriodicDumper.cpp
md/Diag/ShmDumper.cpp
md/MBOProcessor.cpp
md/MBOServiceServer.cpp
md/MDClient.cpp
md/MDConsumer.cpp
md/MDConsumerHandle.cpp
md/MDConsumerInterop.cpp
md/MDProducer.cpp
md/MDProducerHandle.cpp
md/MemorySegmentUtils.cpp
md/PriceSize.cpp
md/Product.cpp
md/SecurityCache.cpp
md/SecurityDB.cpp
md/SecurityIDRecorder.cpp
md/SecurityMapper.cpp
md/SecurityMarketState.cpp
md/SecurityOracle.cpp
md/SecurityStore.cpp
md/SettlementRecorder.cpp
md/Shm/FixedSecurity.cpp
md/SyntheticSecurityService.cpp
md/cme/MDP3Utils.cpp
md/common.cpp
md/ice/ICEUtils.cpp
md/relay/QueryServer.cpp
md/relay/RelayClient.cpp
md/relay/RelayRecorder.cpp
md/service/MarketDataServiceServer.cpp
md/test/Co2ManagedTestHelper.cpp
md/test/Co2TestInstrument.cpp
md/test/mbo_tests.cpp
md/test/md2_tests.cpp
md/test/md_test_utils.cpp
md/test/synthetic_book_merge_tests.cpp
os/os.cpp
os/tests/os_tests.cpp
quickbus/core/LocalNode.cpp
quickbus/core/Quickbus.cpp
quickbus/core/SubscriptionID.cpp
quickbus/core/TableID.cpp
quickbus/message_model/Update.cpp
quickbus/message_model/merge_updates.cpp
quickbus/network/QBConnection.cpp
quickbus/network/QBConnectionManager.cpp
quickbus/network/endpoint_description.cpp
quickbus/pubsub/TablePublisher.cpp
quickbus/pubsub/TableSubscriber.cpp
quickbus/pubsub/tests/qb_pubsub_tests.cpp
quickbus/routing/INode.cpp
quickbus/routing/NodeID.cpp
quickbus/routing/Router.cpp
quickbus/rpc/RPCClient.cpp
quickbus/rpc/RPCServer.cpp
quickbus/rpc/RPCSessionID.cpp
quickbus/rpc/rpc_utils.cpp
quickbus/rpc/tests/qb_rpc_tests.cpp
quickbus/tests/quickbus_tests.cpp
testing/catch_test_runner.cpp
utils/AuthSessionManager.cpp
utils/AuthToken.cpp
utils/Dispatcher.cpp
utils/FileUtils.cpp
utils/GrowableSPSCQueue.cpp
utils/HTTPStream.cpp
utils/MathUtils.cpp
utils/PBUtils.cpp
utils/Puid.cpp
utils/SecureLogon.cpp
utils/SharedMemory.cpp
utils/Sqlite_utils.cpp
utils/Uuid.cpp
utils/datetime.cpp
utils/download.cpp
utils/file_utils.cpp
utils/init_spark_lib.cpp
utils/is_unittest_environment.cpp
utils/sftp.cpp
utils/stats.cpp
utils/tests/AuthTokenTests.cpp
utils/tests/IDGeneratorTests.cpp
utils/tests/MathUtilsTests.cpp
utils/tests/SingleWriterConcurrentVectorTests.cpp
utils/thread_manager.cpp
PARENT_SCOPE)
endfunction()
@@ -0,0 +1,35 @@
function(get_link_libraries dest)
find_package(fmt CONFIG REQUIRED)
set(${dest}
protobuf
double-conversion
boost_system
boost_thread
boost_filesystem
boost_regex
boost_chrono
boost_date_time
boost_atomic
SQLiteCpp
sqlite3
curl
uuid
ssl
crypto
fmt::fmt-header-only
tbb
cryptopp
pugixml
lttng-ust
Pcap++
Packet++
Common++
ssh2
-lrt
-ldl
-lpcap
-static-libgcc
-static-libstdc++
-pthread
PARENT_SCOPE)
endfunction()
+39
View File
@@ -0,0 +1,39 @@
function(get_proto_sources cfg_srcs non_cfg_srcs service_srcs cfg_defaults)
file(
GLOB_RECURSE _cfg_srcs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
config/protos/*.proto
api/domain/SecurityMetadataCollection.proto
api/md/MarketDataConfig.proto)
file(
GLOB_RECURSE _service_srcs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
api/services/*.proto)
file(
GLOB_RECURSE _non_cfg_srcs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.proto)
list(REMOVE_ITEM _non_cfg_srcs ${_service_srcs} ${_cfg_srcs})
set(_cfg_defaults)
foreach(cfg_path ${CONFIG_DEFAULTS_PATH})
file(
GLOB_RECURSE cfg_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${cfg_path})
list(APPEND _cfg_defaults ${cfg_files})
endforeach()
set(${cfg_srcs} ${_cfg_srcs} PARENT_SCOPE)
set(${non_cfg_srcs} ${_non_cfg_srcs} PARENT_SCOPE)
set(${service_srcs} ${_service_srcs} PARENT_SCOPE)
set(${cfg_defaults} ${_cfg_defaults} PARENT_SCOPE)
endfunction()
function(get_cpp_sources dest)
file(
GLOB_RECURSE _dest
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.cpp)
set(${dest} ${_dest} PARENT_SCOPE)
endfunction()
@@ -0,0 +1,20 @@
function(get_link_libraries dest)
find_package(fmt CONFIG REQUIRED)
set(${dest}
crypt32
fmt::fmt-header-only
libcrypto
libcurl
libboost_system
libboost_thread
libboost_filesystem
libboost_regex
libboost_chrono
libboost_date_time
libboost_atomic
libprotobuf
libprotoc
libssl
libtbb
PARENT_SCOPE)
endfunction()
+162
View File
@@ -0,0 +1,162 @@
function(get_proto_sources cfg_srcs non_cfg_srcs service_srcs cfg_defaults)
file(
GLOB_RECURSE _cfg_srcs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
config/protos/*.proto
api/domain/SecurityMetadataCollection.proto)
file(
GLOB_RECURSE _service_srcs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
api/services/*.proto)
file(
GLOB_RECURSE _non_cfg_srcs
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.proto)
list(REMOVE_ITEM _non_cfg_srcs ${_service_srcs} ${_cfg_srcs})
file(
GLOB_RECURSE _cfg_defaults
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CONFIG_DEFAULTS_PATH})
set(_cfg_defaults)
foreach(cfg_path ${CONFIG_DEFAULTS_PATH})
file(
GLOB_RECURSE cfg_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${cfg_path})
list(APPEND _cfg_defaults ${cfg_files})
endforeach()
set(${cfg_srcs} ${_cfg_srcs} PARENT_SCOPE)
set(${non_cfg_srcs} ${_non_cfg_srcs} PARENT_SCOPE)
set(${service_srcs} ${_service_srcs} PARENT_SCOPE)
set(${cfg_defaults} ${_cfg_defaults} PARENT_SCOPE)
endfunction()
function(get_cpp_sources dest)
set(${dest}
api/core/ApiClientInterop.cpp
api/core/ApiServerInterop.cpp
api/public/ApiServer.cpp
api/public/ClientChannel.cpp
api/public/QuickbusClientChannel.cpp
api/public/ServerChannel.cpp
api/public/ServiceContext.cpp
api/test/ApiTests.cpp
api/test/HelloServiceServer.cpp
config/ConfigCheck.cpp
config/ConfigDownloader.cpp
config/ConfigErrorCollector.cpp
config/ConfigPropertyEvaluator.cpp
config/ConfigValueQueue.cpp
config/ConfigurationException.cpp
config/ConfigurationState.cpp
config/PreprocessInputStream.cpp
config/ConfigLog.cpp
config/config.cpp
config/tests/HTTPServer.cpp
config/tests/config_ref_tests.cpp
config/tests/config_tests.cpp
config/text_format/text_format.cpp
domain_model/Security.cpp
domain_model/SecurityTests.cpp
domain_model/sod.cpp
domain_model/tests/domain_tests.cpp
expression/BooleanGrammar.cpp
expression/ExpressionEvaluator.cpp
expression/ParserExceptions.cpp
expression/Value.cpp
expression/tests/expression_parser_tests.cpp
logging/LoggerHub.cpp
logging/Sink.cpp
logging/logging.cpp
logging/tests/logging_tests.cpp
md/Diag/MDPeriodicDumper.cpp
md/Diag/ShmDumper.cpp
md/MBOProcessor.cpp
md/MBOServiceServer.cpp
md/MDClient.cpp
md/MDConsumer.cpp
md/MDConsumerHandle.cpp
md/MDConsumerInterop.cpp
md/MDProducer.cpp
md/MDProducerHandle.cpp
md/MarketDataError.cpp
md/MarketDataGateway.cpp
md/MarketDataRegistrationFactory.cpp
md/MemorySegmentUtils.cpp
md/PlatformLoader.cpp
md/PriceSize.cpp
md/Product.cpp
md/SecurityCache.cpp
md/SecurityDB.cpp
md/SecurityMapper.cpp
md/SecurityMarketState.cpp
md/SecurityOracle.cpp
md/SecurityStore.cpp
md/Shm/FixedSecurity.cpp
md/SyntheticSecurityService.cpp
md/cme/MDP3Utils.cpp
md/common.cpp
md/ice/ICEUtils.cpp
md/relay/QueryServer.cpp
md/relay/RelayClient.cpp
md/relay/RelayRecorder.cpp
md/service/MarketDataServiceServer.cpp
md/test/Co2ManagedTestHelper.cpp
md/test/Co2TestInstrument.cpp
md/test/mbo_tests.cpp
md/test/md2_tests.cpp
md/test/md_test_utils.cpp
md/test/synthetic_book_merge_tests.cpp
os/os.cpp
os/tests/os_tests.cpp
quickbus/core/LocalNode.cpp
quickbus/core/Quickbus.cpp
quickbus/core/SubscriptionID.cpp
quickbus/core/TableID.cpp
quickbus/message_model/Update.cpp
quickbus/message_model/merge_updates.cpp
quickbus/network/QBConnection.cpp
quickbus/network/QBConnectionManager.cpp
quickbus/network/endpoint_description.cpp
quickbus/pubsub/TablePublisher.cpp
quickbus/pubsub/TableSubscriber.cpp
quickbus/pubsub/tests/qb_pubsub_tests.cpp
quickbus/routing/INode.cpp
quickbus/routing/NodeID.cpp
quickbus/routing/Router.cpp
quickbus/rpc/RPCClient.cpp
quickbus/rpc/RPCServer.cpp
quickbus/rpc/RPCSessionID.cpp
quickbus/rpc/rpc_utils.cpp
quickbus/rpc/tests/qb_rpc_tests.cpp
quickbus/tests/quickbus_tests.cpp
testing/catch_test_runner.cpp
utils/AuthSessionManager.cpp
utils/AuthToken.cpp
utils/Dispatcher.cpp
utils/FileUtils.cpp
utils/GrowableSPSCQueue.cpp
utils/HTTPStream.cpp
utils/MathUtils.cpp
utils/PBUtils.cpp
utils/Puid.cpp
utils/SecureLogon.cpp
utils/SharedMemory.cpp
utils/Uuid.cpp
utils/datetime.cpp
utils/download.cpp
utils/file_utils.cpp
utils/init_spark_lib.cpp
utils/is_unittest_environment.cpp
utils/sftp.cpp
utils/stats.cpp
utils/tests/AuthTokenTests.cpp
utils/tests/MathUtilsTests.cpp
utils/tests/SingleWriterConcurrentVectorTests.cpp
utils/thread_manager.cpp
PARENT_SCOPE)
endfunction()
+2 -2
View File
@@ -29,7 +29,7 @@
#include "lib/config_defaults.h"
#include "lib/config_proto_files.h"
#ifdef WIN32
#ifdef _WIN32
#include <Winsock2.h>
#include <d2d1.h>
#else
@@ -566,7 +566,7 @@ void ConfigurationState::generate_all_config_proto(
&bts_config_dp, config_message, message_desc, ++field_number);
}
} else {
#ifdef WIN32
#ifdef _WIN32
// on linux the linker might throw away config protos that
// are not used in sparkd. On windows we build a dll so that
// should not happen
+8 -2
View File
@@ -1,5 +1,11 @@
#pragma once
#include "lib/utils/ValueWrapper.h"
#include <cstdint>
namespace bts {
using SecurityKey = utils::ValueWrapper<struct SecurityKeyTag, uint32_t>;
}
using SecurityKey = utils::ValueWrapper<struct SecurityKeyTag, std::uint32_t>;
} // namespace bts
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
#ifndef WIN32
#ifndef _WIN32
#include <bits/stdint-uintn.h>
#endif
#include <cstdint>
+2 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#include <cstdint>
#include <ostream>
#include <string>
#include <vector>
namespace bts::io::websocket {
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef WIN32
#ifndef _WIN32
#include "OutFIX.h"
namespace bts {
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef WIN32
#ifndef _WIN32
#include "AsyncReader.h"
#include "IConnection.h"
+1 -1
View File
@@ -1,3 +1,3 @@
#ifndef WIN32
#ifndef _WIN32
#include "IConnection.h"
#endif
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef WIN32
#ifndef _WIN32
#include "JetFIXGateway.h"
namespace bts {
+1 -1
View File
@@ -34,7 +34,7 @@ struct LogRec {
};
GCC_DIAG_RESTORE()
#ifndef WIN32
#ifndef _WIN32
// static_assert(sizeof(LogRec) == 256, "LogRec should be 128 bytes");
#endif
+7 -1
View File
@@ -4,6 +4,7 @@
#include <fmt/ostream.h>
#include <iostream>
#include <type_traits>
#include <vector>
namespace bts {
namespace log {
@@ -12,7 +13,12 @@ template <class Tuple, std::size_t... Is>
std::string format_tuple(
const char *msg_template, Tuple const &t, std::index_sequence<Is...>) {
try {
return fmt::format(msg_template, std::get<Is>(t)...);
using ctx = fmt::format_context;
std::vector<fmt::basic_format_arg<ctx>> fmt_args;
(fmt_args.push_back(fmt::detail::make_arg<ctx>(std::get<Is>(t))), ...);
return fmt::vformat(
msg_template,
fmt::basic_format_args<ctx>(fmt_args.data(), fmt_args.size()));
} catch (fmt::format_error const &e) {
return fmt::format(
"Bad log message template: '{}' Error: '{}'", msg_template, e.what());
+3 -3
View File
@@ -13,7 +13,7 @@
#include <fstream>
#include <iostream>
#ifndef WIN32
#ifndef _WIN32
#include <syslog.h>
#endif
@@ -22,7 +22,7 @@ namespace log {
struct InitSysLog {
InitSysLog() {
#ifndef WIN32
#ifndef _WIN32
openlog("spark", 0, LOG_USER);
#endif
}
@@ -72,7 +72,7 @@ Sink console_sink(LoggingConfig const &) {
}
Sink syslog_sink(LoggingConfig const &cfg) {
#ifdef WIN32
#ifdef _WIN32
return null_sink();
#else
auto f = formatter(cfg);
+2 -1
View File
@@ -136,7 +136,8 @@ boost::filesystem::path log_cache_file_path() {
LoggingConfigPoller::LoggingConfigPoller(
bts::config::Logging const &cfg,
bts::config::ThreadGroupCfg const &thread_cfg)
: _poller(utils::Dispatcher::background(), 1000, [=]() { poll_once(); }),
: _poller(
utils::Dispatcher::background(), 1000, [=, this]() { poll_once(); }),
_last_ts(std::time(nullptr)), _log_cache_file(log_cache_file_path()),
_done(false) {
init(cfg, thread_cfg);
+2
View File
@@ -4,6 +4,8 @@
#include "lib/utils/bts_chrono.h"
#include "lib/logging/logging.h"
#include <fmt/chrono.h>
namespace bts {
int logging_tests;
+12 -6
View File
@@ -1,9 +1,15 @@
#pragma once
#include "lib/utils/ValueWrapper.h"
namespace bts {
namespace md {
#include <cstdint>
namespace bts::md {
using ExchangeOrderKey =
utils::ValueWrapper<struct ExchangeOrderKeyTag, uint64_t>;
using SparkOrderKey = utils::ValueWrapper<struct SparkOrderKeyTag, uint64_t>;
} // namespace md
} // namespace bts
utils::ValueWrapper<struct ExchangeOrderKeyTag, std::uint64_t>;
using SparkOrderKey =
utils::ValueWrapper<struct SparkOrderKeyTag, std::uint64_t>;
} // namespace bts::md
+8 -2
View File
@@ -1,6 +1,12 @@
#pragma once
#include "lib/utils/ValueWrapper.h"
#include <cstdint>
namespace bts {
using ExchangeSecurityKey =
utils::ValueWrapper<struct ExchangeSecurityKeyTag, uint64_t>;
}
utils::ValueWrapper<struct ExchangeSecurityKeyTag, std::uint64_t>;
} // namespace bts
+2 -2
View File
@@ -76,8 +76,8 @@ struct MBOProcessorImpl {
MBOProcessorImpl()
: pool(2048, 512), snapshots(), running(true),
last_pool_print(utils::TimeStamp::invalid()),
thread(
threading::make_thread("MBO", [=]() { process_incremental(); })) {
thread(threading::make_thread(
"MBO", [=, this]() { process_incremental(); })) {
if (config::get<config::toggles::MBOStats>().enabled()) {
last_pool_print = utils::TimeStamp::now();
}
+4
View File
@@ -4,9 +4,11 @@
#include "MDProducerHandle.h"
#include "lib/domain_model/Security.h"
#include "lib/domain_model/SecurityKey.h"
#include "lib/utils/OSTREAM_FMT_IMPL.h"
#include "lib/utils/TimeStamp.h"
#include <btree/map.h>
#include <fmt/format.h>
#include <map>
#include <memory>
@@ -169,3 +171,5 @@ class MBOProcessor {
namespace std {
std::ostream &operator<<(std::ostream &os, const bts::md::inc::Update &);
}
OSTREAM_FMT_IMPL(bts::md::inc::Update);
+2 -2
View File
@@ -36,7 +36,7 @@ class HandleIndex {
HandleIndex(md::MDClient &client)
: _client(client), _sub(0), _consumer(std::nullopt), index() {
_sub = _client.on_consumer().subscribe(
[=](const MDConsumer &c) { on_consumer(c); });
[=, this](const MDConsumer &c) { on_consumer(c); });
on_consumer(_client.current_consumer());
}
@@ -256,7 +256,7 @@ MBOServiceServer::MBOServiceServer(
// make publishers ✔
// subscribe to orders => stash active orders dict
_me->orders_sub =
_me->orders.subscribe_orders().subscribe([=](const auto &update) {
_me->orders.subscribe_orders().subscribe([=, this](const auto &update) {
// api thread
const auto &added = update.added();
const auto &changed = update.changed();
+6 -5
View File
@@ -441,9 +441,9 @@ class SyntheticConsumerInst {
}
add_snapshot(snapshot);
_security_sub = _ss->on_securities().subscribe(
[=](const api::Security &sec) { add_security(sec); });
[=, this](const api::Security &sec) { add_security(sec); });
_meta_sub = _ss->on_metadata().subscribe(
[=](const synthetic::Metadata &m) { on_metadata(m); });
[=, this](const synthetic::Metadata &m) { on_metadata(m); });
}
}
@@ -640,8 +640,9 @@ class MDConsumerImpl {
if (ss != nullptr) {
_sci = std::make_shared<SyntheticConsumerInst>(
ss,
[=](const set<security_key> &keys) { return get_handles(keys); });
ss, [=, this](const set<security_key> &keys) {
return get_handles(keys);
});
}
// Add the SecurityCache to on_security so it can cache discovered
@@ -783,7 +784,7 @@ class MDConsumerImpl {
// recurse to find details
map<security_key, SecurityPtr> leg_map;
for (auto &leg : fill_leg_details(legs, depth + 1)) {
leg_map.insert(make_pair(leg->id(), move(leg)));
leg_map.insert(make_pair(leg->id(), std::move(leg)));
}
//
+1 -1
View File
@@ -1,4 +1,4 @@
#ifdef _WIN32
#if defined(EXPORT_MD_CONSUMER)
#include "MDConsumer.h"
#include "SecurityCache.h"
#include "UserSymbol.h"
+2 -2
View File
@@ -134,7 +134,7 @@ MDProducer::MDProducer(Platform platform, MDProducerFlags flags)
: _mutex(new std::mutex()), _producers(), _id_recorder(),
_platform(platform), _flags(flags),
_smapper(flags & MDProducerFlags::SecurityMapper) {}
#ifndef WIN32
#ifndef _WIN32
MDProducer::MDProducer(
Platform platform, SecurityIDRecorder recorder, MDProducerFlags flags)
: _mutex(new std::mutex()), _producers(),
@@ -173,7 +173,7 @@ MDProducerImpl &MDProducer::get_producer(
} else {
newp.reset(new MDProducerImpl(symbol, type, exchange, _platform, _flags));
}
_producers.push_back(move(newp));
_producers.push_back(std::move(newp));
return *_producers.back();
}
+3
View File
@@ -1,6 +1,9 @@
#pragma once
#include "lib/core/ValueWrapper.h"
#include <cstdint>
namespace bts::md {
using MarketDataListenerID =
+2 -2
View File
@@ -1,6 +1,6 @@
#pragma once
#include "lib/domain_model/Security.pb.h"
#include "lib/utils/optional.h"
#include <optional>
#include <string>
namespace bts {
@@ -10,4 +10,4 @@ std::string product_to_string(const api::Product &);
std::optional<api::Product> string_to_product(const std::string &);
} // namespace api
} // namespace bts
} // namespace bts
+1 -1
View File
@@ -1,6 +1,6 @@
#include "SecurityDB.h"
#include "lib/logging/logging.h"
#ifndef WIN32
#ifndef _WIN32
#include <SQLiteCpp/SQLiteCpp.h>
#include <sqlite/sqlite3.h>
+6 -8
View File
@@ -1,5 +1,5 @@
#include "lib/domain_model/Security.h"
#ifndef WIN32
#ifndef _WIN32
#include "SecurityIDRecorder.h"
#include "lib/config/config.h"
@@ -46,7 +46,7 @@ struct SecurityIDRecorderState {
void run(utils::Dispatcher &dispatcher) {
timer = std::make_unique<utils::DispatcherTimer>(
dispatcher, 200, [=]() { do_work(); });
dispatcher, 200, [=, this]() { do_work(); });
timer->start();
}
void do_work() {
@@ -210,7 +210,6 @@ void SecurityIDRecorderState::work_handles() {
Security security;
MDProducerHandle handle;
vector<MDProducerHandle> retry;
int count = 0;
while (pending_handle.try_pop(handle)) {
security.Clear();
// if a spread does not have all of its legs we need to wait
@@ -220,7 +219,6 @@ void SecurityIDRecorderState::work_handles() {
retry.push_back(handle);
} else {
convert_security(handle.security(), &security);
++count;
assign_key(security, [handle](const api::Security &security) mutable {
handle.set_key(security.id());
});
@@ -254,7 +252,7 @@ void SecurityIDRecorderState::work_db() {
// If we're unable to create a descriptor try again later
if (descriptor == "") {
defer.push_back(move(temp));
defer.push_back(std::move(temp));
continue;
}
@@ -262,10 +260,10 @@ void SecurityIDRecorderState::work_db() {
if (key != invalid_security_key) {
temp->security.set_id(key);
temp->callback(temp->security);
existing_securities.push_back(move(temp));
existing_securities.push_back(std::move(temp));
} else {
// always push in parallel
new_entries.push_back(move(temp));
new_entries.push_back(std::move(temp));
new_descriptors.push_back(descriptor);
++count;
// Limit the amount of time we spend writing to sqlite during startup
@@ -279,7 +277,7 @@ void SecurityIDRecorderState::work_db() {
for (auto &d : defer) {
LOG(md, Info, "SecurityIDRecorderState::work_db work.push d: {}",
bts::securities::descriptor(d->security));
work.push(move(d));
work.push(std::move(d));
}
if (!new_entries.empty()) {
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
#ifndef WIN32
#ifndef _WIN32
#include "MDProducerHandle.h"
#include "common.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef WIN32
#ifndef _WIN32
#include "SettlementRecorder.h"
#include "lib/config/config.h"
#include "lib/config/protos/system.pb.h"
+3
View File
@@ -18,6 +18,9 @@ using SecurityKey = utils::ValueWrapper<struct SecurityKeyTag, uint32_t>;
using ExchangeKey = utils::ValueWrapper<struct ExchangeKeyTag, uint64_t>;
GCC_DIAG_OFF("-Weffc++") // No Virtual Destructors by design
#ifndef __clang__
GCC_DIAG_OFF("-Wstringop-truncation")
#endif
#define STRING_PROPERTY(NAME) \
const char *NAME() const { return _##NAME; } \
+2 -2
View File
@@ -1,4 +1,4 @@
#ifndef WIN32
#ifndef _WIN32
#include "SyntheticSecurityService.h"
#include "lib/api/public/ServiceContext.h"
@@ -43,7 +43,7 @@ SyntheticSecurityService::SyntheticSecurityService(api::ServiceContext &context)
// load securities
std::set<md::UserSymbol> symbols;
md::get_system_md_symbols(api::VENUE_BTS, api::SECURITYTYPE_UNSET, symbols);
md::db::load_securities(symbols, [=](const api::Security &security) {
md::db::load_securities(symbols, [=, this](const api::Security &security) {
if (security.Contract_case() == api::Security::kSynthetic) {
auto key = SecurityKey(security.id());
_me->synthetics.insert(std::make_pair(key, security));
-1
View File
@@ -1,7 +1,6 @@
#pragma once
#include "lib/md/coconut2.h"
#include "lib/utils/optional.h"
#include <set>
#include <string>
#include <vector>
+11 -9
View File
@@ -98,17 +98,19 @@ struct MDConsumerGroup {
{"exch", Venue_Name(symbol.exchange()).substr(6) /*VENUE_*/});
stats.publish(std::make_shared<metrics::LazyCounterMetricL>(
"spark_md_book_updates",
[=]() { return channel.direct_count() + channel.implied_count(); },
[=, this]() {
return channel.direct_count() + channel.implied_count();
},
labels));
stats.publish(std::make_shared<metrics::LazyCounterMetricL>(
"spark_md_security_count",
[=]() { return channel.security_count(); }, labels));
[=, this]() { return channel.security_count(); }, labels));
stats.publish(std::make_shared<metrics::LazyCounterMetricL>(
"spark_md_trade_count", [=]() { return channel.trade_count(); },
labels));
"spark_md_trade_count",
[=, this]() { return channel.trade_count(); }, labels));
stats.publish(std::make_shared<metrics::LazyCounterMetricD>(
"spark_md_gap_count",
[=]() {
[=, this]() {
auto g = channel.gap_count();
return g == 0 ? os::nan() : g;
},
@@ -231,7 +233,7 @@ class QueryServerImpl : public IQueryServer {
_groups.shrink_to_fit();
_sub = client.on_consumer().subscribe(
[=](const MDConsumer &c) { handle_recovery(c); });
[=, this](const MDConsumer &c) { handle_recovery(c); });
subscribe_securities();
}
QueryServerImpl(const QueryServerImpl &) = delete;
@@ -586,7 +588,7 @@ struct MDRelayServer : bts::co2::AuthenticatedMarketDataRelayBase {
const MDRequest &request,
const std::function<void(const MDReply &)> &reply) override {
TimeStamp start = TimeStamp::now();
_threadpool.post([=]() {
_threadpool.post([=, this]() {
google::protobuf::Arena arena;
MDReply *preply =
google::protobuf::Arena::CreateMessage<MDReply>(&arena);
@@ -633,7 +635,7 @@ struct MDRelayServer : bts::co2::AuthenticatedMarketDataRelayBase {
const api::VoidMessage &,
const std::function<void(const ExpirationNameListReply &)> &reply)
override {
_threadpool.post([=]() {
_threadpool.post([=, this]() {
google::protobuf::Arena arena;
ExpirationNameListReply *preply =
google::protobuf::Arena::CreateMessage<ExpirationNameListReply>(
@@ -647,7 +649,7 @@ struct MDRelayServer : bts::co2::AuthenticatedMarketDataRelayBase {
const api::AuthToken &,
const SecurityKeyList &keys,
const std::function<void(const api::SecurityList &)> &reply) override {
_threadpool.post([=]() {
_threadpool.post([=, this]() {
google::protobuf::Arena arena;
api::SecurityList *preply =
google::protobuf::Arena::CreateMessage<api::SecurityList>(&arena);
+4 -4
View File
@@ -279,7 +279,7 @@ class RelayClient {
}
_rpc.requestmd(
_request,
[=](const api::Result<MDReply> &r) {
[=, this](const api::Result<MDReply> &r) {
receive_md(r);
cont();
},
@@ -292,7 +292,7 @@ class RelayClient {
_writer.write(*result.value(), &has_new_security);
// If the reply included and we have a consumer have it scan them
if (has_new_security && _pconsumer) {
scan_securities_thread().post([=]() {
scan_securities_thread().post([=, this]() {
auto count = _pconsumer->scan_securities(true);
LOG(md, Info, "Discovered {} securities.", count);
});
@@ -335,11 +335,11 @@ struct RelayScheduler {
void run() {
if (running) {
utils::TimeStamp start = utils::TimeStamp::now();
_client.request_md([=]() {
_client.request_md([=, this]() {
int64_t elapsed_ms =
(utils::TimeStamp::now() - start).milliseconds();
int64_t delay = (_interval - elapsed_ms) / speed_factor;
_ctx.post([=]() { run(); }, std::max(delay, (int64_t)0));
_ctx.post([=, this]() { run(); }, std::max(delay, (int64_t)0));
});
}
}
+5 -5
View File
@@ -165,7 +165,7 @@ class Co2Tests {
"}");
}
#ifndef WIN32
#ifndef _WIN32
void test_security_id_recorder(const std::string &db_name) {
// Verify callbacks happen after work complete
auto db1 = sqlite::open_db(db_name.c_str());
@@ -1037,7 +1037,7 @@ class Co2Tests {
REQUIRE(security_count == 5);
}
#ifndef WIN32
#ifndef _WIN32
void test_settlement_recorder() {
using namespace datetime;
security_key k1 = 401, k2 = 402;
@@ -1136,7 +1136,7 @@ TEST_CASE("CO2Tests", "[md]") {
co2_tests->setup();
#ifndef WIN32
#ifndef _WIN32
SECTION("test_security_id_recorder") {
co2_tests->test_security_id_recorder(":memory:");
co2_tests->test_security_id_recorder("file::memory:?cache=shared");
@@ -1175,7 +1175,7 @@ TEST_CASE("CO2Tests", "[md]") {
SECTION("test_retry_unresolved_spread") {
co2_tests->test_retry_unresolved_spread();
}
#ifndef WIN32
#ifndef _WIN32
SECTION("test_settlement_recorder") {
co2_tests->test_settlement_recorder();
}
@@ -1238,7 +1238,7 @@ struct Co2IndexTests {
temp->security.mutable_glbx()->set_exchange_id(id);
temp->exchange_id = id;
temp->handle.key(count);
index.add_security(id, move(temp));
index.add_security(id, std::move(temp));
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef WIN32
#ifndef _WIN32
#include "OnixsUtils.h"
#include "lib/config/config.h"
#include "lib/config/protos/market_data.pb.h"
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
#include "boost/filesystem.hpp"
#include "lib/utils/optional.h"
#include <optional>
namespace bts {
namespace md {
@@ -31,13 +31,12 @@ void BookUtils::change_unit_qty(
int unit_qty) {
//
bts_assert(unit_qty > 0);
int mlev = 0, mlev_qty_used = 0;
int mlev_qty_used = 0;
std::vector<md::PriceSize> unit_lev_span;
for (uint32_t i = 0; i < book_in.size();) {
int mlev_qty_rem = book_in[i].size() - mlev_qty_used;
if (mlev_qty_rem == 0) {
mlev_qty_used = 0;
mlev++;
i++;
continue;
}
@@ -49,7 +48,6 @@ void BookUtils::change_unit_qty(
} else {
unit_lev_span.emplace_back(book_in[i].int_price(), mlev_qty_rem);
mlev_qty_used = 0;
mlev++;
i++;
}
} else {
@@ -278,11 +278,14 @@ PyramidAlgo::_get_creation_params(
// error checking
if (rv.top_spread.value() != serv.security().id())
return std::make_tuple(
rv, false, "Algo can only be launched from the Top Spread");
rv, false,
std::string{"Algo can only be launched from the Top Spread"});
if (rv.cover_spreads.size() < 2)
return std::make_tuple(rv, false, "Not enough cover spreads");
return std::make_tuple(
rv, false, std::string{"Not enough cover spreads"});
if (rv.cover_spreads[0].value() == 0 || rv.cover_spreads[1].value() == 0)
return std::make_tuple(rv, false, "Not enough cover spreads");
return std::make_tuple(
rv, false, std::string{"Not enough cover spreads"});
return std::make_tuple(rv, true, std::string(""));
}
+3 -3
View File
@@ -51,7 +51,7 @@
#include <boost/filesystem.hpp>
#ifdef WIN32
#ifdef _WIN32
#pragma comment(lib, "wbemuuid.lib")
#endif
@@ -616,7 +616,7 @@ std::string get_qualifier() {
}
void enable_core_dumps() {
#ifndef WIN32
#ifndef _WIN32
struct rlimit core_limits;
core_limits.rlim_cur = core_limits.rlim_max = RLIM_INFINITY;
setrlimit(RLIMIT_CORE, &core_limits);
@@ -629,7 +629,7 @@ int get_random_port() {
}
int num_cores() {
#ifdef WIN32
#ifdef _WIN32
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
return sysinfo.dwNumberOfProcessors;
+1 -1
View File
@@ -95,7 +95,7 @@ void TablePublisher::disconnect() {
}
}
#ifndef WIN32
#ifndef _WIN32
void TablePublisher::publish(std::initializer_list<Change> const &changes) {
publish(std::vector<Change>(changes));
}
+1 -1
View File
@@ -29,7 +29,7 @@ class BTS_EXPORT TablePublisher {
TablePublisher &operator=(TablePublisher &&src);
bool is_null() const;
#ifndef WIN32
#ifndef _WIN32
void publish(std::initializer_list<Change> const &changes);
#endif
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef WIN32
#ifndef _WIN32
#ifndef NO_CPP0X
#ifndef __clang__
#pragma GCC diagnostic push
+2 -2
View File
@@ -74,8 +74,8 @@ void Dispatcher::run(size_t threads) {
void Dispatcher::add_thread() {
_me->is_pool = true;
auto t =
threading::make_thread("DispatcherPool", [=]() { _me->service.run(); });
auto t = threading::make_thread(
"DispatcherPool", [=, this]() { _me->service.run(); });
t.detach();
}
+1 -1
View File
@@ -1,5 +1,5 @@
#ifndef NO_CPP0X
#pragma once
#ifndef NO_CPP0X
#include "lib/utils/bts_export.h"
#include "lib/utils/bts_no_copy.h"
+2
View File
@@ -1,4 +1,6 @@
#pragma once
#include <cstdint>
#include <fstream>
#include <iostream>
#include <iterator>
+2 -2
View File
@@ -4,7 +4,7 @@
#include <google/protobuf/timestamp.pb.h>
#include <string>
#ifndef WIN32
#ifndef _WIN32
#include <sys/time.h>
#endif
@@ -37,7 +37,7 @@ template <class T> T from_string(const std::string &str) {
return result;
}
#ifndef WIN32
#ifndef _WIN32
inline google::protobuf::Timestamp pb_now() {
::google::protobuf::Timestamp result;
struct timeval tv;
+2 -2
View File
@@ -74,14 +74,14 @@ struct BoostLowLevelSharedMemoryImpl {
void add_region(shared_memory_object block) {
mapped_region region(block, block.get_mode());
_mappings.push_back(make_pair(move(block), move(region)));
_mappings.push_back(make_pair(std::move(block), std::move(region)));
}
Segment create(const string &name, size_t size) {
try {
shared_memory_object block(create_only, name.c_str(), read_write);
block.truncate(size);
add_region(move(block));
add_region(std::move(block));
return make_segment(size, _mappings.back().second.get_address());
} catch (...) {
return make_segment(0, nullptr);
+1 -1
View File
@@ -1,4 +1,4 @@
#ifndef WIN32
#ifndef _WIN32
#include "Sqlite_utils.h"
#include "bts_assert.h"
#include <cstring>
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
#ifndef WIN32
#ifndef _WIN32
#include "lib/utils/bts_assert.h"
#include <memory>
#include <sqlite/sqlite3.h>
+1 -1
View File
@@ -6,7 +6,7 @@
#include <sys/stat.h>
inline bool is_debugger_present() {
#ifdef WIN32
#ifdef _WIN32
return IsDebuggerPresent();
#else
char buf[1024];
+1 -1
View File
@@ -231,7 +231,7 @@ void FIX_timestamp(PTime const &t, std::string *out) {
int frac_ms = t.time_of_day().total_milliseconds() - whole_ms;
out->resize(sizeof("20121204-14:44:02.000"));
#ifdef WIN32
#ifdef _WIN32
_snprintf(
&(*out)[0], out->size(), "%04d%02d%02d-%02d:%02d:%02d.%03d",
(int)t.date().year(), t.date().month().as_number(),
-60
View File
@@ -1,60 +0,0 @@
#pragma once
// An incomplete version of std::optional which should work well enough on
// Windows until it catch up
#ifdef _WIN32
#include <exception>
namespace std {
class bad_optional_access : exception {};
template <class T> class optional {
bool _has_value;
union {
T _value;
int _unused;
};
public:
optional(const T &value) : _has_value(true), _value(value) {}
optional(T &&value) : _has_value(true), _value(value) {}
optional() : _has_value(false) ~optional() { reset(); }
bool has_value() const { return _has_value; }
operator bool() { return b.has_value(); }
T &operator*() {
if (has_value()) {
return _value;
} else
throw std::bad_optional_access();
}
const T &operator*() const { return **this; }
T &operator->() { return **this; }
const T &operator->() const { return **this; }
bool operator==(const std::optional<T> &other) const {
if (!_has_value && !other.has_value())
return true;
return _has_value == other._has_value && _value == other.value();
}
bool operator!=(const std::optional<T> &other) const {
return !(*this == other);
}
T &value() { return **this; }
const T &value() const { return **this; }
T value_or(T default_value) {
if (has_value())
return _value;
else
return default_value;
}
void reset() {
if (has_value()) {
_value.~T();
_has_value = false;
}
}
// This class is incomplete. Add methods as necessary
};
template <class T> constexpr optional<T> nullopt = {};
} // namespace std
#else
#include <optional>
#endif
+2 -2
View File
@@ -1,6 +1,6 @@
#pragma once
#include "lib/utils/optional.h"
#include <optional>
#include <string>
namespace bts {
@@ -24,4 +24,4 @@ parse_enum(const std::string &value, const std::string &prefix, T2 parse) {
return std::nullopt;
}
}
} // namespace bts
} // namespace bts
+4 -3
View File
@@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
#include <functional>
#include <optional>
#include <string>
@@ -21,16 +22,16 @@ using FilePicker =
void begin_sftp_download(
const std::string host,
uint32_t port,
std::uint32_t port,
const std::string &user,
const std::string &password,
uint32_t time_out_secs,
std::uint32_t time_out_secs,
const FilePicker &picker,
std::function<void(DownloadResult const &)> const);
DownloadResult sftp_download(
const std::string host,
uint32_t port,
std::uint32_t port,
const std::string &user,
const std::string &password,
const FilePicker &on_choose);
+7 -7
View File
@@ -7,7 +7,7 @@
#include <boost/regex.hpp>
#include <fmt/format.h>
#ifndef WIN32
#ifndef _WIN32
#include <pthread.h>
#endif
@@ -26,7 +26,7 @@ config::ThreadGroupCfg get_thread_cfg(std::string const &name) {
std::vector<uint32_t> get_affinity(std::string const &name) {
std::vector<uint32_t> result;
#ifndef WIN32
#ifndef _WIN32
auto cfg = get_thread_cfg(name);
if (cfg.exclude()) {
auto total_cpus = sysconf(_SC_NPROCESSORS_ONLN);
@@ -42,7 +42,7 @@ std::vector<uint32_t> get_affinity(std::string const &name) {
return result;
}
#ifndef WIN32
#ifndef _WIN32
void configure_thread(
std::string const &name, config::ThreadGroupCfg const &cfg, pthread_t t) {
if (cfg.core().size()) {
@@ -72,7 +72,7 @@ void configure_thread(
#endif
void configure_current_thread(std::string const &name) {
#ifndef WIN32
#ifndef _WIN32
configure_thread(name, get_thread_cfg(name), pthread_self());
#endif
os::set_thread_name(name);
@@ -80,7 +80,7 @@ void configure_current_thread(std::string const &name) {
void configure_current_thread(
std::string const &name, config::ThreadGroupCfg const &cfg) {
#ifndef WIN32
#ifndef _WIN32
configure_thread(name, cfg, pthread_self());
#endif
os::set_thread_name(name);
@@ -93,7 +93,7 @@ std::thread make_thread_from_function(
c();
});
#ifndef WIN32
#ifndef _WIN32
configure_thread(name, get_thread_cfg(name), result.native_handle());
#endif
return result;
@@ -107,7 +107,7 @@ std::thread make_thread_from_function(
os::set_thread_name(name);
c();
});
#ifndef WIN32
#ifndef _WIN32
configure_thread(name, cfg, result.native_handle());
#endif
return result;
-1
View File
@@ -1 +0,0 @@
set(sources algo/AlgoDefinitionServiceServer.cpp;analytics/AnalyticsServiceServer.cpp;cmds/AdminReport.cpp;cmds/AutoCert.cpp;cmds/Benchmark.cpp;cmds/CMECert.cpp;cmds/ConfigCheck.cpp;cmds/FIXSim.cpp;cmds/KeyCode.cpp;cmds/Md.cpp;cmds/ParseHistoricalFIX.cpp;cmds/PrintHedgeOrders.cpp;cmds/QuickTest.cpp;cmds/Run.cpp;cmds/Span.cpp;cmds/Spartan.cpp;cmds/Web.cpp;cmds/common/Validators.cpp;cmds/crypto/CryptoCmd.cpp;cmds/crypto/DeribitDemo.cpp;cmds/crypto/DeribitDemoCmd.cpp;cmds/crypto/DeribitDemoConfiguration.cpp;cmds/crypto/DeribitDemoListener.cpp;cmds/crypto/LiveLadderDemo.cpp;cmds/crypto/LiveLadderDemoCmd.cpp;cmds/crypto/UserInstrumentData.cpp;cmds/md/cmds/Channels.cpp;cmds/md/cmds/Cleanup.cpp;cmds/md/cmds/Dump.cpp;cmds/md/cmds/DumpSecurity.cpp;cmds/md/cmds/RecTool.cpp;cmds/md/cmds/Record.cpp;cmds/md/cmds/Relay.cpp;cmds/md/cmds/Replay.cpp;cmds/md/cmds/Run.cpp;cmds/md/cmds/Tail.cpp;cmds/md/cmds/rec_tool/cmds/Print.cpp;cmds/md/cmds/rec_tool/cmds/Trace.cpp;cmds/md/cmds/rec_tool/cmds/Unprint.cpp;cmds/md/common/PlatformOption.cpp;cmds/md/common/SecurityTypeOption.cpp;cmds/md/common/VenueOption.cpp;cmds/spartan/algo/AlgoManager.cpp;cmds/spartan/algo/IAlgo.cpp;cmds/spartan/algo/IAlgoInitService.cpp;cmds/spartan/algo/IAlgoRunService.cpp;cmds/spartan/back_testing/algos/PolyObserver.cpp;cmds/spartan/back_testing/algos/SniperModel.cpp;cmds/spartan/back_testing/algos/TestAlgo.cpp;cmds/spartan/back_testing/algos/spreader/SimOrderGateway.cpp;cmds/spartan/back_testing/algos/spreader/SimSpreader.cpp;cmds/spartan/back_testing/algos/spreader/tests/sim_spreader_tests.cpp;cmds/spartan/back_testing/common/EventRangeMonitor.cpp;cmds/spartan/back_testing/common/IcebergQuantityModification.cpp;cmds/spartan/back_testing/common/OrderModification.cpp;cmds/spartan/back_testing/common/Trace.cpp;cmds/spartan/back_testing/common/mdp3_common.cpp;cmds/spartan/back_testing/common/mdp3_utils.cpp;cmds/spartan/back_testing/common/order_utils.cpp;cmds/spartan/back_testing/common/security_comp.cpp;cmds/spartan/back_testing/common/security_parser.cpp;cmds/spartan/back_testing/feed_observers/BookStatRecorder.cpp;cmds/spartan/back_testing/feed_observers/BookStats.cpp;cmds/spartan/back_testing/feed_observers/CompositeObserver.cpp;cmds/spartan/back_testing/feed_observers/DefinitionCollector.cpp;cmds/spartan/back_testing/feed_observers/FeedObserver.cpp;cmds/spartan/back_testing/feed_observers/FillCounter.cpp;cmds/spartan/back_testing/feed_observers/IcebergFinder.cpp;cmds/spartan/back_testing/feed_observers/SyntheticBookRecorder.cpp;cmds/spartan/back_testing/feed_observers/recorders/MatcherBookRecorder.cpp;cmds/spartan/back_testing/feed_observers/recorders/MatcherFillRecorder.cpp;cmds/spartan/back_testing/feed_observers/recorders/MatcherProcTimeRecorder.cpp;cmds/spartan/back_testing/feed_observers/recorders/MatcherRecorder.cpp;cmds/spartan/back_testing/implied/implied_market.cpp;cmds/spartan/back_testing/matcher/FifoImpliedSecurityMatcher.cpp;cmds/spartan/back_testing/matcher/FifoMatcherContext.cpp;cmds/spartan/back_testing/matcher/FifoMergedSecurityMatcher.cpp;cmds/spartan/back_testing/matcher/FifoPriceLevelMatcher.cpp;cmds/spartan/back_testing/matcher/FifoSecurityMatcher.cpp;cmds/spartan/back_testing/matcher/FillDepot.cpp;cmds/spartan/back_testing/matcher/Matcher.cpp;cmds/spartan/back_testing/matcher/MatchingCommon.cpp;cmds/spartan/back_testing/matcher/common/IcebergFileCache.cpp;cmds/spartan/back_testing/matcher/common/MatcherOneof.cpp;cmds/spartan/back_testing/matcher/common/MatcherOrder.cpp;cmds/spartan/back_testing/matcher/common/MatchingSession.cpp;cmds/spartan/back_testing/matcher/iceberg_helper.cpp;cmds/spartan/back_testing/matcher/tests/matcher_tests.cpp;cmds/spartan/back_testing/sim/ISim.cpp;cmds/spartan/back_testing/sim/PCapEventGenerator.cpp;cmds/spartan/back_testing/sim/PCapEventSource.cpp;cmds/spartan/back_testing/sim/PCapOrderChangeBootstrapper.cpp;cmds/spartan/back_testing/sim/PandL.cpp;cmds/spartan/back_testing/sim/Sim.cpp;cmds/spartan/back_testing/sim/SimDB.cpp;cmds/spartan/back_testing/sim/SimSessionOptions.proto;cmds/spartan/back_testing/sim/run_sim.cpp;cmds/spartan/back_testing/sim/spark_bridge/AlgoServicesBridge.cpp;cmds/spartan/back_testing/sim/spark_bridge/BeforeLaunchBridge.cpp;cmds/spartan/cmds/BookStats.cpp;cmds/spartan/cmds/CSV.cpp;cmds/spartan/cmds/Compress.cpp;cmds/spartan/cmds/FindPolys.cpp;cmds/spartan/cmds/Icebergs.cpp;cmds/spartan/cmds/Json.cpp;cmds/spartan/cmds/ListSec.cpp;cmds/spartan/cmds/MatcherCmd.cpp;cmds/spartan/cmds/PolygonBooks.cpp;cmds/spartan/cmds/SQL.cpp;cmds/spartan/cmds/Sim.cpp;cmds/spartan/cmds/Stats.cpp;cmds/spartan/cmds/Test.cpp;cmds/spartan/cmds/ValuePolys.cpp;cmds/spartan/cmds/matcher/cmds/BooksCmd.cpp;cmds/spartan/cmds/matcher/cmds/FillsCmd.cpp;cmds/spartan/cmds/matcher/cmds/ProcTimeCmd.cpp;cmds/spartan/cmds/matcher/common/InitData.cpp;cmds/spartan/common/DataPacket.cpp;cmds/spartan/common/EndPoint.cpp;cmds/spartan/common/SpartanError.cpp;cmds/spartan/common/Stopwatch.cpp;cmds/spartan/common/TimeIntervaLine truncated
+19 -11
View File
@@ -21,9 +21,11 @@ add_executable(sparkd ${Sparkd_Sources} ${Proto_Srcs})
# include paths
target_include_directories(
sparkd PUBLIC
${CMAKE_SOURCE_DIR}/src/server/sparkd/cmds/spartan
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src/server/sparkd/cmds/spartan ${emumba-deribit-connector-library_INCLUDE_DIRS})
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/server/sparkd/cmds/spartan>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src/server/sparkd/cmds/spartan>
$<BUILD_INTERFACE:${emumba-deribit-connector-library_INCLUDE_DIRS}>
)
find_package(PkgConfig REQUIRED)
pkg_check_modules(emumba-deribit-connector-library REQUIRED emumba-deribit-connector)
@@ -31,7 +33,10 @@ pkg_check_modules(emumba-deribit-connector-library REQUIRED emumba-deribit-conne
# This dir contains rapidjsonConfig.cmake
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
find_package(rapidjson REQUIRED)
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${rapidjson_INCLUDE_DIR})
target_include_directories(
sparkd SYSTEM PUBLIC
$<BUILD_INTERFACE:${rapidjson_INCLUDE_DIR}>
)
add_dependencies(${PROJECT_NAME} rapidjson_project)
# deribit-demo log level
@@ -64,6 +69,14 @@ else()
message("-- Building of DERIBIT_DEMO_LOG_LEVEL=TRACE")
endif()
# Set RPATH so sparkd knows where to find our shared libs (e.g., libspark).
# The dirs are relative to sparkd's path, represented by "$ORIGIN".
set_target_properties(
${PROJECT_NAME} PROPERTIES
BUILD_RPATH "${ORIGIN}/../../lib;${EXTERNALS_LIB}"
INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
)
# linking
target_link_libraries(
sparkd
@@ -86,10 +99,5 @@ target_link_libraries(
-static-libstdc++
-pthread)
add_custom_command(
TARGET sparkd
POST_BUILD
COMMAND ln -fs ${CMAKE_BINARY_DIR}/src/lib/libspark.so ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ln ARGS -sf ${EXTERNALS_ROOT}/../src/emumba/sparkd.lic ${CMAKE_BINARY_DIR}/src/server/sparkd)
install(TARGETS sparkd DESTINATION bin)
include(${CMAKE_SOURCE_DIR}/cmake/InstallBasic.cmake)
install_basic()
+5
View File
@@ -0,0 +1,5 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components(@PROJECT_NAME@)
Loaded 100 of 124 files, more files were not shown because too many files have changed in this diff. Show more