Compare commits

...
Author SHA1 Message Date
John Colvin 565343e7d2 Update externals 2022-08-02 22:23:18 -04:00
John Colvin 68a41ef89b tools: Try to organize the script soup that is the tools dir 2022-07-01 18:06:22 -05:00
John Colvin d9447ce7a1 tools: Move git-related scripts into 'git' dir 2022-07-01 18:06:22 -05:00
John Colvin aca6988a76 tools: Remove unused scripts/files 2022-07-01 18:06:22 -05:00
John Colvin 2422bd0c63 tools: Rename dir cpp_helper -> cme
The 'cpp' stands for 'cash-per-point' in this case.  Renaming the dir
'cme' to avoid confusion, as 'cpp' usually means c++ in our line of work.
Furthermore, the script only generates cash-per-points for CME symbols.
2022-07-01 18:06:22 -05:00
John Colvin 87d3cf16b7 chore: Update deprecated boost spirit/phoenix includes 2022-07-01 18:06:22 -05:00
John Colvin a6c3ef3d16 refactor (client cpp): Upgrade catch test framework to catch2 2022-07-01 18:06:22 -05:00
John Colvin 99451eb3e7 Replace external deps w/ conan pkgs 2022-07-01 18:06:22 -05:00
John Colvin 8301fdccf4 build (client cpp): Configure cmake build w/ presets 2022-07-01 13:18:05 -05:00
John Colvin 8122e22c1b build (client cpp): Remove ZERO_CHECK.vcxproj from spark_client.sln
The new cmake generates ZERO_CHECK.proj instead, which doesn't need to be
included in the sln
2022-07-01 13:18:05 -05:00
John Colvin 78fece194f build (client cpp): Copy cpp Directory.Build.Props during cmake build 2022-07-01 13:18:05 -05:00
John Colvin f5f01857d4 build (client): Remove unused option '--link-output-dir' 2022-07-01 13:18:05 -05:00
John Colvin 062eb531bd build (sparkd): Shorten install prefix 2022-07-01 13:18:05 -05:00
John Colvin 91c0661657 chore: Consolidate if/else WIN32 logic in libspark CMakeLists 2022-07-01 13:18:05 -05:00
John Colvin ddd51417a0 chore: Remove unnecessary websocketpp includes
No websocketpp symbols are referenced anywhere.  This dependency should be
removed from externals
2022-07-01 13:18:05 -05:00
John Colvin fd80914f15 chore: Remove unused sln, vcxproj files 2022-07-01 13:18:05 -05:00
John Colvin e537d3ce51 build (win client cpp): Remove vs_filters.cmake 2022-07-01 13:18:05 -05:00
John Colvin e6b1cbbe01 build (client cpp): Stop disabling compiler warnings 2022-07-01 13:18:05 -05:00
John Colvin a20b92bdbd fix build (cpp win): Use builtin memcpy
Our custom impl, bts::os::memcpy, only works in linux.
Note: The reason we have a custom memcpy impl is to disable a pesky warning
about using memcpy for non-trivial copy assignment
2022-07-01 13:18:05 -05:00
John Colvin 5faedf45cc chore: Remove custom optional.h (no longer needed)
Now windows builtin includes provide optional
2022-07-01 13:18:05 -05:00
John Colvin aad6d1b5e3 fix build (preemptive): Make numeric casts explicit 2022-07-01 13:18:05 -05:00
John Colvin 4692256751 fix build (win cpp): Change WIN32 macro to _WIN32 2022-07-01 13:18:04 -05:00
John Colvin 0eff4dcc86 fix build (gcc release): Include openssl files in global ns 2022-07-01 13:18:04 -05:00
John Colvin 245c22a040 webserver: Remove hardcoded 'sparkvm' host 2022-07-01 13:18:04 -05:00
John Colvin b5bd976aa6 build: Update dotnet-format 2022-07-01 13:18:04 -05:00
John Colvin 6162c4b42f build: Migrate web build to net6.0
Clean up the web build process a bit while we're at it
* Add 'custom_commands' to run npm install in CMakeLists
* Generate tsconfig files for CMake preset configurations
* Rename local variables to _snake_case in CMakeLists
2022-07-01 13:18:04 -05:00
John Colvin 817ec73b3e build: Replace setup_builds w/ CMakePresets.json
Clean up CMakeLists a bit in the process:
   * Define more cmake vars in CMakePresets
   * Split linux/windows presets into separate files
2022-07-01 13:18:04 -05:00
John Colvin e79e557e88 dev/gen: Add script to dump CMakeDeps in readable form 2022-07-01 13:10:45 -05:00
John Colvin 0c1698520b build: Remove server/sparkd from libspark include path 2022-07-01 12:35:01 -05:00
John Colvin 6abec0c035 chore (linux build): Add benign changes to satisfy gcc11 2022-06-28 02:15:57 -04:00
johncolvin-og f0021138e4 chore (linux build): Add benign changes to satisfy clang13 2022-06-28 02:15:57 -04:00
John Colvin 131f5e7465 build: Automate venv activation in server build 2022-06-28 02:15:57 -04:00
John Colvin 850d304590 build: Update cmake-min-version to 3.12
Several 'add_compile_definitions' calls were added to the root
CMakeLists.txt as part of the ccapi_cpp lib integration (3.12 is the
version in which that call was introduced)
2022-06-28 02:15:57 -04:00
John Colvin 0dfced02ef Update docker/linux to get ccapi_cpp deps 2022-06-28 02:15:57 -04:00
284 changed files with 19706 additions and 14756 deletions

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
[settings]
os=Windows
compiler='Visual Studio'
build_type=Debug
arch=x86_64
compiler.version=17
compiler.runtime=MTd
[options]
boost:without_graph=True
boost:without_iostreams=True
boost:without_json=True
boost:without_log=True
boost:without_math=True
boost:without_nowide=True
boost:without_program_options=True
boost:without_python=True
boost:without_random=True
boost:without_serialization=True
boost:without_test=True
boost:without_timer=True
boost:without_wave=True
boost:layout=system
boost:multithreading=True
[build_requires]
[env]
+28
View File
@@ -0,0 +1,28 @@
[settings]
os=Windows
compiler='Visual Studio'
build_type=Release
arch=x86_64
compiler.version=17
compiler.runtime=MT
[options]
boost:without_graph=True
boost:without_iostreams=True
boost:without_json=True
boost:without_log=True
boost:without_math=True
boost:without_nowide=True
boost:without_program_options=True
boost:without_python=True
boost:without_random=True
boost:without_serialization=True
boost:without_test=True
boost:without_timer=True
boost:without_wave=True
boost:layout=system
boost:multithreading=True
[build_requires]
[env]
+7 -1
View File
@@ -3,10 +3,16 @@
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "5.1.225507",
"version": "5.1.250801",
"commands": [
"dotnet-format"
]
},
"protobuf-net.protogen": {
"version": "3.1.17",
"commands": [
"protogen"
]
}
}
}
+2
View File
@@ -50,3 +50,5 @@ trace_data/
*.tmp/*
/.venv*/*
.cache/
src/web/api/tsconfig.*.g.json
.conan/windows/install/*
+22 -50
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.12)
project(spark)
if(WIN32)
@@ -7,73 +7,45 @@ else()
set(platform "linux")
endif()
set(EXTERNALS_ROOT "${CMAKE_SOURCE_DIR}/externals/${platform}")
set(SPARK_PYTHON "${EXTERNALS_ROOT}/python")
set(
EXTERNALS_ROOT
"${CMAKE_SOURCE_DIR}/externals/${platform}"
CACHE
STRING
"External dependencies root folder (should contain folders: lib, bin, include")
set(SPARK_BIN "${EXTERNALS_ROOT}/bin")
set(SPARK_INCLUDE "${EXTERNALS_ROOT}/include")
set(SPARK_LIB "${EXTERNALS_ROOT}/lib/${CMAKE_BUILD_TYPE}")
set(TOOLS "${CMAKE_SOURCE_DIR}/tools")
set(BUILD_SDK OFF CACHE BOOL "Build the sdk")
set(BUILD_WEB ON CACHE BOOL "Build the web server")
include(${CMAKE_SOURCE_DIR}/.conan/${platform}/install/debug/conanbuildinfo.cmake)
set(CONAN_SYSTEM_INCLUDES ON)
conan_basic_setup()
include_directories(BEFORE SYSTEM ${SPARK_INCLUDE} ${EXTERNALS_ROOT}/include/zlib)
link_directories(${SPARK_LIB})
if(WIN32)
# flags
set(
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} \
/MP \
/WX /wd4251 /wd4250 /wd4251 /wd4244 /wd4267 /wd4355 /wd4275 /wd4345 \
/bigobj \
/DCURL_STATICLIB \
/D_WINSOCK_DEPRECATED_NO_WARNINGS \
/D__TBB_NO_IMPLICIT_LINKAGE \
/DBOOST_ALL_NO_LIB \
/std:c++17 \
/D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} /MT")
set(
CMAKE_SHARED_LINKER_FLAGS_RELEASE
"${CMAKE_SHARED_LINKER_FLAGS_RELEASE} \
/DEBUG \
/OPT:REF \
/OPT:ICF \
/LTCG")
# subdirs
add_subdirectory(src/lib)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/Directory.Build.Props
COMMAND cp ARGS ${TOOLS}/cpp.build.props ${CMAKE_BINARY_DIR}/Directory.Build.Props
DEPENDS ${TOOLS}/cpp.build.props
COMMENT "Copy cpp.build.props -> Directory.Build.Props")
add_custom_target(client_layout ALL DEPENDS ${CMAKE_BINARY_DIR}/Directory.Build.Props)
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)
add_compile_definitions(CCAPI_ENABLE_LOG_WARN)
# flags
set(
CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} \
-fPIC \
-Wall \
-pedantic \
-Wextra \
-Werror \
-Wno-missing-braces \
-Wno-ignored-qualifiers \
--std=c++17 -fdiagnostics-color")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -DNDEBUG -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wno-undef")
# subdirs
add_subdirectory(src/server/sparkd)
add_subdirectory(src/lib)
if (BUILD_WEB)
if(BUILD_WEB)
add_subdirectory(src/web)
endif()
add_subdirectory(doc/user)
@@ -90,9 +62,9 @@ else()
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
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"
+224
View File
@@ -0,0 +1,224 @@
{
"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",
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/MP /WX /bigobj /EHsc /DCURL_STATICLIB /D_WINSOCK_DEPRECATED_NO_WARNINGS /D__TBB_NO_IMPLICIT_LINKAGE /DBOOST_ALL_NO_LIB /std:c++17 /D_WIN32_WINNT=0x0600",
"CMAKE_CXX_FLAGS_DEBUG": "/MTd",
"CMAKE_CXX_FLAGS_RELEASE": "/MT",
"CMAKE_SHARED_LINKER_FLAGS_RELEASE": "/DEBUG /OPT:REF /OPT:ICF /LTCG",
"CONAN_COMPILER": "Visual Studio",
"CONAN_COMPILER_VERSION": "17",
"EXTERNALS_ROOT": "${sourceDir}/externals/windows"
}
},
{
"name": "sparkd",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"platform": "",
"CMAKE_BUILD_WITH_INSTALL_RPATH": {
"type": "BOOL",
"value": "ON"
},
"CMAKE_INSTALL_RPATH": ".",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
"CMAKE_EXE_LINKER_FLAGS": "-Wno-undef",
"EXTERNALS_ROOT": "${sourceDir}/externals/linux",
"CMAKE_C_COMPILER": "cc",
"CMAKE_CXX_STANDARD": "17",
"WEB_TSCONFIG_NAME": "${presetName}",
"BUILD_SDK": {
"type": "BOOL",
"value": "OFF"
},
"BUILD_WEB": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "sparkd-dev",
"hidden": true,
"inherits": "sparkd",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS_DEBUG": "-fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers --std=c++17 -fdiagnostics-color",
"CMAKE_EXPORT_COMPILE_COMMANDS": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "sparkd-prod",
"hidden": true,
"inherits": "sparkd",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS_RELEASE": "-fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers --std=c++17 -fdiagnostics-color -fno-omit-frame-pointer -DNDEBUG -O3"
}
},
{
"name": "sparkd-dev-clang",
"inherits": "sparkd-dev",
"displayName": "Development (clang)",
"description": "Debug build compiled w/ clang",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang++"
}
},
{
"name": "sparkd-dev-gcc",
"inherits": "sparkd-dev",
"displayName": "Development (gcc)",
"description": "Debug build compiled w/ gcc",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++"
}
},
{
"name": "sparkd-prod-clang",
"inherits": "sparkd-prod",
"displayName": "Production (clang)",
"description": "Release build compiled w/ clang",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang++"
}
},
{
"name": "sparkd-prod-gcc",
"inherits": "sparkd-prod",
"displayName": "Production (gcc)",
"description": "Release build compiled w/ gcc",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++"
}
},
{
"name": "sparkd-publish",
"inherits": "sparkd",
"displayName": "Publish",
"description": "Publish build compiled w/ gcc and ready to ship",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++"
}
}
],
"buildPresets": [
{
"name": "spark",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"hidden": true,
"jobs": 4
},
{
"name": "spark-dev",
"displayName": "Development",
"inherits": "spark",
"configurePreset": "spark",
"configuration": "Debug"
},
{
"name": "spark-prod",
"displayName": "Production",
"inherits": "spark",
"configurePreset": "spark",
"configuration": "Release"
},
{
"name": "sparkd",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"hidden": true,
"jobs": 4,
"targets": [
"data_files_dir",
"doc_manual_bundle",
"install",
"libspark",
"rapidjson_project",
"server_layout",
"sparkd",
"web_ui_bundle"
]
},
{
"name": "sparkd-dev-clang",
"configurePreset": "sparkd-dev-clang",
"displayName": "Development (clang)",
"inherits": "sparkd"
},
{
"name": "sparkd-dev-gcc",
"configurePreset": "sparkd-dev-gcc",
"displayName": "Development (gcc)",
"inherits": "sparkd"
},
{
"name": "sparkd-prod-clang",
"configurePreset": "sparkd-prod-clang",
"displayName": "Production (clang)",
"inherits": "sparkd"
},
{
"name": "sparkd-prod-gcc",
"configurePreset": "sparkd-prod-gcc",
"displayName": "Production (gcc)",
"inherits": "sparkd"
},
{
"name": "sparkd-publish",
"configurePreset": "sparkd-publish",
"displayName": "Publish",
"inherits": "sparkd",
"targets": "install"
}
]
}
+3 -4
View File
@@ -1,6 +1,4 @@
set(Protobuf_PROTOC_EXECUTABLE "${SPARK_BIN}/protoc")
set(PROTOBUF_INCLUDE_DIRS "${SPARK_INCLUDE}")
set(PROTOBUF_STATIC_LIB "libprotobuf")
function(Protobuf_Generate_Cpp SRCS HDRS)
set(${SRCS})
@@ -106,8 +104,9 @@ function(Service_Compiler_Generate_Cpp SRCS HDRS)
"${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.client.pb.h"
"${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.server.pb.cc"
"${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.server.pb.h"
COMMAND
"PYTHONPATH=${SPARK_PYTHON}" ${Protobuf_PROTOC_EXECUTABLE} ARGS
COMMAND ${CMAKE_SOURCE_DIR}/tools/venv_exec.sh
ARGS
${Protobuf_PROTOC_EXECUTABLE}
--cpp_out=${CMAKE_BINARY_DIR}/src
--plugin=protoc-gen-service=${CMAKE_SOURCE_DIR}/src/lib/api/service_compiler/plugin.py
--service_out=lang=cpp,make_file_name=${ABS_FIL}:${CMAKE_BINARY_DIR}/src
+16
View File
@@ -0,0 +1,16 @@
from conans import ConanFile
class SparkCryptoConan(ConanFile):
name = "spark_crypto"
version = "0.1"
author = "Blue Trading Solutions"
topics = (
"crypto", "trading", "options", "futures", "derivatives", "api",
"risk", "volatility", "finance")
requires = [
"boost/1.79.0", "catch2/3.0.1", "cmake/3.23.2", "fmt/8.1.1",
"libcurl/7.83.1", "nlohmann_json/3.10.5", "openssl/1.1.1o",
"protobuf/3.21.1", "onetbb/2021.3.0", "zlib/1.2.12"
]
generators = ("cmake", "virtualenv")
+40
View File
@@ -0,0 +1,40 @@
import os
import subprocess
import argparse
def _exit(code=0, msg=None):
if msg is not None:
print(msg)
exit(code)
def _literal_linesep():
ls = os.linesep
if ls == '\r\n':
return r'\r\n'
if ls == '\n':
return r'\n'
return ls
def _get_arg_parser():
parser = argparse.ArgumentParser(description='Build spark_client.sln')
parser.add_argument('input', nargs='?', help='The CMakeDeps file to dump')
return parser
def _main():
parser = _get_arg_parser()
args = parser.parse_args()
cmd_args = ['sed', fr"'s/;/{_literal_linesep()}/g'", args.input]
return subprocess.run(cmd_args)
if __name__ == '__main__':
try:
res = _main()
if res.returncode != 0:
_exit(1, str(res))
except Exception as e:
_exit(1, str(e))
+22
View File
@@ -1,17 +1,39 @@
astroid==2.7.3
autopep8==1.5.7
bottle==0.12.21
certifi==2022.6.15
cffi==1.14.6
charset-normalizer==2.1.0
colorama==0.4.4
conan==1.50.0
fasteners==0.17.3
gitdb==4.0.9
idna==3.3
isort==5.9.3
Jinja2==3.1.2
lazy-object-proxy==1.6.0
MarkupSafe==2.1.1
mccabe==0.6.1
node-semver==0.6.1
patch-ng==1.17.4
platformdirs==2.3.0
pluginbase==1.0.1
protobuf==3.19.1
pybars3==0.9.7
pycodestyle==2.7.0
pycparser==2.20
Pygments==2.12.0
PyJWT==2.4.0
pylint==2.10.2
PyMeta3==0.5.1
python-dateutil==2.8.2
PyYAML==6.0
requests==2.28.1
six==1.16.0
smmap==5.0.0
termcolor==1.1.0
toml==0.10.2
tqdm==4.64.0
urllib3==1.26.9
wrapt==1.12.1
yapf==0.31.0
-41
View File
@@ -1,41 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sparkd", "src\server\sparkd\sparkd.vcxproj", "{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspark", "build\src\lib\libspark.vcxproj", "{502FD050-679A-3B50-B438-098500700919}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
MinSizeRel|x64 = MinSizeRel|x64
Release|x64 = Release|x64
RelWithDebInfo|x64 = RelWithDebInfo|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.Debug|x64.ActiveCfg = Debug|x64
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.Debug|x64.Build.0 = Debug|x64
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.MinSizeRel|x64.ActiveCfg = Release|x64
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.MinSizeRel|x64.Build.0 = Release|x64
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.Release|x64.ActiveCfg = Release|x64
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.Release|x64.Build.0 = Release|x64
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.RelWithDebInfo|x64.Build.0 = Release|x64
{502FD050-679A-3B50-B438-098500700919}.Debug|x64.ActiveCfg = Debug|x64
{502FD050-679A-3B50-B438-098500700919}.Debug|x64.Build.0 = Debug|x64
{502FD050-679A-3B50-B438-098500700919}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
{502FD050-679A-3B50-B438-098500700919}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
{502FD050-679A-3B50-B438-098500700919}.Release|x64.ActiveCfg = Release|x64
{502FD050-679A-3B50-B438-098500700919}.Release|x64.Build.0 = Release|x64
{502FD050-679A-3B50-B438-098500700919}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
{502FD050-679A-3B50-B438-098500700919}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6A7249D7-B40C-4656-9347-60072D0B8FDB}
EndGlobalSection
EndGlobal
+22 -22
View File
@@ -1,10 +1,10 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
# Visual Studio Version 17
VisualStudioVersion = 17.2.32616.157
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", "{9FA60215-26AF-3EB7-AB89-D4F4B126EF40}"
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
@@ -12,15 +12,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "sparkcmd", "src\client\spar
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "spark_core", "src\client\spark_core\spark_core.csproj", "{6E449EB6-20AC-4FA6-B8D9-10F4BB7E1FEE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZERO_CHECK", "build\ZERO_CHECK.vcxproj", "{A1B7276B-8F81-3D58-A22E-870AF28DF9B9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "spark_sdk", "src\client\spark_sdk\spark_sdk.csproj", "{6963C314-83C4-4667-B0D0-C2F7AE208C29}"
ProjectSection(ProjectDependencies) = postProject
{9FA60215-26AF-3EB7-AB89-D4F4B126EF40} = {9FA60215-26AF-3EB7-AB89-D4F4B126EF40}
{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
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_layout", "build\client_layout.vcxproj", "{7BD9B47C-9AEA-3F81-B8E4-73C74C1932A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -37,14 +37,14 @@ Global
{DC9A8975-8211-4FC9-A9BA-C8B9D26AD481}.Release|x64.Build.0 = Release|x64
{DC9A8975-8211-4FC9-A9BA-C8B9D26AD481}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{DC9A8975-8211-4FC9-A9BA-C8B9D26AD481}.RelWithDebInfo|x64.Build.0 = Release|x64
{9FA60215-26AF-3EB7-AB89-D4F4B126EF40}.Debug|x64.ActiveCfg = Debug|x64
{9FA60215-26AF-3EB7-AB89-D4F4B126EF40}.Debug|x64.Build.0 = Debug|x64
{9FA60215-26AF-3EB7-AB89-D4F4B126EF40}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
{9FA60215-26AF-3EB7-AB89-D4F4B126EF40}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
{9FA60215-26AF-3EB7-AB89-D4F4B126EF40}.Release|x64.ActiveCfg = Release|x64
{9FA60215-26AF-3EB7-AB89-D4F4B126EF40}.Release|x64.Build.0 = Release|x64
{9FA60215-26AF-3EB7-AB89-D4F4B126EF40}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
{9FA60215-26AF-3EB7-AB89-D4F4B126EF40}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
{FDC3A021-386E-3A2C-A7EB-CBE94A95BE25}.Debug|x64.ActiveCfg = Debug|x64
{FDC3A021-386E-3A2C-A7EB-CBE94A95BE25}.Debug|x64.Build.0 = Debug|x64
{FDC3A021-386E-3A2C-A7EB-CBE94A95BE25}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
{FDC3A021-386E-3A2C-A7EB-CBE94A95BE25}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
{FDC3A021-386E-3A2C-A7EB-CBE94A95BE25}.Release|x64.ActiveCfg = Release|x64
{FDC3A021-386E-3A2C-A7EB-CBE94A95BE25}.Release|x64.Build.0 = Release|x64
{FDC3A021-386E-3A2C-A7EB-CBE94A95BE25}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
{FDC3A021-386E-3A2C-A7EB-CBE94A95BE25}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
{9A4D4D07-1AB6-4B2B-B111-A4F34D6C267E}.Debug|x64.ActiveCfg = Debug|x64
{9A4D4D07-1AB6-4B2B-B111-A4F34D6C267E}.Debug|x64.Build.0 = Debug|x64
{9A4D4D07-1AB6-4B2B-B111-A4F34D6C267E}.MinSizeRel|x64.ActiveCfg = Release|x64
@@ -69,14 +69,6 @@ Global
{6E449EB6-20AC-4FA6-B8D9-10F4BB7E1FEE}.Release|x64.Build.0 = Release|x64
{6E449EB6-20AC-4FA6-B8D9-10F4BB7E1FEE}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{6E449EB6-20AC-4FA6-B8D9-10F4BB7E1FEE}.RelWithDebInfo|x64.Build.0 = Release|x64
{A1B7276B-8F81-3D58-A22E-870AF28DF9B9}.Debug|x64.ActiveCfg = Debug|x64
{A1B7276B-8F81-3D58-A22E-870AF28DF9B9}.Debug|x64.Build.0 = Debug|x64
{A1B7276B-8F81-3D58-A22E-870AF28DF9B9}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
{A1B7276B-8F81-3D58-A22E-870AF28DF9B9}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
{A1B7276B-8F81-3D58-A22E-870AF28DF9B9}.Release|x64.ActiveCfg = Release|x64
{A1B7276B-8F81-3D58-A22E-870AF28DF9B9}.Release|x64.Build.0 = Release|x64
{A1B7276B-8F81-3D58-A22E-870AF28DF9B9}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
{A1B7276B-8F81-3D58-A22E-870AF28DF9B9}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
{6963C314-83C4-4667-B0D0-C2F7AE208C29}.Debug|x64.ActiveCfg = Debug|x64
{6963C314-83C4-4667-B0D0-C2F7AE208C29}.Debug|x64.Build.0 = Debug|x64
{6963C314-83C4-4667-B0D0-C2F7AE208C29}.MinSizeRel|x64.ActiveCfg = Release|x64
@@ -93,6 +85,14 @@ Global
{ECD78CC5-138F-4809-A764-2358C2AC2E82}.Release|x64.Build.0 = Release|x64
{ECD78CC5-138F-4809-A764-2358C2AC2E82}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{ECD78CC5-138F-4809-A764-2358C2AC2E82}.RelWithDebInfo|x64.Build.0 = Release|x64
{7BD9B47C-9AEA-3F81-B8E4-73C74C1932A9}.Debug|x64.ActiveCfg = Debug|x64
{7BD9B47C-9AEA-3F81-B8E4-73C74C1932A9}.Debug|x64.Build.0 = Debug|x64
{7BD9B47C-9AEA-3F81-B8E4-73C74C1932A9}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
{7BD9B47C-9AEA-3F81-B8E4-73C74C1932A9}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
{7BD9B47C-9AEA-3F81-B8E4-73C74C1932A9}.Release|x64.ActiveCfg = Release|x64
{7BD9B47C-9AEA-3F81-B8E4-73C74C1932A9}.Release|x64.Build.0 = Release|x64
{7BD9B47C-9AEA-3F81-B8E4-73C74C1932A9}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
{7BD9B47C-9AEA-3F81-B8E4-73C74C1932A9}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+2 -2
View File
@@ -29,8 +29,8 @@
<PropertyGroup Label="ProtoBuf">
<ProtocPluginBase>$(SparkRoot)\src\lib\api\service_compiler</ProtocPluginBase>
<protoc>$(Externals)\bin\protoc.exe</protoc>
<protogen>$(Externals)\bin\protogen.exe</protogen>
<protoc>protoc</protoc>
<protogen>dotnet protogen</protogen>
</PropertyGroup>
<ItemDefinitionGroup>
+3 -6
View File
@@ -3,7 +3,7 @@
<Target
Name="CompileProto2"
Condition="'@(Proto2)'!=''"
Inputs="$(MSBuildProjectFile);$(protogen);%(Proto2.FullPath)"
Inputs="$(MSBuildProjectFile);%(Proto2.FullPath)"
Outputs="$(GenDir)\proto2\%(Proto2.filename).cs"
AfterTargets="PreBuildEvent">
<PropertyGroup>
@@ -17,9 +17,6 @@
DestinationFolder="$(WorkingDirectory)"
SkipUnchangedFiles="True"
UseHardLinksIfPossible="True" />
<Error
Text="protogen.exe does not exist. If you forgot to clone with externals try: git submodule update --init --recursive"
Condition="!Exists($(protogen))" />
<Exec
Command="$(Protogen) %(Proto2.filename)%(proto2.extension) --csharp_out=. -I. -I$(SourceRoot) -I$(Externals)\include"
WorkingDirectory="$(WorkingDirectory)" />
@@ -37,7 +34,7 @@
Name="CompileProto3"
AfterTargets="GetAssemblyVersion"
Condition="'@(Proto3)'!=''"
Inputs="$(protoc);
Inputs="
%(Proto3.Identity);$(ProtocPluginBase)\plugin.py;
$(ProtocPluginBase)\templates\c#\client.pb.cs;
$(ProtocPluginBase)\templates\c#\server.pb.cs;
@@ -52,7 +49,7 @@
<Exec Command="set PYTHONPATH=$(SparkRoot)\.venv\Scripts\python" />
<Exec
Command="
$(SparkRoot)\tools\build_protos.cmd ^
$(protoc) ^
%(Proto3.FullPath) ^
--error_format=msvs ^
--proto_path=$(SourceRoot) ^
@@ -117,10 +117,10 @@ namespace mbts.spark {
}
Log.Ui.info($"VolSurfaceUsageList name_to_ids count: {name_to_ids.Count}");
var vs_usage = mbts.config.Configuration.get<bts.config.toggles.VolSurfaceUsage>();
Log.Ui.info($"VolSurfaceUsageList vs_usage acount: {vs_usage.vol_surface_usage.Count}");
foreach (var u in vs_usage.vol_surface_usage) {
string option_name = u.option_name;
string vs_name = u.vs_name;
Log.Ui.info($"VolSurfaceUsageList vs_usage acount: {vs_usage.VolSurfaceUsages.Count}");
foreach (var u in vs_usage.VolSurfaceUsages) {
string option_name = u.OptionName;
string vs_name = u.VsName;
int vs_key;
if (name_to_ids.TryGetValue(vs_name, out vs_key)) {
ulist.UsageList.Add(new VolSurfaceUsageEntry() {
@@ -20,7 +20,7 @@ namespace mbts.spark {
[ImportingConstructor]
public AlgoProviderFactory(IAlgoStudioModel studio_model, DynamicOrderHelper dynamic_helper, ISecurityAuxiliaryDataModel security_auxiliary_model) {
var from_conf = config.Configuration.get<bts.config.AlgoTypeRuleSet>();
if (from_conf.rules.Count == 0) {
if (from_conf.Rules.Count == 0) {
// There seems to be a config race bug, where the returned config values are empty, despite having entries in spark.conf.
// [John]I've only noticed it happen when attached to the debugger,
// but best to have a contingency plan in place anyways, to prevent any chance of regression.
@@ -108,7 +108,7 @@ namespace mbts.spark {
.Select(t => _get_type_data(t))
.Concat(dynamic_helper.dynamic_types.Select(dt => _get_type_data(AlgoType.Dynamic, dt)))
.ToListLazy();
var conf_sets = from_conf.rules.Select(r => _to_security_algo_set(r, dynamic_helper, algo_type_data)).ToList();
var conf_sets = from_conf.Rules.Select(r => _to_security_algo_set(r, dynamic_helper, algo_type_data)).ToList();
security_algo_provider = new AlgoProvider(conf_sets.Select(tup => tup.standard).ToList(), studio_model, dynamic_helper, security_auxiliary_model);
attachable_algo_provider = new AttachableAlgoProvider(conf_sets.Select(tup => tup.attachable).ToList(), studio_model, dynamic_helper, security_auxiliary_model);
}
@@ -128,9 +128,9 @@ namespace mbts.spark {
context == null ?
new SecurityCriteriaClause() :
new SecurityCriteriaClause(
exchanges: context.exchanges?.Select(EnumHelper.parse<Venue>)?.ToArray(),
security_types: context.security_types?.Select(EnumHelper.parse<Security.ContractOneofCase>)?.Select(t => t.security_type())?.ToArray(),
symbols: context.symbols?.ToArray());
exchanges: context.Exchanges?.Select(EnumHelper.parse<Venue>)?.ToArray(),
security_types: context.SecurityTypes?.Select(EnumHelper.parse<Security.ContractOneofCase>)?.Select(t => t.security_type())?.ToArray(),
symbols: context.Symbols?.ToArray());
static (SecurityAlgoTypeSetImmutable standard, SecurityAlgoTypeSetImmutable attachable) _to_security_algo_set(
bts.config.AlgoTypeRule rule,
@@ -141,24 +141,24 @@ namespace mbts.spark {
var dynamic_types = ImmutableHashSet<string>.Empty.ToBuilder();
var attachable_factory_types = ImmutableHashSet<AlgoType>.Empty.ToBuilder();
var attachable_dynamic_types = ImmutableHashSet<string>.Empty.ToBuilder();
foreach (var a in rule.algos) {
if (Enum.TryParse(a.name, out AlgoType sys_algo) && sys_algo != AlgoType.Composite && sys_algo != AlgoType.Dynamic) {
on_sys_match(sys_algo, a.is_attachable);
} else if (dynamic_helper.try_parse(a.name, out var dyn_type)) {
on_dyn_match(dyn_type, a.is_attachable);
foreach (var a in rule.Algos) {
if (Enum.TryParse(a.Name, out AlgoType sys_algo) && sys_algo != AlgoType.Composite && sys_algo != AlgoType.Dynamic) {
on_sys_match(sys_algo, a.IsAttachable);
} else if (dynamic_helper.try_parse(a.Name, out var dyn_type)) {
on_dyn_match(dyn_type, a.IsAttachable);
} else {
foreach (var (name, factory, dynamic) in algo_type_data) {
if (Regex.Match(name, a.name).Success) {
if (Regex.Match(name, a.Name).Success) {
switch (factory) {
case AlgoType.None:
case AlgoType.Composite:
// unexpected, but no need to crash
continue;
case AlgoType.Dynamic:
on_dyn_match(dynamic, a.is_attachable);
on_dyn_match(dynamic, a.IsAttachable);
break;
default:
on_sys_match(factory, a.is_attachable);
on_sys_match(factory, a.IsAttachable);
break;
}
}
@@ -168,13 +168,13 @@ namespace mbts.spark {
return (
// standard
new SecurityAlgoTypeSetImmutable(
_to_clause(rule.context),
_to_clause(rule.Context),
new AlgoTypeSetImmutable(
factory_types.ToImmutable(),
dynamic_types.ToImmutable())),
// attachable
new SecurityAlgoTypeSetImmutable(
_to_clause(rule.context),
_to_clause(rule.Context),
new AlgoTypeSetImmutable(
attachable_factory_types.ToImmutable(),
attachable_dynamic_types.ToImmutable())));
+1 -1
View File
@@ -37,7 +37,7 @@ namespace bts.ui {
Window about = Application.LoadComponent(new Uri("/view/Shell/About.xaml", UriKind.Relative)) as Window;
enable_crash_on_dblclick(about);
if (about != null) {
about.DataContext = new { Version = Configuration.get<bts.config.System>().version, User = _user };
about.DataContext = new { Version = Configuration.get<bts.config.System>().Version, User = _user };
about.Topmost = true;
about.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (a, b) => about.Close()));
about.CommandBindings.Add(new CommandBinding(ApplicationCommands.Open, (arg, e) => {
+1 -1
View File
@@ -49,7 +49,7 @@ namespace bts {
ss,
user,
security_metadata,
TimeSpan.FromMilliseconds(Configuration.get<RelayOptions>().naggle_ms),
TimeSpan.FromMilliseconds(Configuration.get<RelayOptions>().NaggleMs),
TimeSpan.FromSeconds(1)) { }
public MDDaemon(
@@ -33,7 +33,7 @@ namespace bts.shell {
[ImportingConstructor]
public OrderTicketDaemon(IBus bus, OrdersModel model, UserSettingsHub settings_hub, ErrorReporter error_reporter)
: this(bus, model, settings_hub, error_reporter, Configuration.get<bts.config.OrderTicketOptions>().close_on_send) { }
: this(bus, model, settings_hub, error_reporter, Configuration.get<bts.config.OrderTicketOptions>().CloseOnSend) { }
public OrderTicketDaemon(IBus bus, OrdersModel model, UserSettingsHub settings_hub, ErrorReporter error_reporter, bool close_on_send) {
_bus = bus;
+1 -1
View File
@@ -21,7 +21,7 @@ namespace mbts.ui {
[ImportingConstructor]
public RecenterDaemon(IBus bus) {
_bus = bus;
_time_to_center = TimeSpan.FromSeconds(config.Configuration.get<bts.config.LadderKnobs>().seconds_to_recenter);
_time_to_center = TimeSpan.FromSeconds(config.Configuration.get<bts.config.LadderKnobs>().SecondsToRecenter);
_last_recenter = DateTime.UtcNow;
_dispose = _bus.subscribe(SparkTags.RequestRecenterLadder).Subscribe(_ => trigger_recenter(SparkTags.RecenterLadderNow));
@@ -24,7 +24,7 @@ namespace bts.perf {
[ImportingConstructor]
public ShellLatencyDaemon(ShellLatencyService service, Lazy<UserTuple> user) {
_service = service;
_version = Configuration.get<bts.config.System>().version;
_version = Configuration.get<bts.config.System>().Version;
_username = user.Value.name;
_hostname = Environment.MachineName;
@@ -49,32 +49,32 @@ namespace bts.perf {
async void _forever_ping_host(Ping pinger) {
var config = Configuration.get<bts.config.ShellPingOptions>();
string server_ip = Configuration.get<bts.config.System>().config_ip;
int delay = config.workloop_milliseconds_interval;
string server_ip = Configuration.get<bts.config.System>().ConfigIp;
int delay = config.WorkloopMillisecondsInterval;
int _current_missed_ping_count = 0;
if (config.shell_ping_is_enabled && pinger != null) {
if (config.ShellPingIsEnabled && pinger != null) {
while (true) {
try {
await Task.Delay(delay);
var response = await pinger.SendPingAsync(server_ip, config.timeout_milliseconds_threshold);
var response = await pinger.SendPingAsync(server_ip, config.TimeoutMillisecondsThreshold);
if (response.Status == IPStatus.Success) {
_current_missed_ping_count = 0;
if (response.RoundtripTime > config.logging_milliseconds_threshold) {
if (response.RoundtripTime > config.LoggingMillisecondsThreshold) {
Log.Ui.warn($"Ping response not received in a timely manner:\n" +
$"\tAddress:\t{response.Address}\n" +
$"\tRoundTrip:\t{response.RoundtripTime} ms");
}
// potentially reset delay to initial work period (no-op otherwise)
delay = config.workloop_milliseconds_interval;
delay = config.WorkloopMillisecondsInterval;
} else {
_current_missed_ping_count++;
delay = _get_exp_delay(_current_missed_ping_count, config.workloop_milliseconds_interval, config.maximum_backoff_milliseconds);
delay = _get_exp_delay(_current_missed_ping_count, config.WorkloopMillisecondsInterval, config.MaximumBackoffMilliseconds);
Log.Ui.warn($"Ping was not successful. Ping response: {response.Status}. Missed ping count: {_current_missed_ping_count}. Backing off for {delay} milliseconds.");
}
} catch (PingException e) {
_current_missed_ping_count++;
delay = _get_exp_delay(_current_missed_ping_count, config.workloop_milliseconds_interval, config.maximum_backoff_milliseconds);
delay = _get_exp_delay(_current_missed_ping_count, config.WorkloopMillisecondsInterval, config.MaximumBackoffMilliseconds);
Log.Ui.error($"Ping exception. {e}\nBacking off for {delay} milliseconds.");
}
} // end while
+1 -1
View File
@@ -28,7 +28,7 @@ namespace bts.shell {
}
}
bool check_version() {
string current = Configuration.get<bts.config.System>().version;
string current = Configuration.get<bts.config.System>().Version;
if (!string.IsNullOrWhiteSpace(current) && current != "private") {
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\BTS")) {
var value = key.GetValue("version");
@@ -31,7 +31,7 @@
public override string window_type => WINDOW_TYPE;
string ISharedWindow.thread_id =>
config.Configuration.get<bts.config.MultiThreadedWindows>().vol_surface ? "VolSurface" : null;
config.Configuration.get<bts.config.MultiThreadedWindows>().VolSurface ? "VolSurface" : null;
public int vs_id => _startup_data.id;
public string vs_name { get; }
@@ -65,7 +65,7 @@ namespace mbts.spark {
_settings_hub = settings_hub;
_settings_manager = settings_hub.create_mview_settings_manager(state.grid);
Icon.Freeze();
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().market_view ? "MarketView" : null;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().MarketView ? "MarketView" : null;
_dispose = Disposable.Create(() => {
Disposable.dispose(ref _subscriptions);
_vm.Dispose();
@@ -42,7 +42,7 @@
public override Task<IShellWindow> load(TimeAndSalesSettings state) {
var conf = Configuration.get<bts.config.TimeAndSalesOptions>();
var thread_id = Configuration.get<bts.config.MultiThreadedWindows>().time_and_sales ?
var thread_id = Configuration.get<bts.config.MultiThreadedWindows>().TimeAndSales ?
TimeAndSalesWindow.WINDOW_TYPE_NAME : null;
var settings_man = new WindowSettingsManager<GridSettings>(
_settings_hub, state.grid, s => s.time_and_sales_grid, (s, g) => s.with(time_and_sales: g));
@@ -52,7 +52,7 @@
_consumer,
state,
settings_man,
conf.can_pause_updates,
conf.CanPauseUpdates,
_security_auxiliary_model.get_display_quantity_divisor,
thread_id);
return Task.FromResult<IShellWindow>(win);
@@ -32,7 +32,7 @@ namespace bts.ui {
SparkCommands.ShowGlobalAlerts,
SparkCommands.ShowWorkspaces
};
if (Configuration.get<bts.config.toggles.ToastNotifications>().enabled) {
if (Configuration.get<bts.config.toggles.ToastNotifications>().Enabled) {
actions_list.Add(SparkCommands.ShowSettings);
}
actions = actions_list;
@@ -26,9 +26,9 @@ namespace bts {
static bool _is_hidden(IShellModule module) {
var props = Configuration.get<IShellModuleProps>();
string name = module.GetType().Name;
foreach (var p in props.module) {
if (p.name.ToLower() == name.ToLower()) {
return !p.visible;
foreach (var p in props.Modules) {
if (p.Name.ToLower() == name.ToLower()) {
return !p.Visible;
}
}
return false;
@@ -42,7 +42,7 @@ namespace mbts.spark {
_state = state;
_settings_manager = settings_manager;
Icon.Freeze();
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().synthetic_management ?
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().SyntheticManagement ?
"SyntheticManagement" : null;
_dispose = Disposable.Create(() => {
Disposable.dispose(ref _vm);
@@ -44,8 +44,8 @@ namespace bts.shell {
string uristr = uri.ToString();
string http_base =
"http://{0}:{1}/".fmt(
Configuration.get<bts.config.System>().config_host,
Configuration.get<bts.config.System>().config_port);
Configuration.get<bts.config.System>().ConfigHost,
Configuration.get<bts.config.System>().ConfigPort);
string temp = uristr;
if (uristr.StartsWith("bts://m/")) {
temp = uristr.Replace("bts://m/", http_base + "docs/");
@@ -94,7 +94,7 @@ namespace bts.shell {
emulation_key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(ke_name);
}
var process_name = Configuration.get<bts.config.System>().process_name;
var process_name = Configuration.get<bts.config.System>().ProcessName;
emulation_key.SetValue(process_name, 11001); // IE11
}
#endregion
@@ -43,7 +43,7 @@ namespace mbts.spark {
: base(NAME, bus, factory, SparkCommands.ShowAlgoStudio.icon) {
_model = model;
_state = state;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().algo_studio ? "AlgoStudio" : null;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().AlgoStudio ? "AlgoStudio" : null;
_dispose = Disposable.Create(_dispose_core);
}
@@ -74,12 +74,12 @@ namespace mbts.spark {
_commands.Add(new SparkCommandCommand("Add Algo", Icons.AddBoxes, _vm.add_definition_cmd));
_commands.Add(new SparkCommandCommand("Clone Algo", Icons.CopyBoxes, _vm.clone_selected_definition_cmd));
_commands.Add(new SparkCommandCommand("Save Algo", Icons.DiskFile, _vm.save_cmd) {
show_in_toolbar = _ui_configuration.can_save_specific
show_in_toolbar = _ui_configuration.CanSaveSpecific
});
_commands.Add(new SparkCommandCommand("Save All", Icons.Disk, ObservantAsyncCommand.create(_vm.save_all, out var save_all_observer)));
_resources.Add(_vm.subscribe_dirty().OnDispatcher().Subscribe(save_all_observer));
// undo/redo
if (_ui_configuration.can_undo_redo) {
if (_ui_configuration.CanUndoRedo) {
// undo
var undo_cmd = new ObservantCommand(() => _vm.selected_definition?.try_undo());
var undo_spark_cmd = new SparkCommandCommand("Undo", Icons.UndoCircular, undo_cmd);
@@ -17,10 +17,10 @@ namespace mbts.spark {
static class AlgoStudioModelUtils {
public static IReadOnlyDictionary<object, object> get_dynamic_resources(bts.config.AlgoStudioOptions ui_configuration) =>
new Dictionary<object, object> {
{ AlgoStudioWindow.ShowAlgoToolBarRenameDefinitionKey, ui_configuration.can_modify_definition_name && ui_configuration.show_algo_toolbar_rename },
{ AlgoStudioWindow.ShowAlgoToolBarSaveDefinitionKey, ui_configuration.can_modify_definition_values && ui_configuration.show_algo_toolbar_save },
{ AlgoStudioWindow.ShowAlgoToolBarRevertDefinitionKey, ui_configuration.show_algo_toolbar_revert },
{ AlgoStudioWindow.ShowAlgoToolBarUndoRedoDefinitionKey, ui_configuration.show_algo_toolbar_undo_redo }
{ AlgoStudioWindow.ShowAlgoToolBarRenameDefinitionKey, ui_configuration.CanModifyDefinitionName && ui_configuration.ShowAlgoToolbarRename },
{ AlgoStudioWindow.ShowAlgoToolBarSaveDefinitionKey, ui_configuration.CanModifyDefinitionValues && ui_configuration.ShowAlgoToolbarSave },
{ AlgoStudioWindow.ShowAlgoToolBarRevertDefinitionKey, ui_configuration.ShowAlgoToolbarRevert },
{ AlgoStudioWindow.ShowAlgoToolBarUndoRedoDefinitionKey, ui_configuration.ShowAlgoToolbarUndoRedo }
};
}
}
@@ -65,9 +65,9 @@ namespace mbts.spark {
_permissions_mask.mask = init_permissions;
_permissions_mask.raw = init_permissions;
var resources = new CompositeDisposable();
if (!model.algo_model.ui_configuration.can_modify_definition_values)
if (!model.algo_model.ui_configuration.CanModifyDefinitionValues)
editing_permissions_mask ^= (AlgoEditingPermissions.AllowEditValues | AlgoEditingPermissions.AllowSaveValues);
if (!model.algo_model.ui_configuration.can_modify_definition_structure)
if (!model.algo_model.ui_configuration.CanModifyDefinitionStructure)
editing_permissions_mask ^= (AlgoEditingPermissions.AllowEditStructure | AlgoEditingPermissions.AllowSaveStructure);
key = def_data.key;
algos_view = ObservableAutoWrapper.create_sorted_wrapper(_algo_roots, AlgoCollectionHelper.algo_vm_comparer);
@@ -128,7 +128,7 @@ namespace mbts.spark {
case AlgoKey.Mode.Persisted:
_metadata = new AlgoDefinitionMetadata(key);
resources.Add(model.algo_model.metadata_service.subscribe_metadata(key).OnDispatcher().Subscribe(_on_metadata));
_edit_pane_vs_model.set_state(VisualStateNames.Name.GroupName, conf.can_modify_definition_name ? VisualStateNames.Name.Active : VisualStateNames.Name.CannotRenameDefinition);
_edit_pane_vs_model.set_state(VisualStateNames.Name.GroupName, conf.CanModifyDefinitionName ? VisualStateNames.Name.Active : VisualStateNames.Name.CannotRenameDefinition);
break;
case AlgoKey.Mode.Factory:
_edit_pane_vs_model.set_state(VisualStateNames.Name.GroupName, VisualStateNames.Name.Inactive);
@@ -37,7 +37,7 @@ namespace mbts.spark {
_orders_model = orders_model;
_state = state;
_settings_manager = settings_manager;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().fills ? "Fills" : null;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().Fills ? "Fills" : null;
_dispose = Disposable.Create(() => {
Disposable.dispose(ref _vm);
if (_commands != null) {
@@ -515,7 +515,7 @@ namespace mbts.spark {
static LadderSettings() {
var knobs = config.Configuration.get<bts.config.LadderKnobs>();
mimic_tt = knobs.mimic_tt;
mimic_tt = knobs.MimicTt;
}
// Default proto constructor
@@ -58,7 +58,7 @@
_sec_meta_store = sec_meta_store;
_ladder_conf = new LadderConfig(
Configuration.get<bts.config.LadderKnobs>(),
Configuration.get<bts.config.MultiThreadedWindows>().ladder);
Configuration.get<bts.config.MultiThreadedWindows>().Ladder);
_thread_id_provider = ShellWindowThreadIDFactory.create(_window_type, _ladder_conf.ladders_on_threads);
_mbo = mbo;
_dispose = Disposable.Create(
@@ -117,10 +117,10 @@
public readonly TimeSpan security_timeout;
public LadderConfig(bts.config.LadderKnobs knobs, bool ladders_on_threads) {
max_open_ladders = knobs.max_open_ladders;
open_algo_popup_on_select = knobs.open_algo_popup_on_select;
use_algo_param_grid = knobs.use_algo_param_grid;
security_timeout = TimeSpan.FromSeconds(Math.Max(15, knobs.security_timeout_secs));
max_open_ladders = knobs.MaxOpenLadders;
open_algo_popup_on_select = knobs.OpenAlgoPopupOnSelect;
use_algo_param_grid = knobs.UseAlgoParamGrid;
security_timeout = TimeSpan.FromSeconds(Math.Max(15, knobs.SecurityTimeoutSecs));
this.ladders_on_threads = ladders_on_threads;
}
}
@@ -101,16 +101,16 @@ namespace mbts.spark {
static LadderGridHost() {
var knobs = config.Configuration.get<bts.config.LadderKnobs>();
_show_scrollbar = knobs.show_scrollbar;
_lighten_market_cells = knobs.lighten_market_cells;
_initial_row_count = (int)knobs.scrollable_tick_window_size;
_show_scrollbar = knobs.ShowScrollbar;
_lighten_market_cells = knobs.LightenMarketCells;
_initial_row_count = (int)knobs.ScrollableTickWindowSize;
// For market cell backgrounds, 0 means null. Note that the full
// range of colors can still be expressed, as zero is merely one of
// 2^24 possible representations of 'transparent.'
if (knobs.bid_market_cell_background != 0)
_bid_market_cell_background = knobs.bid_market_cell_background.argb_color();
if (knobs.ask_market_cell_background != 0)
_ask_market_cell_background = knobs.ask_market_cell_background.argb_color();
if (knobs.BidMarketCellBackground != 0)
_bid_market_cell_background = knobs.BidMarketCellBackground.argb_color();
if (knobs.AskMarketCellBackground != 0)
_ask_market_cell_background = knobs.AskMarketCellBackground.argb_color();
}
public LadderGridHost() {
@@ -27,7 +27,7 @@ namespace mbts.spark {
static LadderView() {
var knobs = config.Configuration.get<bts.config.LadderKnobs>();
MimicTT = knobs.mimic_tt;
MimicTT = knobs.MimicTt;
}
public static bool MimicTT { get; }
@@ -130,8 +130,8 @@ namespace bts.shell {
}
public static ManualFillsConfig read() => new ManualFillsConfig(
mbts.config.Configuration.get<bts.config.MultiThreadedWindows>().manual_fills ? window_type : null,
mbts.config.Configuration.get<bts.config.ManualFillsOptions>().modal_transactions);
mbts.config.Configuration.get<bts.config.MultiThreadedWindows>().ManualFills ? window_type : null,
mbts.config.Configuration.get<bts.config.ManualFillsOptions>().ModalTransactions);
}
static class CommandGroups {
@@ -1260,7 +1260,7 @@ namespace mbts.spark {
_background_converter = new AnonymousMultiValueConverter<bool, OrderStatus, Brush>(
(selected, status) => selected || status != OrderStatus.Working ? Brushes.Transparent : BTSColors.Orders.working_order_background_brush);
static readonly bool _animate_child_order_rows = mbts.config.Configuration.get<bts.config.OrderBookOptions>().animate_child_order_rows;
static readonly bool _animate_child_order_rows = mbts.config.Configuration.get<bts.config.OrderBookOptions>().AnimateChildOrderRows;
public static BindingBase _get_background_binding() {
var mb = new MultiBinding { Converter = _background_converter };
@@ -1014,11 +1014,11 @@ namespace mbts.spark {
var top = config.Configuration.get<bts.config.TopAttachUIOptions>();
var offset = config.Configuration.get<bts.config.OffsetAttachUIOptions>();
_algo_type_conf = new Dictionary<CustomOrderDefinition.CustomOneofCase, (bool, bool)> {
{ CustomOrderDefinition.CustomOneofCase.Cover, (cover.show_price, cover.show_quantity) },
{ CustomOrderDefinition.CustomOneofCase.Join, (join.show_price, join.show_quantity) },
{ CustomOrderDefinition.CustomOneofCase.Lean, (lean.show_price, lean.show_quantity) },
{ CustomOrderDefinition.CustomOneofCase.Top, (top.show_price, top.show_quantity) },
{ CustomOrderDefinition.CustomOneofCase.Offset, (offset.show_price, offset.show_quantity) }
{ CustomOrderDefinition.CustomOneofCase.Cover, (cover.ShowPrice, cover.ShowQuantity) },
{ CustomOrderDefinition.CustomOneofCase.Join, (join.ShowPrice, join.ShowQuantity) },
{ CustomOrderDefinition.CustomOneofCase.Lean, (lean.ShowPrice, lean.ShowQuantity) },
{ CustomOrderDefinition.CustomOneofCase.Top, (top.ShowPrice, top.ShowQuantity) },
{ CustomOrderDefinition.CustomOneofCase.Offset, (offset.ShowPrice, offset.ShowQuantity) }
};
}
@@ -67,7 +67,7 @@ namespace mbts.spark {
_state = state;
_settings_manager = settings_manager;
_can_edit_specific_algo_params = can_edit_specific_algo_params;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().order_book ? "OrderBook" : null;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().OrderBook ? "OrderBook" : null;
_dispose = Disposable.Create(() => {
Disposable.dispose(_thread_init_resources);
Disposable.dispose(ref _attachment_exit_sub);
@@ -35,7 +35,7 @@ namespace bts.shell {
ISecurityMetadataStore sec_meta_store,
UserSettingsHub settings_hub) : base(owner, "SparkOrderBookWindow") {
var raw_config = Configuration.get<bts.config.OrderBookOptions>();
_config = new OrderBookConfig(raw_config.can_edit_specific_algo_params);
_config = new OrderBookConfig(raw_config.CanEditSpecificAlgoParams);
_bus = bus;
_notification_service = notification_service;
_notification_service_data_cache = notification_service_data_cache;
@@ -70,7 +70,7 @@ namespace mbts.spark {
var bg_binding = new MultiBinding();
bg_binding.Bindings.Add(new Binding(nameof(OrderBookRowVM.status)));
bg_binding.Bindings.Add(new Binding(nameof(ListBoxItem.IsSelected)) { RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(ListBoxItem), 1) });
double overlay_opacity = config.Configuration.get<bts.config.OrderBookOptions>().status_color_opacity_when_selected;
double overlay_opacity = config.Configuration.get<bts.config.OrderBookOptions>().StatusColorOpacityWhenSelected;
if (overlay_opacity > 0.1 && overlay_opacity < 0.9) {
bg_binding.Converter = ValueConverter.create<OrderStatus, bool, Brush>((status, is_selected) => {
var color = _status_color(status);
@@ -61,7 +61,7 @@ namespace bts.shell {
_position_model = position_model;
_sec_meta_store = sec_meta_store;
_pnl_conf = new PNLConfig(Configuration.get<bts.config.PNLOptions>());
_thread_id_provider = ShellWindowThreadIDFactory.create(_window_type, Configuration.get<bts.config.MultiThreadedWindows>().pnl);
_thread_id_provider = ShellWindowThreadIDFactory.create(_window_type, Configuration.get<bts.config.MultiThreadedWindows>().Pnl);
_dispose = bus.subscribe(SparkTags.ShowPNLTag).OnDispatcher().Subscribe(_show);
}
@@ -308,8 +308,8 @@ namespace bts.shell {
show_pause_resume;
public PNLConfig(bts.config.PNLOptions options) {
enable_animations = options.enable_animations;
show_pause_resume = options.show_pause_resume;
enable_animations = options.EnableAnimations;
show_pause_resume = options.ShowPauseResume;
}
}
@@ -51,7 +51,7 @@ namespace Spark.Trading {
IWindowSettingsManager<GridSettings> settings_manager,
UserTuple user)
: base("Reconcile Report", bus, save, Icons.Reports) {
thread_id = Configuration.get<bts.config.MultiThreadedWindows>().reconcile_report ?
thread_id = Configuration.get<bts.config.MultiThreadedWindows>().ReconcileReport ?
WINDOW_TYPE_NAME : null;
_position_model = position_model;
_security_metadata = security_metadata;
@@ -26,7 +26,7 @@ namespace BCG
Right
}
private readonly bool _is_remoted = mbts.config.Configuration.get<bts.config.System>().is_remote_app;
private readonly bool _is_remoted = mbts.config.Configuration.get<bts.config.System>().IsRemoteApp;
[Category("Grid Lines")]
[DisplayName("Row Seperator Line Color")]
@@ -21,7 +21,7 @@ namespace BCG {
Down
}
private readonly bool _is_remoted = mbts.config.Configuration.get<bts.config.System>().is_remote_app;
private readonly bool _is_remoted = mbts.config.Configuration.get<bts.config.System>().IsRemoteApp;
private readonly PerfStatsLogger _recorder = new PerfStatsLogger();
private readonly HighPerformanceTimer _timer = new HighPerformanceTimer();
private System.ComponentModel.Container components = null;
@@ -350,4 +350,4 @@ namespace BCG {
}
#endregion
}
}
}
+3 -3
View File
@@ -56,8 +56,8 @@ namespace mbts.ui {
SoundNotificationPlayer _sound_player;
Dispatcher _dispatcher;
bool
_sound_notifications_enabled = Configuration.get<bts.config.toggles.SoundNotifications>().enabled,
_toast_notifications_enabled = Configuration.get<bts.config.toggles.ToastNotifications>().enabled;
_sound_notifications_enabled = Configuration.get<bts.config.toggles.SoundNotifications>().Enabled,
_toast_notifications_enabled = Configuration.get<bts.config.toggles.ToastNotifications>().Enabled;
[ImportingConstructor]
public Notifier(IBus bus, UserSettingsHub settings_hub) {
@@ -77,7 +77,7 @@ namespace mbts.ui {
if (_disposer.has_dispose_started)
return;
_sound_player = SoundNotificationPlayer.create();
if (Configuration.get<bts.config.toggles.ToastNotifications>().enabled) {
if (Configuration.get<bts.config.toggles.ToastNotifications>().Enabled) {
_toast_controller = new ToastNotificationController(bus);
_settings_sub = settings_hub.subscribe_default_settings().StartWith(settings_hub.current).OnDispatcher().Subscribe(s => {
if (s == null || _disposer.has_dispose_started)
+1 -1
View File
@@ -36,7 +36,7 @@
[Export]
class OrdersModel : IDisposable {
public static readonly bool piq_enabled = Configuration.get<bts.config.toggles.PlacementInQueue>().enabled;
public static readonly bool piq_enabled = Configuration.get<bts.config.toggles.PlacementInQueue>().Enabled;
public readonly MarketDataAuxiliaryModel md_auxiliary_model;
public readonly ISecurityAuxiliaryDataModel security_auxiliary_model;
@@ -32,7 +32,7 @@
class OrderSentEventPredicate : IEquatable<OrderSentEventPredicate> {
static readonly int _type_hash = typeof(OrderSentEventPredicate).GetHashCode();
// arbitrary short time period (can override in config)
static readonly TimeSpan _stale_order_threshold = TimeSpan.FromSeconds(config.Configuration.get<bts.config.OrderAlerts>().stale_order_threshold_seconds);
static readonly TimeSpan _stale_order_threshold = TimeSpan.FromSeconds(config.Configuration.get<bts.config.OrderAlerts>().StaleOrderThresholdSeconds);
public enum PredicateTypeOneofCase {
[Description("(any order)")]
+1 -1
View File
@@ -30,7 +30,7 @@ namespace mbts.ui.settings {
}
static class PredicateVMWrapper {
static readonly bool _toast_notifications_enabled_global = Configuration.get<bts.config.toggles.ToastNotifications>().enabled;
static readonly bool _toast_notifications_enabled_global = Configuration.get<bts.config.toggles.ToastNotifications>().Enabled;
public static ITemplatedPropertyWrapperVM<TSource> wrap_child_oneof<TSource, TChild, TChildOneof>(
Func<TSource, TChild> get, Action<TSource, TChild> set, Func<TChild, TChildOneof> get_child_oneof, Dictionary<TChildOneof, ITemplatedPropertyWrapperVM<TChild>> oneof_vms)
@@ -29,7 +29,7 @@ namespace mbts.analytics {
IBus bus, ISaveWindow<ComboReportSettings> save,
ComboReportSettings settings)
: base(settings.id.ToString(), bus, save, Icons.Reports) {
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().combo_report ?
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().ComboReport ?
"Combo" : null;
_settings = settings;
_dispose = Disposable.Create(() => (_vm, _model));
@@ -34,7 +34,7 @@ namespace mbts.analytics {
ISaveWindow<SlideReportSettings> save,
SlideReportSettings settings)
: base(settings.id.ToString(), bus, save, Icons.Reports) {
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().slide_report ? "Slide" : null;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().SlideReport ? "Slide" : null;
_settings = settings;
_dispose = Disposable.Create(() => Disposable.dispose(ref _vm));
}
@@ -28,9 +28,9 @@ namespace mbts.spark {
public SecurityAuxiliaryDataModel() {
var sym_config = Configuration.get<bts.config.SymbolUIConfiguration>();
var sym_config_items = Configuration.get<bts.config.SymbolUIConfiguration>().items;
var sym_config_items = Configuration.get<bts.config.SymbolUIConfiguration>().Items;
foreach (var item in sym_config_items)
_auxiliary_data[item.symbol] = new SecurityAuxiliaryData(item.display_quantity_divisor);
_auxiliary_data[item.Symbol] = new SecurityAuxiliaryData(item.DisplayQuantityDivisor);
}
public SecurityAuxiliaryData? get_auxiliary_data(SecurityImmutable security) =>
+1 -1
View File
@@ -88,7 +88,7 @@
}
public override void CreateShell(ShellModel model) {
if (Configuration.get<bts.config.ShellRenderMode>().software_only) {
if (Configuration.get<bts.config.ShellRenderMode>().SoftwareOnly) {
System.Windows.Media.RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
}
@@ -202,7 +202,7 @@ namespace mbts.ui.native {
private static extern bool SetWorkArea_SystemParametersInfo(SPI action, uint zero, Win32Rect param, uint winini);
public static void SetWorkArea(Rect workarea) {
var dpi_ratio = config.Configuration.get<bts.config.System>().dpi_ratio;
var dpi_ratio = config.Configuration.get<bts.config.System>().DpiRatio;
workarea = new Rect(workarea.Left * dpi_ratio, workarea.Top * dpi_ratio, (workarea.Right - workarea.Left) * dpi_ratio, (workarea.Bottom - workarea.Top) * dpi_ratio);
//const uint SPIF_SENDWININICHANGE = 2;
const uint SPIF_UPDATEINIFILE = 1;
@@ -220,7 +220,7 @@ namespace mbts.ui.native {
// Get the work area for monitor where the specified window is currently.
// The work area is the area of the window not covered by the task bar or a docked shell
public static Rect GetWorkArea(IntPtr window) {
var dpi_ratio = config.Configuration.get<bts.config.System>().dpi_ratio;
var dpi_ratio = config.Configuration.get<bts.config.System>().DpiRatio;
IntPtr monitor = MonitorFromWindow(window, MONITOR_DEFAULTONNEAREST);
MONITORINFO info = new MONITORINFO();
info.cbSize = Marshal.SizeOf(info);
@@ -28,13 +28,13 @@ namespace mbts.spark {
// i.e. 21:30 UTC corresponds to 16:30 Central (4:30 PM), but only during *CDT*
// CDT it UTC -5
// CST is UTC -6
static readonly int sod_hh = (int)config.Configuration.get<bts.config.SODTime>().sod_hh;
static readonly int sod_mm = (int)config.Configuration.get<bts.config.SODTime>().sod_mm;
static readonly int sod_hh = (int)config.Configuration.get<bts.config.SODTime>().SodHh;
static readonly int sod_mm = (int)config.Configuration.get<bts.config.SODTime>().SodMm;
static readonly TimeZoneInfo central_tzi = TimeZoneInfo.FindSystemTimeZoneById(cst_id);
static MarketSchedule() {
var cme_schedule = config.Configuration.get<bts.md.CMETradingSchedule>();
_cme_gen_open_hrs = cme_schedule?.gen_open_hour ?? 8.5;
_cme_gen_open_hrs = cme_schedule?.GenOpenHour ?? 8.5;
}
// for object initializers
public MarketSchedule() { }
@@ -24,7 +24,7 @@ namespace mbts.ui.dpi {
public static readonly float fdpi_ratio;
static HighDpiExtensions() {
dpi_ratio = Configuration.get<bts.config.System>().dpi_ratio;
dpi_ratio = Configuration.get<bts.config.System>().DpiRatio;
pixel_unit = 1.0 / dpi_ratio;
fdpi_ratio = (float)dpi_ratio;
}
@@ -8,7 +8,7 @@ using System.Windows.Input;
namespace mbts.ui {
class ScrollViewerCorrector {
static readonly bool _fix_nested_scrolling_enabled = mbts.config.Configuration.get<bts.config.toggles.FixNestedScrolling>().enabled;
static readonly bool _fix_nested_scrolling_enabled = mbts.config.Configuration.get<bts.config.toggles.FixNestedScrolling>().Enabled;
static List<MouseWheelEventArgs> _reentrancy_list => ThreadStaticActivator<ReentrancyList>.instance;
public static readonly DependencyProperty FixNestedScrollingProperty =
@@ -9,7 +9,7 @@ using System.Windows.Media;
namespace mbts.ui {
static class WindowExtensions {
static readonly bool _ensure_onscreen_with_work_area_rect = config.Configuration.get<bts.config.toggles.EnsureOnScreenWithWorkAreaRect>().enabled;
static readonly bool _ensure_onscreen_with_work_area_rect = config.Configuration.get<bts.config.toggles.EnsureOnScreenWithWorkAreaRect>().Enabled;
public static Rect bounds(this Window window) {
return new Rect(window.Left, window.Top, window.ActualWidth, window.ActualHeight);
+1 -1
View File
@@ -77,7 +77,7 @@
.WithParts(types)
.WithDefaultConventions(rules);
string plugin_path = Configuration.get<bts.config.System>().data_path + "/plugins/";
string plugin_path = Configuration.get<bts.config.System>().DataPath + "/plugins/";
if (Directory.Exists(plugin_path)) {
var assemblies = Directory.GetFiles(plugin_path, "*.dll")
.Select(AssemblyLoadContext.Default.LoadFromAssemblyPath);
@@ -127,7 +127,7 @@ namespace mbts.ui.shell {
}
public async void save_workspace_periodically() {
TimeSpan interval = TimeSpan.FromSeconds(Configuration.get<bts.config.ShellSettingsConfig>().save_timer);
TimeSpan interval = TimeSpan.FromSeconds(Configuration.get<bts.config.ShellSettingsConfig>().SaveTimer);
await Task.Delay(interval);
while (!_closing) {
var workspace = await get_workspace_async();
@@ -153,7 +153,7 @@ namespace mbts.ui.shell {
private static string local_workspace_path() {
var system = Configuration.get<bts.config.System>();
return @"{0}/{1}/{2}".fmt(system.data_path, WORKSPACE_NAMESPACE, "recover_workspace");
return @"{0}/{1}/{2}".fmt(system.DataPath, WORKSPACE_NAMESPACE, "recover_workspace");
}
private static void save_workspace_locally(WorkspaceDefinition workspace) {
string path = local_workspace_path();
@@ -129,7 +129,7 @@ namespace mbts.spark {
#region static
public static readonly MBOSecurityQueryImmutable default_query = (MBOSecurityQueryImmutable)
new MBOSecurityQuery {
Limit = Configuration.get<bts.config.LadderKnobs>().max_mbo_orders
Limit = Configuration.get<bts.config.LadderKnobs>().MaxMboOrders
};
#endregion
}
@@ -14,8 +14,8 @@ namespace mbts.spark {
static WorkLoop() {
var timer_params = config.Configuration.get<bts.config.LadderKnobs>();
default_priority = Enum.TryParse(timer_params.priority, true, out DispatcherPriority p) ? p : DispatcherPriority.ApplicationIdle;
default_interval = TimeSpan.FromMilliseconds(timer_params.interval_ms);
default_priority = Enum.TryParse(timer_params.Priority, true, out DispatcherPriority p) ? p : DispatcherPriority.ApplicationIdle;
default_interval = TimeSpan.FromMilliseconds(timer_params.IntervalMs);
}
/// <summary>
@@ -47,7 +47,7 @@ namespace mbts.ui.utility {
static Int32Rect screen_size() {
var config = Configuration.get<bts.config.System>();
var dpi = config.dpi_ratio;
var dpi = config.DpiRatio;
return new Int32Rect(
(int)(SystemParameters.VirtualScreenLeft * dpi),
(int)(SystemParameters.VirtualScreenTop * dpi),
@@ -106,7 +106,7 @@ namespace bts.test {
port = (uint)((IPEndPoint)listener.LocalEndpoint).Port;
listener.Stop();
}
var cfg = new config.QuickbusNodeCfg() { my_port = port };
var cfg = new config.QuickbusNodeCfg() { MyPort = port };
var stream = new MemoryStream();
ProtoBuf.Serializer.Serialize(stream, cfg);
IntPtr qbus = ApiNativeMethods.api_create_quickbus(stream.ToArray(), stream.Length);
@@ -115,4 +115,4 @@ namespace bts.test {
#endregion
}
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ using bts.support;
namespace mbts
{
public static class LogUtil {
private static string log_path = Path.Combine(Configuration.get<bts.config.System>().data_path, "logging", "log");
private static string log_path = Path.Combine(Configuration.get<bts.config.System>().DataPath, "logging", "log");
+4 -4
View File
@@ -135,9 +135,9 @@ namespace bts.tests.utils {
var prts = mbts.config.Configuration.get<bts.config.Ports>();
Console.WriteLine("\n\n\n\n\n\n\n\n\n\n");
Console.WriteLine("config_port: " + prts.config_port);
Console.WriteLine("qbus_port: " + prts.qbus_port);
Console.WriteLine("glbx_sim_fix_port: " + prts.glbx_sim_fix_port);
Console.WriteLine("config_port: " + prts.ConfigPort);
Console.WriteLine("qbus_port: " + prts.QbusPort);
Console.WriteLine("glbx_sim_fix_port: " + prts.GlbxSimFixPort);
Console.WriteLine("\n\n\n\n\n\n\n\n\n\n");
var ctx = new ServiceContext();
@@ -258,4 +258,4 @@ namespace bts.tests.utils {
return md_result != null;
}
}
}
}
+2 -2
View File
@@ -124,7 +124,7 @@ namespace bts {
ConsoleEx.WriteLine("Invalid Credentials", ConsoleColor.Red);
}
if (Configuration.get<config.DeploymentType>().type.ToUpper() == "PROD") {
if (Configuration.get<config.DeploymentType>().Type.ToUpper() == "PROD") {
ConsoleEx.WriteLine("Refusing to run on production system", ConsoleColor.Red);
return -1;
}
@@ -165,4 +165,4 @@ namespace bts {
}
}
}
}
+10 -26
View File
@@ -97,26 +97,10 @@ 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/server/sparkd/cmds/spartan
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src)
if(WIN32)
target_link_libraries(
libspark
libcurl
debug
fmtd
optimized
fmt
libtbb
debug tbb_debug
libboost_system
libboost_thread
libboost_filesystem
@@ -124,12 +108,11 @@ if(WIN32)
libboost_chrono
libboost_date_time
libboost_atomic
libprotobuf
libprotoc
libssl
libcrypto
crypt32)
debug libprotobufd optimized libprotobuf
debug libprotocd optimized libprotoc
${CONAN_LIBS})
else()
add_library(libspark SHARED ${SparkLib_Sources} ${PROTO_SRCS} ${SERVICE_COMPILER_SRCS})
target_link_libraries(
libspark
protobuf
@@ -162,10 +145,11 @@ else()
-static-libgcc
-static-libstdc++
-pthread)
install(TARGETS libspark DESTINATION bin)
endif()
if(WIN32)
include(${CMAKE_SOURCE_DIR}/tools/vs_filters.cmake)
endif()
# include paths
target_include_directories(
libspark PUBLIC
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src)
+5 -5
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;
}
@@ -68,7 +68,7 @@ CAPI void api_destroy_quickbus(Quickbus *qbus) {
CAPI void api_post(
Quickbus &qbus, const std::function<void()> &callback, uint64_t delayms) {
qbus.post(callback, delayms);
qbus.post(callback, static_cast<std::uint32_t>(delayms));
}
std::string base_topic(const char *type_name, const char *service_qualifier) {
@@ -202,7 +202,7 @@ void safe_call_subscription_callback(
void *extra) {
safe_call_fn([&]() {
if (updates.size() > 0)
cb(type, &updates[0], updates.size(), extra);
cb(type, &updates[0], static_cast<int>(updates.size()), extra);
else
cb(type, nullptr, 0, extra);
});
@@ -260,7 +260,7 @@ CAPI TableSubscription api_client_subscribe(
bupdates[x].type = static_cast<StreamUpdate::Type>(update.type);
bupdates[x].key = update.key.value();
const auto &val = update.value->value();
bupdates[x].buffer_len = val.size();
bupdates[x].buffer_len = static_cast<int>(val.size());
bupdates[x].buffer = val.c_str();
}
safe_call_subscription_callback(
+3 -1
View File
@@ -113,7 +113,9 @@ class ClientChannel {
changed_items;
std::vector<int> added_keys, changed_keys,
removed_keys;
for (size_t x = 0; x < change_count; ++x) {
for (std::size_t x = 0;
x < static_cast<std::size_t>(change_count);
++x) {
const StreamUpdate &change = changes[x];
switch (change.type) {
case StreamUpdate::REMOVE:
+2 -2
View File
@@ -30,8 +30,8 @@ void QuickbusClientChannel::send_core(
};
OnReply *heap_on_response = new OnReply(move(on_response));
api_client_send(
_pclient, request_envalope.c_str(), request_envalope.size(), trampoline,
heap_on_response);
_pclient, request_envalope.c_str(),
static_cast<int>(request_envalope.size()), trampoline, heap_on_response);
}
ClientChannel::Unsubscribe QuickbusClientChannel::subscribe_core(
+3 -2
View File
@@ -42,9 +42,10 @@ struct ServerChannel::ServerChannelImpl {
size_t header_length = request_buffer[0];
assert(request_length >= header_length);
RequestHeader header;
if (header.ParsePartialFromArray(request_buffer + 1, header_length - 1)) {
if (header.ParsePartialFromArray(request_buffer + 1, static_cast<int>(header_length) - 1)) {
google::protobuf::io::ArrayInputStream stream(
request_buffer + header_length, request_length - header_length);
request_buffer + header_length,
static_cast<int>(request_length - header_length));
_server.dispatch(
header, stream, [=](const uint8_t *buffer, size_t length) {
ReplyHandler *handler = callback;
@@ -24,7 +24,7 @@ module {{name}} =
{{#if is_empty}}
type {{name}} = unit
{{else}}
[<Pojo>]
type {{name}} =
{
{{#each field}}
@@ -72,7 +72,7 @@ type I{{name}} =
abstract member subscribe_{{name}} : qualifier:string -> callback:(StreamUtils.IUpdate<{{output_type_full}}>->unit) -> System.IDisposable
{{else}}
// {{comment}}
abstract member {{name}}: {{input_type_full}} -> Fable.Import.JS.Promise<{{output_type_full}}>
abstract member {{name}}: {{input_type_full}} -> JS.Promise<{{output_type_full}}>
{{/if}}
{{/each}}
@@ -93,10 +93,12 @@ void PositionUtilities::apply_manual_fill(
void PositionUtilities::total_position(
const PositionUnit &p, uint32_t &total_long, uint32_t &total_short) {
total_long = p.sod().long_pos() + p.day().long_pos() +
p.admin_day().long_pos() + p.admin_sod().long_pos();
total_short = p.sod().short_pos() + p.day().short_pos() +
p.admin_day().short_pos() + p.admin_sod().short_pos();
total_long = static_cast<std::uint32_t>(
p.sod().long_pos() + p.day().long_pos() + p.admin_day().long_pos() +
p.admin_sod().long_pos());
total_short = static_cast<std::uint32_t>(
p.sod().short_pos() + p.day().short_pos() + p.admin_day().short_pos() +
p.admin_sod().short_pos());
}
PositionEntry PositionUtilities::add_positions(
@@ -150,4 +152,4 @@ double PositionUtilities::compute_pnl_entry(
}
} // namespace position
} // namespace bts
} // namespace bts
+7 -7
View File
@@ -95,7 +95,7 @@ bool ConfigValueQueue::can_process(const std::string &source) {
for (size_t x = 0; x < len; ++x) {
// If there is a destination assignment underneath the source path
// Then we cannot copy the value yet
const string &dest = _vals[x].dest_key;
const std::string &dest = _vals[x].dest_key;
if (dest.compare(0, source.size(), source) == 0) {
if (dest.size() <= source.size() || dest[source.size()] == '.') {
return false;
@@ -156,7 +156,7 @@ void ConfigValueQueue::assign(
} else if (field->type() == proto::FieldDescriptor::Type::TYPE_BOOL) {
reflection->SetBool(message, field, value_to_bool(value));
} else {
string error = "Invalid type conversion in assignment to " +
std::string error = "Invalid type conversion in assignment to " +
message->GetTypeName() + "." + field->name();
throw ConfigurationException(error.c_str());
}
@@ -227,7 +227,7 @@ void ConfigValueQueue::assign_value_to_field(
case FieldDescriptor::TYPE_FIXED32:
case FieldDescriptor::TYPE_INT32:
if (value.which() == ValueType::string) {
lexical_assign<int, string>(MY_ARGS);
lexical_assign<int, std::string>(MY_ARGS);
} else {
assign<int, double>(MY_ARGS);
}
@@ -241,9 +241,9 @@ void ConfigValueQueue::assign_value_to_field(
case FieldDescriptor::TYPE_STRING:
if (value.which() == ValueType::integer ||
value.which() == ValueType::real) {
lexical_assign<string, double>(MY_ARGS);
lexical_assign<std::string, double>(MY_ARGS);
} else {
assign<string>(MY_ARGS);
assign<std::string>(MY_ARGS);
}
break;
case FieldDescriptor::TYPE_MESSAGE:
@@ -257,7 +257,7 @@ void ConfigValueQueue::assign_value_to_field(
int size = reflection->FieldSize(*message, field);
const EnumDescriptor *enum_type = field->enum_type();
const EnumValueDescriptor *enum_value =
enum_type->FindValueByName(boost::get<string>(value));
enum_type->FindValueByName(boost::get<std::string>(value));
reflection->AddEnum(message, field, enum_value);
if (index != size) {
for (int i = index; i < size; ++i) {
@@ -270,7 +270,7 @@ void ConfigValueQueue::assign_value_to_field(
} else {
const EnumDescriptor *enum_type = field->enum_type();
const EnumValueDescriptor *enum_value =
enum_type->FindValueByName(boost::get<string>(value));
enum_type->FindValueByName(boost::get<std::string>(value));
set_field(message, reflection, field, enum_value, index);
if (field->is_repeated()) {
bump_indexes(message, field, 1);
+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
+1 -1
View File
@@ -9,7 +9,7 @@
#include "lib/expression/ParserExceptions.h"
#include "HTTPServer.h"
#include "catch/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#include <iostream>
#include <memory>
+1 -1
View File
@@ -19,7 +19,7 @@
#define URDL_HEADER_ONLY 1
#define URDL_DISALE_SSL 1
#include <catch/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <urdl/test/http_server.hpp>
#include <urdl/url.hpp>
+13 -13
View File
@@ -99,11 +99,11 @@ class TextFormat {
const UnknownFieldSet &unknown_fields, io::ZeroCopyOutputStream *output);
// Like Print(), but outputs directly to a string.
static bool PrintToString(const Message &message, string *output);
static bool PrintToString(const Message &message, std::string *output);
// Like PrintUnknownFields(), but outputs directly to a string.
static bool PrintUnknownFieldsToString(
const UnknownFieldSet &unknown_fields, string *output);
const UnknownFieldSet &unknown_fields, std::string *output);
// Outputs a textual representation of the value of the field supplied on
// the message supplied. For non-repeated fields, an index of -1 must
@@ -113,7 +113,7 @@ class TextFormat {
const Message &message,
const FieldDescriptor *field,
int index,
string *output);
std::string *output);
// Class for those users which require more fine-grained control over how
// a protobuffer message is printed out.
@@ -130,16 +130,16 @@ class TextFormat {
const UnknownFieldSet &unknown_fields,
io::ZeroCopyOutputStream *output) const;
// Like TextFormat::PrintToString
bool PrintToString(const Message &message, string *output) const;
bool PrintToString(const Message &message, std::string *output) const;
// Like TextFormat::PrintUnknownFieldsToString
bool PrintUnknownFieldsToString(
const UnknownFieldSet &unknown_fields, string *output) const;
const UnknownFieldSet &unknown_fields, std::string *output) const;
// Like TextFormat::PrintFieldValueToString
void PrintFieldValueToString(
const Message &message,
const FieldDescriptor *field,
int index,
string *output) const;
std::string *output) const;
// Adjust the initial indent level of all output. Each indent level is
// equal to two spaces.
@@ -231,19 +231,19 @@ class TextFormat {
// by Print().
static bool Parse(io::ZeroCopyInputStream *input, Message *output);
// Like Parse(), but reads directly from a string.
static bool ParseFromString(const string &input, Message *output);
static bool ParseFromString(const std::string &input, Message *output);
// Like Parse(), but the data is merged into the given message, as if
// using Message::MergeFrom().
static bool Merge(io::ZeroCopyInputStream *input, Message *output);
// Like Merge(), but reads directly from a string.
static bool MergeFromString(const string &input, Message *output);
static bool MergeFromString(const std::string &input, Message *output);
// Parse the given text as a single field value and store it into the
// given field of the given message. If the field is a repeated field,
// the new value will be added to the end
static bool ParseFieldValueFromString(
const string &input, const FieldDescriptor *field, Message *message);
const std::string &input, const FieldDescriptor *field, Message *message);
// Interface that TextFormat::Parser can use to find extensions.
// This class may be extended in the future to find more information
@@ -255,7 +255,7 @@ class TextFormat {
// Try to find an extension of *message by fully-qualified field
// name. Returns NULL if no extension is known for this name or number.
virtual const FieldDescriptor *
FindExtension(Message *message, const string &name) const = 0;
FindExtension(Message *message, const std::string &name) const = 0;
};
// For more control over parsing, use this class.
@@ -267,11 +267,11 @@ class TextFormat {
// Like TextFormat::Parse().
bool Parse(io::ZeroCopyInputStream *input, Message *output);
// Like TextFormat::ParseFromString().
bool ParseFromString(const string &input, Message *output);
bool ParseFromString(const std::string &input, Message *output);
// Like TextFormat::Merge().
bool Merge(io::ZeroCopyInputStream *input, Message *output);
// Like TextFormat::MergeFromString().
bool MergeFromString(const string &input, Message *output);
bool MergeFromString(const std::string &input, Message *output);
void SetValueLookup(IDeferValueLookup *lookup) { lookup_ = lookup; }
@@ -292,7 +292,7 @@ class TextFormat {
// Like TextFormat::ParseFieldValueFromString
bool ParseFieldValueFromString(
const string &input, const FieldDescriptor *field, Message *output);
const std::string &input, const FieldDescriptor *field, Message *output);
private:
// Forward declaration of an internal class used to parse text
+136
View File
@@ -0,0 +1,136 @@
/* Generated SBE (Simple Binary Encoding) message codec */
#ifndef _IL3_SIDEREQ_H_
#define _IL3_SIDEREQ_H_
#if defined(SBE_HAVE_CMATH)
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
# include <cmath>
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
#else
/* math.h needed for NAN */
# include <math.h>
# define SBE_FLOAT_NAN NAN
# define SBE_DOUBLE_NAN NAN
#endif
#if __cplusplus >= 201103L
# define SBE_CONSTEXPR constexpr
# define SBE_NOEXCEPT noexcept
#else
# define SBE_CONSTEXPR
# define SBE_NOEXCEPT
#endif
#if __cplusplus >= 201703L
# include <string_view>
# define SBE_NODISCARD [[nodiscard]]
#else
# define SBE_NODISCARD
#endif
#if !defined(__STDC_LIMIT_MACROS)
# define __STDC_LIMIT_MACROS 1
#endif
#include <cstdint>
#include <cstring>
#include <iomanip>
#include <limits>
#include <ostream>
#include <stdexcept>
#include <sstream>
#include <string>
#include <vector>
#include <tuple>
#if defined(WIN32) || defined(_WIN32)
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
#else
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
#endif
#if defined(SBE_NO_BOUNDS_CHECK)
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
#elif defined(_MSC_VER)
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
#else
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
#endif
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
namespace il3 {
class SideReq
{
public:
enum Value
{
Buy = static_cast<std::uint8_t>(1),
Sell = static_cast<std::uint8_t>(2),
NULL_VALUE = static_cast<std::uint8_t>(255)
};
static SideReq::Value get(const std::uint8_t value)
{
switch (value)
{
case static_cast<std::uint8_t>(1): return Buy;
case static_cast<std::uint8_t>(2): return Sell;
case static_cast<std::uint8_t>(255): return NULL_VALUE;
}
throw std::runtime_error("unknown value for enum SideReq [E103]");
}
static const char *c_str(const SideReq::Value value)
{
switch (value)
{
case Buy: return "Buy";
case Sell: return "Sell";
case NULL_VALUE: return "NULL_VALUE";
}
throw std::runtime_error("unknown value for enum SideReq [E103]:");
}
template<typename CharT, typename Traits>
friend std::basic_ostream<CharT, Traits>& operator << (
std::basic_ostream<CharT, Traits>& os, SideReq::Value m)
{
return os << SideReq::c_str(m);
}
};
}
#endif
+4 -4
View File
@@ -159,11 +159,11 @@ inline Price encode_exchange_price(api::Security const &sec, Price in) {
inline double
raw_round_to_quote_price(double raw_price, double tick_size, api::Side side) {
double factor = 1000000000;
auto i_price = llround(factor * raw_price);
auto i_tick_size = llround(tick_size * factor);
std::int64_t i_price = llround(factor * raw_price);
std::int64_t i_tick_size = llround(tick_size * factor);
long new_i_price = 0;
long mod = i_price % i_tick_size;
std::int64_t new_i_price = 0;
std::int64_t mod = i_price % i_tick_size;
if (mod == 0)
// price is already a valid tick
+1 -1
View File
@@ -1,4 +1,4 @@
#include "catch/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#include <iostream>
#include <regex>
+93 -93
View File
@@ -1,93 +1,93 @@
#pragma once
#ifndef WIN32
#include <bits/stdint-uintn.h>
#endif
#include <cstdint>
#include <string>
#include "lib/domain_model/SecurityKey.h"
#include "lib/utils/ValueWrapper.h"
namespace bts {
struct CQuantity {
double qty = 0;
constexpr static double err = 0.0000001;
CQuantity() {}
CQuantity(uint32_t whole_qty) : qty(whole_qty) {}
CQuantity(uint32_t int_qty, double fractional_qty)
: qty(int_qty + fractional_qty) {}
uint32_t value() const { return static_cast<uint32_t>(qty); }
double full_value() const { return qty; }
uint32_t int_part() { return static_cast<uint32_t>(qty); }
double fractional_part() { return full_value() - int_part(); }
static bool equal_d(double d1, double d2) {
return std::abs(d1 - d2) <= err;
}
static bool greater_d(double d1, double d2) { return d1 - d2 > err; }
static bool greater_eq_d(double d1, double d2) {
return equal_d(d1, d2) || greater_d(d1, d2);
}
static bool less_d(double d1, double d2) { return greater_d(d2, d1); }
static bool less_eq_d(double d1, double d2) {
return less_d(d1, d2) || equal_d(d1, d2);
}
static CQuantity u(uint32_t u) { return CQuantity(u); }
// CQuantity &operator=(uint32_t whole_qty) noexcept {
// qty = whole_qty;
// return *this;
// }
CQuantity &operator=(double full_qty) noexcept {
qty = full_qty;
return *this;
}
bool operator==(const CQuantity &rhs) const { return equal_d(qty, rhs.qty); }
bool operator==(uint32_t rhs) const {
return this->operator==(CQuantity{rhs});
}
bool operator!=(const CQuantity &rhs) const {
return !this->operator==(rhs);
}
bool operator!=(uint32_t &rhs) const { return this->operator!=(u(rhs)); }
bool operator>(const CQuantity &rhs) const {
return greater_d(qty, rhs.qty);
}
bool operator>(uint32_t rhs) const { return this->operator>(u(rhs)); }
bool operator>=(const CQuantity &rhs) const {
return greater_eq_d(qty, rhs.qty);
}
bool operator>=(uint32_t rhs) const { return this->operator>=(u(rhs)); }
bool operator<(const CQuantity &rhs) const { return less_d(qty, rhs.qty); }
bool operator<(uint32_t rhs) const { return this->operator<(u(rhs)); }
bool operator<=(const CQuantity &rhs) const {
return less_eq_d(qty, rhs.qty);
}
bool operator<=(uint32_t rhs) const { return this->operator<=(u(rhs)); }
CQuantity &operator+=(std::uint32_t inc) {
qty += inc;
return *this;
}
CQuantity &operator+=(const CQuantity inc) {
qty += inc.qty;
return *this;
}
CQuantity &operator-=(std::uint32_t inc) {
qty -= inc;
return *this;
}
CQuantity &operator-=(const CQuantity inc) {
qty -= inc.qty;
return *this;
}
};
inline std::ostream &operator<<(std::ostream &out, CQuantity const &qty) {
out << qty.full_value();
return out;
}
using Price = utils::ValueWrapper<struct OrderPriceTag, double>;
// using Quantity = utils::ValueWrapper<struct QuantityTag, uint32_t>;
using Quantity = CQuantity;
using UserLogin = utils::ValueWrapper<struct UserLoginTag, std::string>;
} // namespace bts
#pragma once
#ifndef _WIN32
#include <bits/stdint-uintn.h>
#endif
#include <cstdint>
#include <string>
#include "lib/domain_model/SecurityKey.h"
#include "lib/utils/ValueWrapper.h"
namespace bts {
struct CQuantity {
double qty = 0;
constexpr static double err = 0.0000001;
CQuantity() {}
CQuantity(uint32_t whole_qty) : qty(whole_qty) {}
CQuantity(uint32_t int_qty, double fractional_qty)
: qty(int_qty + fractional_qty) {}
uint32_t value() const { return static_cast<uint32_t>(qty); }
double full_value() const { return qty; }
uint32_t int_part() { return static_cast<uint32_t>(qty); }
double fractional_part() { return full_value() - int_part(); }
static bool equal_d(double d1, double d2) {
return std::abs(d1 - d2) <= err;
}
static bool greater_d(double d1, double d2) { return d1 - d2 > err; }
static bool greater_eq_d(double d1, double d2) {
return equal_d(d1, d2) || greater_d(d1, d2);
}
static bool less_d(double d1, double d2) { return greater_d(d2, d1); }
static bool less_eq_d(double d1, double d2) {
return less_d(d1, d2) || equal_d(d1, d2);
}
static CQuantity u(uint32_t u) { return CQuantity(u); }
// CQuantity &operator=(uint32_t whole_qty) noexcept {
// qty = whole_qty;
// return *this;
// }
CQuantity &operator=(double full_qty) noexcept {
qty = full_qty;
return *this;
}
bool operator==(const CQuantity &rhs) const { return equal_d(qty, rhs.qty); }
bool operator==(uint32_t rhs) const {
return this->operator==(CQuantity{rhs});
}
bool operator!=(const CQuantity &rhs) const {
return !this->operator==(rhs);
}
bool operator!=(uint32_t &rhs) const { return this->operator!=(u(rhs)); }
bool operator>(const CQuantity &rhs) const {
return greater_d(qty, rhs.qty);
}
bool operator>(uint32_t rhs) const { return this->operator>(u(rhs)); }
bool operator>=(const CQuantity &rhs) const {
return greater_eq_d(qty, rhs.qty);
}
bool operator>=(uint32_t rhs) const { return this->operator>=(u(rhs)); }
bool operator<(const CQuantity &rhs) const { return less_d(qty, rhs.qty); }
bool operator<(uint32_t rhs) const { return this->operator<(u(rhs)); }
bool operator<=(const CQuantity &rhs) const {
return less_eq_d(qty, rhs.qty);
}
bool operator<=(uint32_t rhs) const { return this->operator<=(u(rhs)); }
CQuantity &operator+=(std::uint32_t inc) {
qty += inc;
return *this;
}
CQuantity &operator+=(const CQuantity inc) {
qty += inc.qty;
return *this;
}
CQuantity &operator-=(std::uint32_t inc) {
qty -= inc;
return *this;
}
CQuantity &operator-=(const CQuantity inc) {
qty -= inc.qty;
return *this;
}
};
inline std::ostream &operator<<(std::ostream &out, CQuantity const &qty) {
out << qty.full_value();
return out;
}
using Price = utils::ValueWrapper<struct OrderPriceTag, double>;
// using Quantity = utils::ValueWrapper<struct QuantityTag, uint32_t>;
using Quantity = CQuantity;
using UserLogin = utils::ValueWrapper<struct UserLoginTag, std::string>;
} // namespace bts
+1 -2
View File
@@ -1,11 +1,10 @@
#include "../Security.h"
#include "catch/catch.hpp"
#include "lib/domain_model/Security.h"
#include "lib/utils/PBUtils.h"
#include "lib/utils/datetime.h"
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <catch2/catch_test_macros.hpp>
namespace bts {
namespace test {
+2 -2
View File
@@ -4,8 +4,8 @@
#include "lib/utils/bts_no_copy.h"
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/phoenix_function.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/phoenix/function.hpp>
#include <boost/phoenix/operator.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/support_utree.hpp>
-2
View File
@@ -43,8 +43,6 @@
#include <tuple>
#include <utility>
#include <vector>
#include <websocketpp/client.hpp>
#include <websocketpp/server.hpp>
namespace bts::io::websocket {
@@ -41,8 +41,6 @@
#include <tuple>
#include <utility>
#include <vector>
#include <websocketpp/client.hpp>
#include <websocketpp/server.hpp>
namespace bts::io::websocket {
@@ -40,8 +40,6 @@
#include <tuple>
#include <utility>
#include <vector>
#include <websocketpp/client.hpp>
#include <websocketpp/server.hpp>
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
+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);
+1 -1
View File
@@ -1,8 +1,8 @@
#include "catch/catch.hpp"
#include "lib/config/config.h"
#include "lib/config/protos/logging.pb.h"
#include "lib/utils/bts_chrono.h"
#include "lib/logging/logging.h"
#include <catch2/catch_test_macros.hpp>
namespace bts {
int logging_tests;
+6 -6
View File
@@ -100,8 +100,8 @@ class IntPrice {
}
IntPrice sign_extend(int8_t new_exponent) const {
int8_t delta = _exponent - new_exponent;
int64_t m = _mantissa * pow10(delta);
auto delta = static_cast<std::int8_t>(_exponent - new_exponent);
auto m = static_cast<std::int64_t>(_mantissa * pow10(delta));
return {m, new_exponent};
}
@@ -124,12 +124,12 @@ class IntPrice {
return IntPrice();
bts_assert_d(o.exponent() <= 0 && _exponent <= 0);
if (o.exponent() < _exponent) {
int8_t delta = _exponent - o.exponent();
int64_t m = _mantissa * pow10(delta);
auto delta = static_cast<std::int8_t>(_exponent - o.exponent());
auto m = static_cast<std::int64_t>(_mantissa * pow10(delta));
return {operation(m, o.mantissa()), o.exponent()};
} else {
int8_t delta = o.exponent() - _exponent;
int64_t m = o.mantissa() * pow10(delta);
auto delta = static_cast<std::int8_t>(o.exponent() - _exponent);
auto m = static_cast<std::int64_t>(o.mantissa() * pow10(delta));
return {operation(_mantissa, m), exponent()};
}
}
Loaded 100 of 284 files, more files were not shown because too many files have changed in this diff. Show more