Compare commits

..
Author SHA1 Message Date
John Colvin d24becd052 fix: Ensure LadderGridHost's price_comparer isn't null
Initialize it w/ reasonable default when LadderGridHost is constructed.

Bugs (fixed):
  * Sometimes the OrderBook's ladder panel throws a null ref ex when the
    orders collection changes

  Cause: The orders collection changed callback references the ladder's
  price_comparer, which may be null since it isn't initialized until the
  DataContextChanged event fires (the relative order of these events is
  non-deterministic)
2023-11-02 14:15:58 -04:00
John Colvin 13251f5c06 fix: Add special-case tick logic for [non-perp] futs at Deribit
Unlike any other securities supported by our system, these use
TickFactors of 25/10 (e.g., 10.0, 12.5, 15.0, etc.)
2023-11-02 13:55:36 -04:00
John Colvin 03b9aaa0e8 fix: Dispose BBOVM's md poll loop
Bugs (fixed):
  * Memory Leak! The md poll loop (instance var) in BBOVM is never
    disposed
2023-11-02 12:47:58 -04:00
Mohammad Arham 32d127fd84 added log to chec user input 2023-10-18 09:34:00 -07:00
John Colvin 3cb69c7520 fix build: Pass 'shell=true' to subprocess.run
Otherwise it doesn't evaluate the command string properly
2023-10-17 13:50:38 -04:00
John Colvin 47e897d038 feat: Resurrect VolSurfaceAdvancedSettings 2023-10-17 13:50:38 -04:00
John Colvin 126ec169ea refactor: Remove useless param 2023-10-17 13:49:13 -04:00
John Colvin 84953df12c dev: Copy docker/sparkd dir from development branch
So we can build prod in devcontainer
2023-10-17 13:34:23 -04:00
John Colvin e8322183ec Update externals to get emumba-deribit deb w/out LICENSE check 2023-10-17 13:33:01 -04:00
Mohammad Arham 30ba7ecd19 added logs for _default_abs_moves 2023-10-10 15:14:28 -07:00
Mohammad Arham db6b34c6a8 changd default_abs_moves from hard coded to config 2023-10-05 23:17:02 -07:00
Taha Afzal 4dbafcab91 TaskingEye can shoot deep in the book as well 2023-08-18 05:44:12 +00:00
Taha Afzal 9fd7f8a0a6 Adding security list for TaskingEye Algo 2023-08-17 21:33:40 +00:00
1967 changed files with 627287 additions and 190839 deletions

No files matched your search

-1
View File
@@ -4,7 +4,6 @@ BinPackParameters: false
AlignAfterOpenBracket: AlwaysBreak
AlwaysBreakTemplateDeclarations: true
PenaltyReturnTypeOnItsOwnLine: 140
ReflowComments: false
---
Language: Proto
IndentWidth: 2
+2 -2
View File
@@ -9,7 +9,7 @@
]
},
"fable": {
"version": "4.0.6",
"version": "4.0.0-theta-018",
"commands": [
"fable"
]
@@ -27,4 +27,4 @@
]
}
}
}
}
+1 -5
View File
@@ -50,8 +50,4 @@ trace_data/
*.tmp/*
/.venv*/*
.cache/
/src/Spark.Admin.WebApp/tsconfig.*.g.json
/src/Spark.Admin.WebApp/src/bin/
**/CMakeDeps.cmake
**/CMakeDeps_win.cmake
**/devcontainer.json
src/web/api/tsconfig.*.g.json
+6
View File
@@ -1,3 +1,9 @@
[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
+72 -116
View File
@@ -1,6 +1,5 @@
cmake_minimum_required(VERSION 3.12)
project(spark)
set(CMAKE_CXX_STANDARD 20)
if(WIN32)
set(platform "windows")
@@ -14,144 +13,101 @@ 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/$<CONFIG>")
set(BUILD_API_SERVER OFF CACHE BOOL "Build the api server")
set(BUILD_DOCS OFF CACHE BOOL "Build documentation")
set(SPARK_LIB "${EXTERNALS_ROOT}/lib/${CMAKE_BUILD_TYPE}")
set(BUILD_SDK OFF CACHE BOOL "Build the sdk")
if (WIN32)
set(BUILD_SPARKD OFF CACHE BOOL "Build sparkd")
set(BUILD_ADMIN_WEB_APP OFF CACHE BOOL "Build the Admin WebApp")
else()
set(BUILD_SPARKD ON CACHE BOOL "Build sparkd")
set(BUILD_ADMIN_WEB_APP ON CACHE BOOL "Build the Admin WebApp")
endif()
set(BUILD_WEB ON CACHE BOOL "Build the web server")
include_directories(BEFORE SYSTEM ${SPARK_INCLUDE} ${EXTERNALS_ROOT}/include/zlib)
link_directories(${SPARK_LIB})
if(BUILD_API_SERVER)
add_compile_definitions(SPARK_ENABLE_API_SERVER)
endif()
if(WIN32)
add_compile_definitions(SHARED_MEMORY_PREFIX="spark")
add_compile_definitions(APP_DATA_DIR="\$\{APPDATA\}/bts/")
# 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)
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")
set(SPARK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/$<CONFIG>")
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_EXCHANGE_BINANCE)
add_compile_definitions(CCAPI_ENABLE_LOG_WARN)
if(BUILD_API_SERVER)
add_compile_definitions(APP_DATA_DIR="\$\{HOME\}/spark_api/")
add_compile_definitions(SHARED_MEMORY_PREFIX="spark_api")
elseif(BUILD_SPARKD)
add_compile_definitions(SHARED_MEMORY_PREFIX="sparkd")
add_compile_definitions(APP_DATA_DIR="\$\{HOME\}/sparkdata/")
# Note: All macros that begin w/ 'CCAPI' are ccapi's macros (defined and/or
# read by their code). We override some below.
add_compile_definitions(SPARK_ENABLE_CCAPI)
# This allows us to override hardcoded exchange-urls with ones read from
# config (i.e., resolved at runtime rather than compile-time)
add_compile_definitions(CCAPI_EXPOSE_INTERNAL)
# Enable ccapi services
add_compile_definitions(CCAPI_ENABLE_SERVICE_MARKET_DATA)
add_compile_definitions(CCAPI_ENABLE_SERVICE_EXECUTION_MANAGEMENT)
# Enable ccapi exchanges
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_COIN_FUTURES)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_US)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_USDS_FUTURES)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_COINBASE)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_DERIBIT)
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_OKX)
set(CCAPI_LOG_LEVEL
"Warn"
CACHE STRING "<Fatal|Error|Warn|Info|Debug|Trace> Log level for ccapi")
string(TOUPPER "${CCAPI_LOG_LEVEL}" _ccapi_log_level_upper)
add_compile_definitions("CCAPI_ENABLE_LOG_${_ccapi_log_level_upper}")
# ** Binance **
add_compile_definitions(CCAPI_BINANCE_URL_REST_BASE="https://api.binance.com")
add_compile_definitions(BINANCE_INSTRUMENTS_PATH="/api/v3/exchangeInfo")
add_compile_definitions(BINANCE_PRICE_STATS_PATH="/api/v3/ticker/24hr")
# ** Binance US **
add_compile_definitions(BINANCE_US_INSTRUMENTS_PATH="/api/v3/exchangeInfo")
add_compile_definitions(BINANCE_US_PRICE_STATS_PATH="/api/v3/ticker/24hr")
# ** Binance USDS Futures **
add_compile_definitions(CCAPI_BINANCE_USDS_FUTURES_URL_REST_BASE="https://dapi.binance.com")
add_compile_definitions(BINANCE_USDS_FUTURES_INSTRUMENTS_PATH="/dapi/v1/exchangeInfo")
add_compile_definitions(BINANCE_USDS_FUTURES_PRICE_STATS_PATH="/dapi/v1/ticker/24hr")
# ** Deribit **
add_compile_definitions(DERIBIT_INSTRUMENT_PATH="/api/v2/public/get_instrument")
add_compile_definitions(DERIBIT_INSTRUMENTS_PATH="/api/v2/public/get_instruments")
add_compile_definitions(DERIBIT_COMBOS_PATH="/api/v2/public/get_combos")
add_compile_definitions(DERIBIT_TICKER_PATH="/api/v2/public/ticker")
add_compile_definitions(DERIBIT_CURRENCIES_METHOD="public/get_currencies")
add_compile_definitions(DERIBIT_INSTRUMENT_METHOD="public/get_instrument")
add_compile_definitions(DERIBIT_INSTRUMENTS_METHOD="public/get_instruments")
add_compile_definitions(DERIBIT_COMBO_DETAILS_METHOD="public/get_combo_details")
add_compile_definitions(DERIBIT_COMBOS_METHOD="public/get_combos")
# ** Okx **
add_compile_definitions(OKX_INSTRUMENTS_PATH="/api/v5/public/instruments")
add_compile_definitions(OKX_UNDERLYING_PATH="/api/v5/public/underlying")
endif()
# 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
if (BUILD_SPARKD)
add_subdirectory(src/server/sparkd)
add_subdirectory(src/data_files)
endif()
add_subdirectory(src/server/sparkd)
add_subdirectory(src/lib)
if (BUILD_ADMIN_WEB_APP)
add_subdirectory(src/Spark.Admin.WebApp)
endif()
if(BUILD_DOCS)
add_subdirectory(doc/user)
if (BUILD_WEB)
add_subdirectory(src/web)
endif()
add_subdirectory(doc/user)
if(BUILD_SDK)
add_subdirectory(src/sdk)
endif()
add_subdirectory(src/data_files)
if(BUILD_SPARKD)
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}/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_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)
add_custom_target(server_layout ALL DEPENDS ${CMAKE_BINARY_DIR}/server)
install(
DIRECTORY "${CMAKE_BINARY_DIR}/server/plugins"
DESTINATION "${SPARK_INSTALL_PREFIX}/bin")
install(
FILES
"${SPARK_LIB}/libACE-5.7.5.so"
"${SPARK_LIB}/libOnixS.IceImpactMulticastPriceFeedHandlerCpp.so.3.16.0.0"
"${CMAKE_SOURCE_DIR}/externals/src/emumba/sparkd.lic"
DESTINATION "${SPARK_INSTALL_PREFIX}/bin")
endif()
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()
-383
View File
@@ -1,383 +0,0 @@
{
"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",
"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_SHARED_LINKER_FLAGS_DEBUG": "/DEBUG",
"CMAKE_SHARED_LINKER_FLAGS_RELEASE": "/OPT:REF /OPT:ICF /LTCG",
"EXTERNALS_ROOT": "${sourceDir}/externals/windows",
"CONFIG_DEFAULTS_PATH": "config/profiles/default/*.conf",
"DOTNET_BINARY_DIR": "${sourceDir}/build/$<CONFIG>/bin/net7.0",
"DOTNET_WINDOWS_BINARY_DIR": "${sourceDir}/build/$<CONFIG>/bin/net7.0-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_CXX_STANDARD": "20",
"CMAKE_INSTALL_RPATH": ".",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}/sparkd",
"CMAKE_EXE_LINKER_FLAGS": "-Wno-undef",
"EXTERNALS_ROOT": "${sourceDir}/externals/linux",
"BUILD_SDK": {
"type": "BOOL",
"value": "OFF"
},
"BUILD_ADMIN_WEB_APP": {
"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",
"CONFIG_DEFAULTS_PATH": "config/profiles/md_dev/*.conf;config/profiles/default/*.conf"
}
},
{
"name": "sparkd-release",
"inherits": "sparkd",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CCAPI_LOG_LEVEL": "Warn",
"CONFIG_DEFAULTS_PATH": "config/profiles/md_prod/*.conf;config/profiles/default/*.conf"
}
},
{
"name": "sparkd-debug-clang",
"inherits": "sparkd-debug",
"displayName": "Debug (clang)",
"description": "Debug build compiled w/ clang",
"binaryDir": "${sourceDir}/build/clang/debug",
"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",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/clang/debug/sparkd"
}
},
{
"name": "sparkd-debug-gcc",
"inherits": "sparkd-debug",
"displayName": "Debug (gcc)",
"description": "Debug build compiled w/ gcc",
"binaryDir": "${sourceDir}/build/gcc/debug",
"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",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/gcc/debug/sparkd"
}
},
{
"name": "sparkd-release-clang",
"inherits": "sparkd-release",
"displayName": "Release (clang)",
"description": "Release build compiled w/ clang",
"binaryDir": "${sourceDir}/build/clang/release",
"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",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/clang/release/sparkd"
}
},
{
"name": "sparkd-release-gcc",
"inherits": "sparkd-release",
"displayName": "Release (gcc)",
"description": "Release build compiled w/ gcc",
"binaryDir": "${sourceDir}/build/gcc/release",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_CXX_FLAGS_RELEASE": "-fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers --std=c++20 -fdiagnostics-color -Wno-stringop-overread -Wno-maybe-uninitialized -fno-omit-frame-pointer -DNDEBUG -O3",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/gcc/release/sparkd"
}
},
{
"name": "spark-api-server-base",
"hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_API_SERVER": {
"type": "bool",
"value": "ON"
},
"CONFIG_DEFAULTS_PATH": "config/profiles/md_dev/*.conf;config/profiles/default/*.conf"
}
},
{
"name": "spark-api-server-windows",
"inherits": "spark",
"displayName": "Spark Api Server",
"cacheVariables": {
"BUILD_API_SERVER": {
"type": "bool",
"value": "ON"
}
}
},
{
"name": "spark-api-server-linux",
"inherits": "sparkd",
"displayName": "Spark Api Server",
"generator": "Ninja Multi-Config",
"cacheVariables": {
"BUILD_ADMIN_WEB_APP": {
"type": "BOOL",
"value": "OFF"
},
"BUILD_API_SERVER": {
"type": "bool",
"value": "ON"
},
"BUILD_SPARKD": {
"type": "BOOL",
"value": "OFF"
},
"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",
"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",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
"CONFIG_DEFAULTS_PATH": "config/profiles/default/*.conf",
"DOTNET_BINARY_DIR": "${sourceDir}/build/$<CONFIG>/bin/net7.0"
}
},
{
"name": "sparkd-publish",
"inherits": "sparkd-release-gcc",
"displayName": "Publish",
"description": "Production build compiled w/ gcc and ready to ship"
},
{
"name": "sparkd-ccapi-diag",
"inherits": "sparkd-debug-clang",
"displayName": "Debug (ccapi diag)",
"description": "Debug build w/ ccapi log level 'Trace'",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CCAPI_LOG_LEVEL": "Trace"
}
},
{
"name": "data-stream-suite",
"inherits": "spark",
"displayName": "Data Stream Suite",
"description": "Data Stream utils ported over from Edge",
"binaryDir": "${sourceDir}/build/${presetName}"
}
],
"buildPresets": [
{
"name": "spark",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"hidden": true
},
{
"name": "spark-debug",
"displayName": "Debug",
"inherits": "spark",
"configurePreset": "spark",
"configuration": "Debug"
},
{
"name": "spark-release",
"displayName": "Release",
"inherits": "spark",
"configurePreset": "spark",
"configuration": "Release"
},
{
"name": "sparkd",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"hidden": true,
"targets": [
"data_files_dir",
"admin_web_app_bundle",
"install",
"libspark",
"rapidjson_project",
"server_layout",
"sparkd"
]
},
{
"name": "sparkd-debug-clang",
"configurePreset": "sparkd-debug-clang",
"displayName": "Debug (clang)",
"inherits": "sparkd"
},
{
"name": "sparkd-debug-gcc",
"configurePreset": "sparkd-debug-gcc",
"displayName": "Debug (gcc)",
"inherits": "sparkd"
},
{
"name": "sparkd-release-clang",
"configurePreset": "sparkd-release-clang",
"displayName": "Release (clang)",
"inherits": "sparkd"
},
{
"name": "sparkd-release-gcc",
"configurePreset": "sparkd-release-gcc",
"displayName": "Release (gcc)",
"inherits": "sparkd"
},
{
"name": "spark-api-server-windows",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"hidden": true,
"configurePreset": "spark-api-server-windows"
},
{
"name": "spark-api-server-windows-debug",
"displayName": "Spark Api Server (Debug)",
"inherits": "spark-api-server-windows",
"configuration": "Debug"
},
{
"name": "spark-api-server-windows-release",
"displayName": "Spark Api Server (Debug)",
"inherits": "spark-api-server-windows",
"configuration": "Release"
},
{
"name": "spark-api-server-linux",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"hidden": true,
"configurePreset": "spark-api-server-linux"
},
{
"name": "spark-api-server-linux-debug",
"inherits": "spark-api-server-linux",
"displayName": "Spark Api Server (Debug)",
"configuration": "Debug"
},
{
"name": "spark-api-server-linux-release",
"inherits": "spark-api-server-linux",
"displayName": "Spark Api Server (Release)",
"configuration": "Release"
},
{
"name": "sparkd-publish",
"configurePreset": "sparkd-publish",
"displayName": "Publish",
"inherits": "sparkd",
"targets": "install"
},
{
"name": "sparkd-ccapi-diag",
"configurePreset": "sparkd-ccapi-diag",
"displayName": "Debug (ccapi diag)",
"inherits": "sparkd"
},
{
"name": "data-stream-suite-debug",
"displayName": "DataStreamSuite (Debug)",
"configurePreset": "data-stream-suite",
"configuration": "Debug"
},
{
"name": "data-stream-suite-release",
"displayName": "DataStreamSuite (Release)",
"configurePreset": "data-stream-suite",
"configuration": "Release"
}
]
}
-83
View File
@@ -1,83 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
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("{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_websocket", "src\client\spark_websocket\spark_websocket.csproj", "{3201359D-C071-4089-9EDE-B04D759F1508}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "spark_api_server", "src\client\spark_api_server\spark_api_server.csproj", "{2B8C5D01-FF78-4BFA-B332-5E430586DAF9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spark_test", "src\client\spark_test\spark_test.csproj", "{EFC9FC4D-E92B-4C6D-9B97-26D38EAA118D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spark.Console", "src\client\Spark.Console\Spark.Console.csproj", "{89D666E6-B500-498F-B026-4D167F68ADFC}"
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
{DC9A8975-8211-4FC9-A9BA-C8B9D26AD481}.Debug|x64.ActiveCfg = Debug|x64
{DC9A8975-8211-4FC9-A9BA-C8B9D26AD481}.Debug|x64.Build.0 = Debug|x64
{DC9A8975-8211-4FC9-A9BA-C8B9D26AD481}.MinSizeRel|x64.ActiveCfg = Release|x64
{DC9A8975-8211-4FC9-A9BA-C8B9D26AD481}.MinSizeRel|x64.Build.0 = Release|x64
{DC9A8975-8211-4FC9-A9BA-C8B9D26AD481}.Release|x64.ActiveCfg = Release|x64
{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
{6E449EB6-20AC-4FA6-B8D9-10F4BB7E1FEE}.Debug|x64.ActiveCfg = Debug|x64
{6E449EB6-20AC-4FA6-B8D9-10F4BB7E1FEE}.Debug|x64.Build.0 = Debug|x64
{6E449EB6-20AC-4FA6-B8D9-10F4BB7E1FEE}.MinSizeRel|x64.ActiveCfg = Release|x64
{6E449EB6-20AC-4FA6-B8D9-10F4BB7E1FEE}.MinSizeRel|x64.Build.0 = Release|x64
{6E449EB6-20AC-4FA6-B8D9-10F4BB7E1FEE}.Release|x64.ActiveCfg = Release|x64
{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
{3201359D-C071-4089-9EDE-B04D759F1508}.Debug|x64.ActiveCfg = Debug|x64
{3201359D-C071-4089-9EDE-B04D759F1508}.Debug|x64.Build.0 = Debug|x64
{3201359D-C071-4089-9EDE-B04D759F1508}.MinSizeRel|x64.ActiveCfg = Debug|x64
{3201359D-C071-4089-9EDE-B04D759F1508}.MinSizeRel|x64.Build.0 = Debug|x64
{3201359D-C071-4089-9EDE-B04D759F1508}.Release|x64.ActiveCfg = Release|x64
{3201359D-C071-4089-9EDE-B04D759F1508}.Release|x64.Build.0 = Release|x64
{3201359D-C071-4089-9EDE-B04D759F1508}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{3201359D-C071-4089-9EDE-B04D759F1508}.RelWithDebInfo|x64.Build.0 = Release|x64
{2B8C5D01-FF78-4BFA-B332-5E430586DAF9}.Debug|x64.ActiveCfg = Debug|x64
{2B8C5D01-FF78-4BFA-B332-5E430586DAF9}.Debug|x64.Build.0 = Debug|x64
{2B8C5D01-FF78-4BFA-B332-5E430586DAF9}.MinSizeRel|x64.ActiveCfg = Debug|x64
{2B8C5D01-FF78-4BFA-B332-5E430586DAF9}.MinSizeRel|x64.Build.0 = Debug|x64
{2B8C5D01-FF78-4BFA-B332-5E430586DAF9}.Release|x64.ActiveCfg = Release|x64
{2B8C5D01-FF78-4BFA-B332-5E430586DAF9}.Release|x64.Build.0 = Release|x64
{2B8C5D01-FF78-4BFA-B332-5E430586DAF9}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{2B8C5D01-FF78-4BFA-B332-5E430586DAF9}.RelWithDebInfo|x64.Build.0 = Release|x64
{EFC9FC4D-E92B-4C6D-9B97-26D38EAA118D}.Debug|x64.ActiveCfg = Debug|x64
{EFC9FC4D-E92B-4C6D-9B97-26D38EAA118D}.Debug|x64.Build.0 = Debug|x64
{EFC9FC4D-E92B-4C6D-9B97-26D38EAA118D}.MinSizeRel|x64.ActiveCfg = Debug|x64
{EFC9FC4D-E92B-4C6D-9B97-26D38EAA118D}.MinSizeRel|x64.Build.0 = Debug|x64
{EFC9FC4D-E92B-4C6D-9B97-26D38EAA118D}.Release|x64.ActiveCfg = Release|x64
{EFC9FC4D-E92B-4C6D-9B97-26D38EAA118D}.Release|x64.Build.0 = Release|x64
{EFC9FC4D-E92B-4C6D-9B97-26D38EAA118D}.RelWithDebInfo|x64.ActiveCfg = Debug|x64
{EFC9FC4D-E92B-4C6D-9B97-26D38EAA118D}.RelWithDebInfo|x64.Build.0 = Debug|x64
{89D666E6-B500-498F-B026-4D167F68ADFC}.Debug|x64.ActiveCfg = Debug|x64
{89D666E6-B500-498F-B026-4D167F68ADFC}.Debug|x64.Build.0 = Debug|x64
{89D666E6-B500-498F-B026-4D167F68ADFC}.MinSizeRel|x64.ActiveCfg = Debug|x64
{89D666E6-B500-498F-B026-4D167F68ADFC}.MinSizeRel|x64.Build.0 = Debug|x64
{89D666E6-B500-498F-B026-4D167F68ADFC}.Release|x64.ActiveCfg = Release|x64
{89D666E6-B500-498F-B026-4D167F68ADFC}.Release|x64.Build.0 = Release|x64
{89D666E6-B500-498F-B026-4D167F68ADFC}.RelWithDebInfo|x64.ActiveCfg = Debug|x64
{89D666E6-B500-498F-B026-4D167F68ADFC}.RelWithDebInfo|x64.Build.0 = Debug|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {422D1620-0166-4C26-9A81-CA8A2EB1AB58}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal
-12
View File
@@ -1,12 +0,0 @@
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
View File
@@ -121,6 +121,8 @@ function(Service_Compiler_Generate_Cpp SRCS HDRS)
endforeach()
set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
# remove some warnings from protobuf generated files
if(WIN32)
set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS
-224
View File
@@ -1,224 +0,0 @@
[cmake]: https://cmake.org/
[cmake ext]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools
[cmake presets]: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html
[cpp ext]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
[clangd ext]: https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
[dotnet]: https://dotnet.microsoft.com/en-us/download/dotnet
[ninja build]: https://ninja-build.org/
[ninja generator]: https://cmake.org/cmake/help/latest/generator/Ninja.html
[ninja multi-config generator]: https://cmake.org/cmake/help/latest/generator/Ninja%20Multi-Config.html
[python]: https://www.python.org/
[py venv]: https://docs.python.org/3/library/venv.html
[visual studio]: https://visualstudio.microsoft.com/
[visual studio generator]: https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html
# C++ Intellisense for Spark on Windows (VS Code)
**Steps**
1. Install the **[C++ extension][cpp ext]**
2. Install the **[CMake extension][cmake ext]**
3. Copy `c_cpp_properties.json` from this folder to `$workspaceFolder/.vscode/`
4. In the VS Code Command Palette, run **CMake: Select Configure Preset**, then
select '**spark**' from the dropdown
**Notes**
* Intellisense won't work for generated files/types until you build libspark
# C++ Intellisense for Sparkd on Linux (VS Code)
1. Install the **[CMake extension][cmake ext]**
2. Install the **[Clangd extension][clangd ext]**
3. (Optional) Install the **[C++ extension][cpp ext]** (*needed for debugging,
but intellisense should work without it*).
4. If the **[C++ extension][cpp ext]** is installed, disable its intellisense in
your workspace settings (*Clangd intellisense is better*)
```
"C_Cpp.intelliSenseEngine": "disabled"
```
5. In the VS Code Command Palette, run **CMake: Select Configure Preset**, then select the
**[preset][cmake presets]** you wish to build from the dropdown
* *The **Clang** presets may work best with the **Clangd** extension*
* *Intellisense won't work for generated files/types until you build libspark*
# Build Spark on Windows
### Dependencies
* **[CMake][cmake]** (version >= 3.23)
* **[Python][python]** (version >= 3.9)
* **[Visual Studio][visual studio]** (2022)
* **[Dotnet][dotnet]** (sdk version >= 7.0.0)
### References
* **[CMakePresets][cmake presets]**
* **[Visual Studio 17 2022 (CMake generator)][visual studio generator]**
* **[Python Virtual Environment][py venv]**
### Notes
* *Run commands from the repo root dir unless otherwise noted*
1. Set up the **[Python virtual environment][py venv]**<br>
```
# Create the virtual environment
python3 -m venv .venv
# Activate the virtual environment
.venv\bin\activate.bat
# Update pip
python -m pip install --upgrade pip
# Install packages
pip install -r requirements.txt
```
2. Build
* *Run commands in python virtual environment*
```
# Configure
cmake --preset spark
# Build Debug
cmake --build --preset spark-debug
dotnet build spark_client.sln --configuration Debug
# Build Release
cmake --build --preset spark-release
dotnet build spark_client.sln --configuration Release
```
# Build Sparkd on Linux
### **Dependencies**
* **[CMake][cmake]** (version >= 3.23)
* **[Ninja Build][ninja build]**
* **[Python][python]** (version >= 3.9)
### **References**
* **[CMakePresets][cmake presets]**
* **[Ninja (CMake generator)][ninja generator]**
* **[Python Virtual Environment][py venv]**
* **[Devcontainer](devcontainer)**
### Prerequisites
* Open repository in a VS Code [Devcontainer](../docker/sparkd/dev/README.md), or
create your own [docker container](../docker/sparkd/dev/README.md) in which to build
### Notes
* *Run commands from the repo root dir unless otherwise noted*<br>
1. Set up the **[Python virtual environment][py venv]**
```
# Create the virtual environment
python3 -m venv .venv
# Activate the virtual environment
. .venv/bin/activate
# Update pip
python -m pip install --upgrade pip
# Install packages
pip install -r requirements.txt
```
2. Build
* *Run commands in python virtual environment*
```
# Configure clang debug
cmake --preset sparkd-clang-debug
# Build clang debug
cmake --build --preset spark-clang-debug
# Configure gcc release
cmake --build --preset sparkd-gcc-release
# Build gcc release
cmake --build --preset sparkd-gcc-release
```
# Build Spark Api Server on Windows
### **Dependencies**
* **[CMake][cmake]** (version >= 3.23)
* **[Python][python]** (version >= 3.9)
* **[Visual Studio][visual studio]** (version)
* **[Dotnet][dotnet]** (sdk version >= 7.0.0)
### **References**
* **[CMakePresets][cmake presets]**
* **[Visual Studio 17 2022 (CMake generator)][visual studio generator]**
* **[Python Virtual Environment][py venv]**
### Notes
* *Run commands from the repo root dir unless otherwise noted*
1. Set up the **[Python Virtual Environment][py venv]**
```
# Create the virtual environment
python3 -m venv .venv
# Activate the virtual environment
.venv\bin\activate.bat
# Update pip
python -m pip install --upgrade pip
# Install packages
pip install -r requirements.txt
```
2. Build
* *Run in python virtual environment*
```
# Configure
cmake --preset spark-api-server-windows
# Build debug
cmake --build --preset spark-api-server-windows-debug
dotnet build Spark.Api.Server.sln --configuration Debug
# Build release
cmake --build --preset spark-api-server-windows-release
dotnet build Spark.Api.Server.sln --configuration Release
```
# Build Spark Api Server on Linux
### **Dependencies**
* **[CMake][cmake]** (version >= 3.23)
* **[Ninja Build][ninja build]**
* **[Python][python]** (version >= 3.9)
* **[Dotnet][dotnet]** (sdk version >= 7.0.0)
### **References**
* **[CMakePresets][cmake presets]**
* **[Ninja Multi-Config (CMake generator)][ninja multi-config generator]**
* **[Python Virtual Environment][py venv]**
### Prerequisites
* Open repository in a VS Code [Devcontainer](../docker/sparkd/dev/README.md), or
create your own [docker container](../docker/sparkd/dev/README.md) in which to build
### Notes
* *Run commands from the repo root dir unless otherwise noted*
1. Set up the **[Python Virtual Environment][py venv]**
```
# Create the virtual environment
python3 -m venv .venv
# Activate the virtual environment
. .venv/bin/activate
# Update pip
python -m pip install --upgrade pip
# Install packages
pip install -r requirements.txt
```
2. Build
* *Run in python virtual environment*
```
# Configure
cmake --preset spark-api-server-linux
# Build debug
cmake --build --preset spark-api-server-linux-debug
dotnet build Spark.Api.Server.sln --configuration Debug
# Build release
cmake --build --preset spark-api-server-linux-release
dotnet build Spark.Api.Server.sln --configuration Release
```
-27
View File
@@ -1,27 +0,0 @@
{
"version": 4,
"configurations": [
{
"name": "Windows",
"intelliSenseMode": "windows-msvc-x64",
"includePath": [
"${workspaceFolder}/src/",
"${workspaceFolder}/build/src/",
"${workspaceFolder}/externals/windows/include/"
],
"defines": ["_WIN32", "__x86_64__"],
"browse": {
"path": [
"${workspaceRoot}/src",
"${workspaceRoot}/build/src"
],
"limitSymbolsToIncludedHeaders": true
},
"cStandard": "c17",
"cppStandard": "c++17",
"configurationProvider": "ms-vscode.cmake-tools",
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe",
"mergeConfigurations": true
}
]
}
+1
View File
@@ -0,0 +1 @@
set(sources /home/taha/spark/doc/user/build.sh;content/_index.md;content/bts_spark/Glossary/_index.md;content/bts_spark/Help/_index.md;content/bts_spark/Help/about_spark.png;content/bts_spark/Help/image39.png;content/bts_spark/Help/image58.png;content/bts_spark/Launcher/_index.md;content/bts_spark/Launcher/image38.png;content/bts_spark/Launcher/image68.png;content/bts_spark/Logging-In-to-the-System/_index.md;content/bts_spark/Logging-In-to-the-System/image3.png;content/bts_spark/Logging-In-to-the-System/image64.png;content/bts_spark/Market/_index.md;content/bts_spark/Market/change_securities.png;content/bts_spark/Market/image11.png;content/bts_spark/Market/image14.png;content/bts_spark/Market/image20.png;content/bts_spark/Market/image21.png;content/bts_spark/Market/image23.png;content/bts_spark/Market/image24.png;content/bts_spark/Market/image34.png;content/bts_spark/Market/image49.png;content/bts_spark/Market/image53.png;content/bts_spark/Market/image66.png;content/bts_spark/Market/image69.png;content/bts_spark/Market/market_view.png;content/bts_spark/Market/settings_icon.png;content/bts_spark/Market/time_and_sales.png;content/bts_spark/My-Windows/_index.md;content/bts_spark/My-Windows/image15.png;content/bts_spark/My-Windows/image16.png;content/bts_spark/My-Windows/image37.png;content/bts_spark/Settings/_index.md;content/bts_spark/Settings/image51.png;content/bts_spark/Settings/image9.png;content/bts_spark/Spreader/_index.md;content/bts_spark/Spreader/image10.png;content/bts_spark/Spreader/image13.png;content/bts_spark/Spreader/image18.png;content/bts_spark/Spreader/image19.png;content/bts_spark/Spreader/image28.png;content/bts_spark/Spreader/image29.png;content/bts_spark/Spreader/image31.png;content/bts_spark/Spreader/image35.png;content/bts_spark/Spreader/image40.png;content/bts_spark/Spreader/image43.png;content/bts_spark/Spreader/image54.png;content/bts_spark/Spreader/image55.png;content/bts_spark/Spreader/image56.png;content/bts_spark/Spreader/image6.png;content/bts_spark/Spreader/image7.png;content/bts_spark/Spreader/image70.png;content/bts_spark/Spreader/image72.png;content/bts_spark/Spreader/image8.png;content/bts_spark/Trading/OrderTypes/index.md;content/bts_spark/Trading/_index.md;content/bts_spark/Trading/algo_studio.png;content/bts_spark/Trading/collapse_all_icon.png;content/bts_spark/Trading/cover_algo_control.png;content/bts_spark/Trading/expand_all_icon.png;content/bts_spark/Trading/image1.png;content/bts_spark/Trading/image17.png;content/bts_spark/Trading/image2.png;content/bts_spark/Trading/image25.png;content/bts_spark/Trading/image27.png;content/bts_spark/Trading/image33.png;content/bts_spark/Trading/image42.png;content/bts_spark/Trading/image44.png;content/bts_spark/Trading/image47.png;content/bts_spark/Trading/image48.png;content/bts_spark/Trading/image5.png;content/bts_spark/Trading/image50.png;content/bts_spark/Trading/image52.png;content/bts_spark/Trading/image57.png;content/bts_spark/Trading/image59.png;content/bts_spark/Trading/image60.png;content/bts_spark/Trading/image61.png;content/bts_spark/Trading/image62.png;content/bts_spark/Trading/image73.png;content/bts_spark/Trading/image74.png;content/bts_spark/Trading/join_algo_control.png;content/bts_spark/Trading/ladder.png;content/bts_spark/Trading/ladder_badges.png;content/bts_spark/Trading/ladder_main_part.png;content/bts_spark/Trading/lean_algo_control.png;content/bts_spark/Trading/mini_orderbook.png;content/bts_spark/Trading/oco_algo_control.png;content/bts_spark/Trading/offset_algo_control.png;content/bts_spark/Trading/pnl_calculation.png;content/bts_spark/Trading/pnl_window.png;content/bts_spark/Trading/recreate_icon.png;content/bts_spark/Trading/settings_icon.png;content/bts_spark/Trading/spark_menu_order_book.png;content/bts_spark/Trading/top_algo_control.png;content/bts_spark/Trading/trigger_algo_control.png;content/bts_spark/_index.md;content/release_notes/_index.md;content/system_requirements/_index.md;static/book.js;static/favicon.ico;static/image.js;templates/index.html;templates/page.html;templates/section.html;templates/shortcodes/back_button.html)
Submodule
+1
Submodule docker/linux added at 6537812262.
+74 -42
View File
@@ -1,66 +1,98 @@
FROM ubuntu:22.10
FROM ubuntu:latest
RUN \
apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=America/New_York
# light deps (should be quick to download/install)
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
gnupg \
liblttng-ust-dev \
libpcap0.8-dev \
locales \
ninja-build \
software-properties-common \
sqlite3 \
tzdata
# clang
RUN apt-get update && apt-get install -y \
clang-13 \
clang-format-13 \
clangd-13 \
clang-15 \
clang-format-15 \
clangd-15 \
cmake \
curl \
dotnet7 \
fish \
clangd-15
# g++
RUN apt-get update && apt-get install -y \
g++-11 \
g++-12 \
gnupg \
liblttng-ust-dev \
libssh2-1-dev \
libpcap0.8-dev \
locales \
ninja-build \
nodejs \
npm \
openssh-server \
g++-12
# python
RUN apt-get update && apt-get install -y \
python3-pip \
python3-venv \
rapidjson-dev \
software-properties-common \
sqlite3 \
sudo \
tar \
vim \
wget
&& python3 -m pip install --upgrade pip
# this is done here so that ccache sees clang++ installed, not clang-10
RUN \
apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y ccache
# dotnet
RUN apt-get update && apt-get install -y \
dotnet7
# emumba deps
# ssh
RUN apt-get update && apt-get install -y \
libssh2-1-dev \
openssh-server
# cmake
RUN \
apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
tzdata \
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" \
&& apt-get update \
&& apt-get install -y cmake
# 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
# ccache is done here so that ccache sees clang++ installed, not clang-10
RUN apt-get update && apt-get install -y \
ccache
# emumba (light deps)
RUN apt-get update && apt-get install -y \
build-essential \
cmake-curses-gui \
git-all \
doxygen \
python3-sphinx \
graphviz \
libgtest-dev \
libssl-dev \
rapidjson-dev \
zlib1g-dev \
pkg-config
# emumba (boost)
RUN apt-get update && apt-get install -y \
libboost-filesystem-dev \
libboost-program-options-dev \
libboost-test-dev \
libboost-date-time-dev \
zlib1g-dev \
netcat-traditional \
net-tools \
gdb gdbserver \
pkg-config
libboost-date-time-dev
# dev utils
RUN apt-get update && apt-get install -y \
fish \
git-all \
sudo \
vim \
wget
# set up default executables (update-alternatives)
RUN \
+1 -1
View File
@@ -55,7 +55,7 @@ then select your container in the dropdown
3. Push the new image to Docker Hub
```
docker push johncolvin/bluetradingsystems:sparkd-dev
docker push bluetradingsystems/sparkd-dev:latest
```
***Note:** The image doesn't have to be on Docker Hub, we can simply build
it from scratch on our local machines (with the Dockerfile). However, this
+1
Submodule docker/windows added at de7d40c09d.
+2 -6
View File
@@ -1,22 +1,18 @@
astroid==2.7.3
autopep8==1.5.7
certifi==2023.5.7
charset-normalizer==3.1.0
cffi==1.14.6
colorama==0.4.4
idna==3.4
isort==5.9.3
lazy-object-proxy==1.6.0
mccabe==0.6.1
platformdirs==2.3.0
protobuf==4.21.12
protobuf==3.19.1
pybars3==0.9.7
pycodestyle==2.7.0
pycparser==2.20
pylint==2.10.2
PyMeta3==0.5.1
requests==2.31.0
termcolor==1.1.0
toml==0.10.2
urllib3==2.0.3
wrapt==1.12.1
yapf==0.31.0
+41
View File
@@ -0,0 +1,41 @@
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
+15 -2
View File
@@ -1,16 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
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}") = "Spark.Console", "src\client\Spark.Console\Spark.Console.csproj", "{387566C6-C6F6-412C-A30C-9855BBCB4816}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "sparkcmd", "src\client\sparkcmd\sparkcmd.csproj", "{387566C6-C6F6-412C-A30C-9855BBCB4816}"
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
@@ -34,6 +39,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
{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
@@ -1,26 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
</ItemGroup>
<ItemGroup>
<Reference Include="Tools">
<HintPath>$(Externals)\bin\cstools\Tools.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="$(DataStreamGrammarDir)\BooleanExpressionTokens.lexer.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(DataStreamGrammarDir)\BooleanExpressionSyntax.parser.cs" />
</ItemGroup>
</Project>
@@ -1,289 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace BCG
{
public delegate bool BooleanEval(object arg1,
object arg2,
IDictionary bindings);
public class BooleanExpressionException : Exception
{
public BooleanExpressionException(string format, params object[] args)
: base(String.Format(format, args))
{ }
}
public abstract class BooleanExpressionValue
{
public abstract object getValue(IDictionary bindings);
}
public class BooleanExpressionConstant : BooleanExpressionValue
{
public BooleanExpressionConstant(object o)
{ myObj = o; }
public override object getValue(IDictionary bindings)
{ return myObj; }
private object myObj;
}
public class BooleanExpressionVariable : BooleanExpressionValue
{
public BooleanExpressionVariable(string id)
{ myId = id; }
public string getId()
{ return myId; }
public override object getValue(IDictionary bindings)
{ return bindings[myId]; }
private string myId;
}
public delegate object BEFunction(List<object> args);
public class BooleanExpressionFunction : BooleanExpressionValue
{
public BooleanExpressionFunction(string fn, ArrayList args)
{
myFunction = fn;
myArgs = args;
}
public string getId()
{ return myFunction; }
public override object getValue(IDictionary bindings)
{
List<object> argValues = new List<object>();
if (myArgs != null)
foreach (object o in myArgs)
if (o is BooleanExpressionValue)
argValues.Add(((BooleanExpressionValue)o).getValue(bindings));
else
throw new Exception("Unknown arg value type: " + o.ToString());
string k = BooleanExpressionEvaluator.functionPrefix + myFunction;
if (bindings.Contains(k))
return ((BEFunction)(bindings[k]))(argValues);
else
throw new BooleanExpressionException("function {0} is not defined", myFunction);
}
private string myFunction;
private ArrayList myArgs;
}
public class BooleanExpressionEvaluator
{
public const string functionPrefix = "function:";
public BooleanExpressionEvaluator (object arg1,
BooleanEval f)
: this (arg1, null, f)
{}
public BooleanExpressionEvaluator (object arg1,
object arg2,
BooleanEval f)
{
myArg1 = arg1;
myArg2 = arg2;
myF = f;
}
static BooleanExpressionEvaluator()
{
myNumberTypes = new Hashtable();
myNumberTypes[typeof(byte)] = true;
myNumberTypes[typeof(sbyte)] = true;
myNumberTypes[typeof(short)] = true;
myNumberTypes[typeof(ushort)] = true;
myNumberTypes[typeof(int)] = true;
myNumberTypes[typeof(uint)] = true;
myNumberTypes[typeof(long)] = true;
myNumberTypes[typeof(ulong)] = true;
myNumberTypes[typeof(double)] = true;
myNumberTypes[typeof(float)] = true;
}
public bool eval (IDictionary bindings)
{
return
myF (myArg1, myArg2,bindings);
}
public static bool and (object arg1, object arg2, IDictionary bindings)
{
return
(arg1 as BooleanExpressionEvaluator).eval (bindings)
&&
(arg2 as BooleanExpressionEvaluator).eval (bindings);
}
public static bool or (object arg1, object arg2, IDictionary bindings)
{
return
(arg1 as BooleanExpressionEvaluator).eval (bindings)
||
(arg2 as BooleanExpressionEvaluator).eval (bindings);
}
public static bool xor (object arg1, object arg2, IDictionary bindings)
{
return
(arg1 as BooleanExpressionEvaluator).eval (bindings)
!=
(arg2 as BooleanExpressionEvaluator).eval (bindings);
}
public static bool not (object arg1, object arg2, IDictionary bindings)
{
return
!(arg1 as BooleanExpressionEvaluator).eval (bindings);
}
public static bool booleanValue(object arg1, object arg2, IDictionary bindings)
{
return (bool)(arg1 as BooleanExpressionValue).getValue(bindings);
}
public static bool myIsConversionLegal(Type t1, Type t2)
{
return
myNumberTypes.Contains(t1) &&
myNumberTypes.Contains(t2);
}
public static bool smaller (object arg1, object arg2, IDictionary bindings)
{
object lobj = (arg1 as BooleanExpressionValue).getValue(bindings);
object robj = (arg2 as BooleanExpressionValue).getValue(bindings);
try
{
if (lobj is DBNull && robj is DBNull)
return false;
// anything is bigger than DBNull
if (lobj is DBNull)
return true;
if (robj is DBNull)
return false;
if (lobj is string)
lobj = ((string)lobj).Trim();
if (robj is string)
robj = ((string)robj).Trim();
if (!lobj.GetType().Equals(robj.GetType()))
{
if (myIsConversionLegal(lobj.GetType(), robj.GetType()))
lobj =
Convert.ChangeType(lobj,robj.GetType());
else if (myIsConversionLegal(robj.GetType(), lobj.GetType()))
robj =
Convert.ChangeType(robj,lobj.GetType());
}
IComparable ic = lobj as IComparable;
return ic.CompareTo(robj) < 0;
}
catch (Exception e)
{
//BlueEventLog.logEvent(String.Format("Comparison between {0} and {1} failed",
// lobj == null? "null" : lobj, robj == null? null : robj),BlueEventLevel.Warning);
//BlueEventLog.logEvent(e);
throw (e);
}
}
public static bool equal (object arg1, object arg2, IDictionary bindings)
{
return
!(smaller (arg1, arg2, bindings) )
&&
!(smaller (arg2, arg1, bindings));
}
public static bool greater (object arg1, object arg2, IDictionary bindings)
{
return
smaller (arg2,arg1, bindings);
}
public static bool smallerEqual (object arg1, object arg2, IDictionary bindings)
{
return
!greater(arg1, arg2, bindings);
}
public static bool greaterEqual (object arg1, object arg2, IDictionary bindings)
{
return
!smaller (arg1, arg2, bindings);
}
public static bool different (object arg1, object arg2, IDictionary bindings)
{
return
!equal (arg1, arg2, bindings);
}
public static bool matches (object arg1, object arg2, IDictionary bindings)
{
try
{
object lobj = (arg1 as BooleanExpressionValue).getValue(bindings);
object robj = (arg2 as BooleanExpressionValue).getValue(bindings);
if (DBNull.Value.Equals(lobj) && (robj is string))
return false;
else if (lobj is string && robj is string)
return Regex.IsMatch((string) lobj, (string) robj);
else
throw new Exception(String.Format("Type mismatch, cannot string match {0} with {1}",
lobj.GetType().Name,
robj.GetType().Name));
}
catch (Exception e)
{
//BlueEventLog.logEvent(string.Format ("Comparison between {0} and {1} failed",
// arg1 == null? "null" : arg1, arg2 == null? null : arg2));
//BlueEventLog.logEvent(e);
throw (e);
}
}
public object getOperand1()
{return myArg1;}
public object getOperand2()
{return myArg2;}
private object myArg1;
private object myArg2;
private BooleanEval myF;
private static Hashtable myNumberTypes ;
}
}
@@ -1,191 +0,0 @@
using System;
using System.Collections;
using System.IO;
using NUnit.Framework;
using System.Diagnostics;
using BCG.Evaluator.BooleanExpression;
namespace BCG
{
[TestFixture]
public class BooleanExpressionsTests
{
[Test]
public void testBooleanExpressions()
{
BCG.Evaluator.BooleanExpression.syntax parser =
new BCG.Evaluator.BooleanExpression.syntax();
BooleanProgram exp = (BooleanProgram)parser.Parse("a=12/12/1912 and 2 = null or b=2 and not c=1 and b > a");
Hashtable h = new Hashtable();
h["a"] = new DateTime(1912, 12, 12, 0, 0, 1);
h["b"] = 2;
h["c"] = 2;
h["d"] = new DateTime(1912, 12, 12, 0, 0, 2);
Assert.That(exp.eval.eval(h));
parser =
new BCG.Evaluator.BooleanExpression.syntax();
exp = (BooleanProgram)parser.Parse("a=1 and (b=2 or b=3)");
h = new Hashtable();
h["a"] = 1;
h["b"] = 5;
Assert.That(!exp.eval.eval(h));
// comparisons
// >
exp = (BooleanProgram)parser.Parse("a>b");
h = new Hashtable();
h["a"] = 1;
h["b"] = 5;
Assert.That(!exp.eval.eval(h));
h["a"] = 5;
h["b"] = 1;
Assert.That(exp.eval.eval(h));
h["a"] = 1;
h["b"] = 1;
Assert.That(!exp.eval.eval(h));
// <
exp = (BooleanProgram)parser.Parse("a<b");
h = new Hashtable();
h["a"] = 1;
h["b"] = 5;
Assert.That(exp.eval.eval(h));
h["a"] = 5;
h["b"] = 1;
Assert.That(!exp.eval.eval(h));
h["a"] = 1;
h["b"] = 1;
Assert.That(!exp.eval.eval(h));
// =
exp = (BooleanProgram)parser.Parse("a=b");
h = new Hashtable();
h["a"] = 1;
h["b"] = 5;
Assert.That(!exp.eval.eval(h));
h["a"] = 1;
h["b"] = 1;
Assert.That(exp.eval.eval(h));
// <=
exp = (BooleanProgram)parser.Parse("a<=b");
h = new Hashtable();
h["a"] = 1;
h["b"] = 5;
Assert.That(exp.eval.eval(h));
h["a"] = 5;
h["b"] = 1;
Assert.That(!exp.eval.eval(h));
h["a"] = 1;
h["b"] = 1;
Assert.That(exp.eval.eval(h));
// >=
exp = (BooleanProgram)parser.Parse("a>=b");
h = new Hashtable();
h["a"] = 1;
h["b"] = 5;
Assert.That(!exp.eval.eval(h));
h["a"] = 5;
h["b"] = 1;
Assert.That(exp.eval.eval(h));
h["a"] = 1;
h["b"] = 1;
Assert.That(exp.eval.eval(h));
// <>
exp = (BooleanProgram)parser.Parse("a<>b");
h = new Hashtable();
h["a"] = 1;
h["b"] = 5;
Assert.That(exp.eval.eval(h));
h["a"] = 1;
h["b"] = 1;
Assert.That(!exp.eval.eval(h));
// ~= (matches)
exp = (BooleanProgram)parser.Parse("a~=b");
h = new Hashtable();
h["a"] = "test";
h["b"] = "test";
Assert.That(exp.eval.eval(h));
h = new Hashtable();
h["a"] = "test";
h["b"] = "te.*";
Assert.That(exp.eval.eval(h));
h = new Hashtable();
h["a"] = "test";
h["b"] = "ti.*";
Assert.That(!exp.eval.eval(h));
h["a"] = DBNull.Value;
h["b"] = "1";
Assert.That(!exp.eval.eval(h));
// mixing ints and doubles
exp = (BooleanProgram)parser.Parse("a=b");
h = new Hashtable();
h["a"] = 1.0;
h["b"] = 5;
Assert.That(!exp.eval.eval(h));
exp = (BooleanProgram)parser.Parse("a=b");
h = new Hashtable();
h["a"] = 1;
h["b"] = 1.0;
exp = (BooleanProgram)parser.Parse("a=b");
h = new Hashtable();
h["a"] = 1.1;
h["b"] = 1;
Assert.That(!exp.eval.eval(h));
}
}
}
@@ -1,128 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using BCG.Evaluator.BooleanExpression;
namespace BCG
{
public class BooleanExpressionsInterpreter
{
public class ParseTree
{
public BooleanProgram prog;
}
BooleanExpressionEvaluator myEval;
Dictionary<string, FunctionDefinition> myBindings = new Dictionary<string, FunctionDefinition>();
private string _exp;
public BooleanExpressionsInterpreter(string exp, out ParseTree prog)
{
_exp = exp;
myInit(exp, out prog);
}
public BooleanExpressionsInterpreter(string exp)
{
ParseTree pt;
myInit(exp, out pt);
}
private void myInit(string exp, out ParseTree pt)
{
syntax parser = new syntax();
try
{
pt = new ParseTree();
BooleanProgram bp;
pt.prog = (BooleanProgram)parser.Parse(exp);
if (pt.prog == null)
throw new BooleanExpressionsInterpreterException("{0} is not a valid boolean expression", exp);
myExtractDefinitions(pt.prog.definitions, myBindings);
myEval = pt.prog.eval;
}
catch (Tools.CSToolsFatalException)
{
throw new BooleanExpressionsInterpreterException("{0} is not a valid boolean expression", exp);
}
}
private void myVisitNode(object node, Action<object> a)
{
a(node);
if (node is BooleanExpression)
{
BooleanExpression be = (BooleanExpression)node;
foreach (object child in be.kids)
myVisitNode(child, a);
}
}
public void walkParseStree(Action<object> a, ParseTree pt)
{
foreach (object node in pt.prog.kids)
myVisitNode(node, a);
}
public Dictionary<string, bool> getAllIdentifiers(ParseTree pt)
{
Dictionary<string, bool> bindings = new Dictionary<string, bool>();
Action<object> a = (o) =>
{
if (o is IdentifierValue)
{
BooleanExpressionValue bev = ((IdentifierValue)o).eval;
BooleanExpressionVariable bvar = (BooleanExpressionVariable)bev;
bindings[bvar.getId()] = true;
}
else if (o is FunctionValue)
{
BooleanExpressionValue bev = ((FunctionValue)o).eval;
BooleanExpressionFunction func = (BooleanExpressionFunction)bev;
bindings[func.getId()] = false;
}
};
walkParseStree(a, pt);
return bindings;
}
private void myExtractDefinitions(Definitions definitions,
Dictionary<string, FunctionDefinition> bindings)
{
if (definitions != null)
{
SingleDef d = definitions.def;
List<string> args = new List<string>();
myExtractArg(d.args, args);
bindings[functionPrefix + d.id] = new FunctionDefinition
{ name = d.id, args = args, evaluator = d.eval };
myExtractDefinitions(definitions.next, bindings);
}
}
public int nDefinitions()
{ return myBindings.Count; }
private void myExtractArg(DefArgList args, List<string> argList)
{
if (args != null && args.arg != null)
{
argList.Add(args.arg);
myExtractArg(args.rest, argList);
}
}
// there are repeated here so clients do not have to know about BooleanExpressionEvaluator
public static string functionPrefix = BooleanExpressionEvaluator.functionPrefix;
public delegate object Function(List<object> args);
public object makeCBWrapper(Function f)
{ return new BEFunction((lst) => { return f(lst); }); }
public bool eval(IDictionary bindings)
{ return myEval.eval(new EvaluationEnvironment(bindings, myBindings)); }
}
}
@@ -1,22 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BooleanExpressions\BooleanExpressions.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Tools">
<HintPath>$(Externals)\bin\cstools\Tools.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
@@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BCG
{
public class BooleanExpressionsInterpreterException : System.Exception
{
public BooleanExpressionsInterpreterException(string fmt, params object[] args)
: base(String.Format(fmt, args))
{ }
}
}
@@ -1,232 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
namespace BCG
{
class EvaluationEnvironment : IDictionary
{
IDictionary myUserBindings;
Dictionary<string, FunctionDefinition> myDefinitions;
public EvaluationEnvironment(IDictionary userBindings, Dictionary<string, FunctionDefinition> definitions)
{
this.myUserBindings = userBindings;
this.myDefinitions = definitions;
}
class Override : IDictionary
{
public Override(IDictionary d1, IDictionary d2)
{
myPrimary = d1;
mySecondary = d2;
}
public bool Contains(object key)
{
return
myPrimary.Contains(key)||
mySecondary.Contains(key);
}
public object this[object key]
{
get
{
if (myPrimary.Contains(key))
return myPrimary[key];
else
return mySecondary[key];
}
set
{
throw new NotImplementedException();
}
}
IDictionary myPrimary;
IDictionary mySecondary;
#region Useless IDictionary Members
public void Add(object key, object value)
{
throw new NotImplementedException();
}
public void Clear()
{
throw new NotImplementedException();
}
public IDictionaryEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
public bool IsFixedSize
{
get { throw new NotImplementedException(); }
}
public bool IsReadOnly
{
get { throw new NotImplementedException(); }
}
public ICollection Keys
{
get { throw new NotImplementedException(); }
}
public void Remove(object key)
{
throw new NotImplementedException();
}
public ICollection Values
{
get { throw new NotImplementedException(); }
}
public void CopyTo(Array array, int index)
{
throw new NotImplementedException();
}
public int Count
{
get { throw new NotImplementedException(); }
}
public bool IsSynchronized
{
get { throw new NotImplementedException(); }
}
public object SyncRoot
{
get { throw new NotImplementedException(); }
}
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}
#endregion
}
public bool Contains(object key)
{
if (myDefinitions.ContainsKey(key.ToString()))
return true;
else
return myUserBindings.Contains(key);
}
public object this[object key]
{
get
{
if (myDefinitions.ContainsKey(key.ToString()))
{
FunctionDefinition fd = myDefinitions[key.ToString()];
return new BEFunction((args) =>
{
if (args.Count != fd.args.Count)
throw new BooleanExpressionsInterpreterException("Parameter count mismatch for {0}. Expected: {1} Got: {2}",
fd.name, fd.args.Count, args.Count);
else
{
Hashtable newBindings = new Hashtable();
for (int i = 0; i < args.Count; i++)
newBindings[fd.args[i]] = args[i];
return fd.evaluator.eval(new EvaluationEnvironment(new Override(newBindings, myUserBindings), myDefinitions));
}
});
}
else
return myUserBindings[key];
}
set
{
throw new NotImplementedException();
}
}
#region Useless IDictionary Members
public void Add(object key, object value)
{
throw new NotImplementedException();
}
public void Clear()
{
throw new NotImplementedException();
}
public IDictionaryEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
public bool IsFixedSize
{
get { throw new NotImplementedException(); }
}
public bool IsReadOnly
{
get { throw new NotImplementedException(); }
}
public ICollection Keys
{
get { throw new NotImplementedException(); }
}
public void Remove(object key)
{
throw new NotImplementedException();
}
public ICollection Values
{
get { throw new NotImplementedException(); }
}
public void CopyTo(Array array, int index)
{
throw new NotImplementedException();
}
public int Count
{
get { throw new NotImplementedException(); }
}
public bool IsSynchronized
{
get { throw new NotImplementedException(); }
}
public object SyncRoot
{
get { throw new NotImplementedException(); }
}
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}
#endregion
}
}
@@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BCG
{
class FunctionDefinition
{
public string name;
public List<string> args;
public BooleanExpressionEvaluator evaluator;
}
}
@@ -1,86 +0,0 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
using System.Diagnostics;
namespace BCG
{
[TestFixture]
public class BooleaExpressionTests
{
[Test]
public void baseTest()
{
var interp =
new BooleanExpressionsInterpreter("1=1");
Assert.IsTrue(interp.eval(new Dictionary<string, object>()));
interp = new BooleanExpressionsInterpreter(@"define a() { true }
define f() { a and b and c}
define g(a,b,c) { a and b and c}
true");
Assert.IsTrue(interp.eval(new Dictionary<string, object>()));
interp = new BooleanExpressionsInterpreter("id>0");
Assert.IsTrue(interp.eval(new Dictionary<string, object> { { "id", 1 } }));
}
[Test]
public void getAllIdentifiersWorks()
{
BooleanExpressionsInterpreter.ParseTree pt;
var interp =
new BooleanExpressionsInterpreter("a=12/12/1912 and 2 = null or b=2 and not c=1 and b > a and f(1,2) > y(2,3)",out pt);
Dictionary<string, bool> ids = interp.getAllIdentifiers(pt);
Assert.AreEqual(ids.Count, 5);
Assert.IsTrue(ids["a"]);
Assert.IsTrue(ids["b"]);
Assert.IsTrue(ids["c"]);
Assert.IsFalse(ids["f"]);
Assert.IsFalse(ids["y"]);
}
[Test]
public void parameterPassingWorks()
{
var interp = new BooleanExpressionsInterpreter(@"define inOrder(a,b,c) { a >= b and b >= c}
inOrder(x,y,z)");
Assert.IsTrue(interp.eval(new Dictionary<string, object>{{"x",3},{"y",2},{"z",1}}));
Assert.IsFalse(interp.eval(new Dictionary<string, object> { { "x", 1 }, {"y", 2 }, {"z", 3} }));
}
[Test]
public void parametersHaveCorretScope()
{
var interp = new BooleanExpressionsInterpreter(@"define inOrder(z,y,x) { z >= y and y >= x}
inOrder(x,y,z)");
Assert.IsTrue(interp.eval(new Dictionary<string, object> { { "x", 3 }, { "y", 2 }, { "z", 1 } }));
Assert.IsFalse(interp.eval(new Dictionary<string, object> { { "x", 1 }, { "y", 2 }, { "z", 3 } }));
}
[Test]
public void functionsCanCallOtherFunctions()
{
var interp = new BooleanExpressionsInterpreter(
@"define ascending(x,y,z) { x <= y and y <= z}
define descending(x,y,z) { ascending(z,y,x)}
descending(x,y,z)");
Assert.IsTrue(interp.eval(new Dictionary<string, object> { { "x", 3 }, { "y", 2 }, { "z", 1 } }));
Assert.IsFalse(interp.eval(new Dictionary<string, object> { { "x", 1 }, { "y", 2 }, { "z", 3 } }));
}
[Test]
public void evaluationHasDynamicScope()
{
var interp = new BooleanExpressionsInterpreter(
@"define isEquity(){ group='Equity'}
isEquity()");
Assert.IsTrue(interp.eval(new Dictionary<string, object> { { "group", "Equity" } }));
Assert.IsFalse(interp.eval(new Dictionary<string, object> { { "group", "NotEquity" } }));
}
}
}
@@ -1,27 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BooleanExpressionsInterpreter\BooleanExpressionsInterpreter.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Tools">
<HintPath>$(Externals)\bin\cstools\Tools.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="$(DataStreamGrammarDir)\ArithmeticTokens.lexer.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(DataStreamGrammarDir)\ArithmeticSyntax.parser.cs" />
<Compile Include="$(DataStreamGrammarDir)\ColumnMapExpressionSyntax.parser.cs" />
</ItemGroup>
</Project>
@@ -1,14 +0,0 @@
namespace BCG {
using System;
using System.Collections;
public class PrimitiveManager {
public static PrimitiveManager instance => throw new NotImplementedException();
public ViewStream build(string friendlyName, ICollection args) =>
throw new NotImplementedException();
public string find(string friendlyName) =>
throw new NotImplementedException();
}
}
@@ -1,5 +0,0 @@
namespace BCG {
public class TableStream : ViewStream {
public TableStream(string name) {}
}
}
@@ -1,4 +0,0 @@
namespace BCG {
public class ViewStream {
}
}
@@ -1,8 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -1,15 +0,0 @@
%parser ArithmeticTokens.lexer
%namespace BCG.ArithmeticExpression
%left Plus Minus
%left Times Div
%before Minus
%nonassoc Equals
BindingExpression: BindingExpression Assignment | Assignment;
Assignment: Identifier Equals Expression;
Expression : Expression Plus Term | Expression Minus Term | Term;
Term : Term Times Factor | Term Div Factor | Factor;
Factor : Application | Identifier | IntegerConstant | RealConstant | Minus Factor | OpenP Expression CloseP;
Application : Identifier OpenP ExpressionList CloseP;
ExpressionList : | ExpressionList Comma Expression | Expression;
File diff suppressed because it is too large. Load diff
@@ -1,43 +0,0 @@
%lexer
%namespace BCG.ArithmeticExpression
// -------------------------------------------------------------------------------
// Literal constants
//--------------------------------------------------------------------------------
%define TimeConstant [012]?{Digit}:[0-5]{Digit}:[0-5]{Digit}[ ]('AM'|'PM')
%define DateConstant ([1-9]|'10'|'11'|'12')\/([1-9]|([1-2][0-9])|'30'|'31')\/{Digit}{Digit}{Digit}*
%token NumberConstant {
public object value;
}
%token IntegerConstant : NumberConstant {}
%token RealConstant : NumberConstant {}
-?{Digit}+ %IntegerConstant {value = Int32.Parse(yytext);}
-?{Digit}+\.{Digit}+ %RealConstant {value = Double.Parse(yytext);}
// --------------------------------------------------------------------------------
// Identifiers
// --------------------------------------------------------------------------------
{Letter}({Letter}*{Digit}*_*)* %Identifier
// --------------------------------------------------------------------------------
// Utility tokens
// --------------------------------------------------------------------------------
"(" %OpenP
")" %CloseP
"-" %Minus
"*" %Times
"/" %Div
"," %Comma
"+" %Plus
"=" %Equals
'\/\/'[^\n\r]* ;
[ \t\r\n] ;
@@ -1,948 +0,0 @@
using System;using Tools;
namespace BCG.ArithmeticExpression {
//%+NumberConstant
[Serializable] public class NumberConstant : TOKEN{
public object value ;
public override string yyname() { return "NumberConstant"; }
public NumberConstant(Lexer yyl):base(yyl){}}
//%+IntegerConstant
[Serializable] public class IntegerConstant : NumberConstant{
public override string yyname() { return "IntegerConstant"; }
public IntegerConstant(Lexer yyl):base(yyl){}}
//%+RealConstant
[Serializable] public class RealConstant : NumberConstant{
public override string yyname() { return "RealConstant"; }
public RealConstant(Lexer yyl):base(yyl){}}
[Serializable] public class IntegerConstant_1 : IntegerConstant {
public IntegerConstant_1(Lexer yym):base(yym) {value = Int32.Parse(yytext);}}
[Serializable] public class RealConstant_1 : RealConstant {
public RealConstant_1(Lexer yym):base(yym) {value = Double.Parse(yytext);}}
//%Identifier
[Serializable] public class Identifier : TOKEN{ public override string yyname() { return "Identifier";}
public Identifier(Lexer yyl):base(yyl) {}}
//%OpenP
[Serializable] public class OpenP : TOKEN{ public override string yyname() { return "OpenP";}
public OpenP(Lexer yyl):base(yyl) {}}
//%CloseP
[Serializable] public class CloseP : TOKEN{ public override string yyname() { return "CloseP";}
public CloseP(Lexer yyl):base(yyl) {}}
//%Minus
[Serializable] public class Minus : TOKEN{ public override string yyname() { return "Minus";}
public Minus(Lexer yyl):base(yyl) {}}
//%Times
[Serializable] public class Times : TOKEN{ public override string yyname() { return "Times";}
public Times(Lexer yyl):base(yyl) {}}
//%Div
[Serializable] public class Div : TOKEN{ public override string yyname() { return "Div";}
public Div(Lexer yyl):base(yyl) {}}
//%Comma
[Serializable] public class Comma : TOKEN{ public override string yyname() { return "Comma";}
public Comma(Lexer yyl):base(yyl) {}}
//%Plus
[Serializable] public class Plus : TOKEN{ public override string yyname() { return "Plus";}
public Plus(Lexer yyl):base(yyl) {}}
//%Equals
[Serializable] public class Equals : TOKEN{ public override string yyname() { return "Equals";}
public Equals(Lexer yyl):base(yyl) {}}
//%|tokens
public class yytokens : Tokens {
public yytokens(ErrorHandler eh):base(eh) { arr = new byte[] {
0,1,0,0,0,255,255,255,255,1,
0,0,0,0,0,0,0,4,1,0,0,
0,25,83,121,115,116,101,109,46,84,101,
120,116,46,65,83,67,73,73,69,110,99,
111,100,105,110,103,9,0,0,0,10,109,
95,99,111,100,101,80,97,103,101,8,100,
97,116,97,73,116,101,109,15,101,110,99,
111,100,101,114,70,97,108,108,98,97,99,
107,15,100,101,99,111,100,101,114,70,97,
108,108,98,97,99,107,19,69,110,99,111,
100,105,110,103,43,109,95,99,111,100,101,
80,97,103,101,17,69,110,99,111,100,105,
110,103,43,100,97,116,97,73,116,101,109,
21,69,110,99,111,100,105,110,103,43,109,
95,105,115,82,101,97,100,79,110,108,121,
24,69,110,99,111,100,105,110,103,43,101,
110,99,111,100,101,114,70,97,108,108,98,
97,99,107,24,69,110,99,111,100,105,110,
103,43,100,101,99,111,100,101,114,70,97,
108,108,98,97,99,107,0,3,3,3,0,
3,0,3,3,8,37,83,121,115,116,101,
109,46,71,108,111,98,97,108,105,122,97,
116,105,111,110,46,67,111,100,101,80,97,
103,101,68,97,116,97,73,116,101,109,38,
83,121,115,116,101,109,46,84,101,120,116,
46,69,110,99,111,100,101,114,82,101,112,
108,97,99,101,109,101,110,116,70,97,108,
108,98,97,99,107,38,83,121,115,116,101,
109,46,84,101,120,116,46,68,101,99,111,
100,101,114,82,101,112,108,97,99,101,109,
101,110,116,70,97,108,108,98,97,99,107,
8,37,83,121,115,116,101,109,46,71,108,
111,98,97,108,105,122,97,116,105,111,110,
46,67,111,100,101,80,97,103,101,68,97,
116,97,73,116,101,109,1,38,83,121,115,
116,101,109,46,84,101,120,116,46,69,110,
99,111,100,101,114,82,101,112,108,97,99,
101,109,101,110,116,70,97,108,108,98,97,
99,107,38,83,121,115,116,101,109,46,84,
101,120,116,46,68,101,99,111,100,101,114,
82,101,112,108,97,99,101,109,101,110,116,
70,97,108,108,98,97,99,107,159,78,0,
0,10,9,2,0,0,0,9,3,0,0,
0,159,78,0,0,10,1,9,2,0,0,
0,9,3,0,0,0,4,2,0,0,0,
38,83,121,115,116,101,109,46,84,101,120,
116,46,69,110,99,111,100,101,114,82,101,
112,108,97,99,101,109,101,110,116,70,97,
108,108,98,97,99,107,3,0,0,0,10,
115,116,114,68,101,102,97,117,108,116,27,
98,73,115,77,105,99,114,111,115,111,102,
116,66,101,115,116,70,105,116,70,97,108,
108,98,97,99,107,43,69,110,99,111,100,
101,114,70,97,108,108,98,97,99,107,43,
98,73,115,77,105,99,114,111,115,111,102,
116,66,101,115,116,70,105,116,70,97,108,
108,98,97,99,107,1,0,0,1,1,6,
6,0,0,0,1,63,0,0,4,3,0,
0,0,38,83,121,115,116,101,109,46,84,
101,120,116,46,68,101,99,111,100,101,114,
82,101,112,108,97,99,101,109,101,110,116,
70,97,108,108,98,97,99,107,3,0,0,
0,10,115,116,114,68,101,102,97,117,108,
116,27,98,73,115,77,105,99,114,111,115,
111,102,116,66,101,115,116,70,105,116,70,
97,108,108,98,97,99,107,43,68,101,99,
111,100,101,114,70,97,108,108,98,97,99,
107,43,98,73,115,77,105,99,114,111,115,
111,102,116,66,101,115,116,70,105,116,70,
97,108,108,98,97,99,107,1,0,0,1,
1,9,6,0,0,0,0,0,11,0,1,
0,0,0,255,255,255,255,1,0,0,0,
0,0,0,0,4,1,0,0,0,14,83,
121,115,116,101,109,46,66,111,111,108,101,
97,110,1,0,0,0,7,109,95,118,97,
108,117,101,0,1,0,11,0,1,0,0,
0,255,255,255,255,1,0,0,0,0,0,
0,0,4,1,0,0,0,28,83,121,115,
116,101,109,46,67,111,108,108,101,99,116,
105,111,110,115,46,72,97,115,104,116,97,
98,108,101,7,0,0,0,10,76,111,97,
100,70,97,99,116,111,114,7,86,101,114,
115,105,111,110,8,67,111,109,112,97,114,
101,114,16,72,97,115,104,67,111,100,101,
80,114,111,118,105,100,101,114,8,72,97,
115,104,83,105,122,101,4,75,101,121,115,
6,86,97,108,117,101,115,0,0,3,3,
0,5,5,11,8,28,83,121,115,116,101,
109,46,67,111,108,108,101,99,116,105,111,
110,115,46,73,67,111,109,112,97,114,101,
114,36,83,121,115,116,101,109,46,67,111,
108,108,101,99,116,105,111,110,115,46,73,
72,97,115,104,67,111,100,101,80,114,111,
118,105,100,101,114,8,236,81,56,63,31,
0,0,0,10,10,47,0,0,0,9,2,
0,0,0,9,3,0,0,0,16,2,0,
0,0,29,0,0,0,9,4,0,0,0,
9,5,0,0,0,9,6,0,0,0,9,
7,0,0,0,9,8,0,0,0,9,9,
0,0,0,9,10,0,0,0,9,11,0,
0,0,9,12,0,0,0,9,13,0,0,
0,9,14,0,0,0,9,15,0,0,0,
9,16,0,0,0,9,17,0,0,0,9,
18,0,0,0,9,19,0,0,0,9,20,
0,0,0,9,21,0,0,0,9,22,0,
0,0,9,23,0,0,0,9,24,0,0,
0,9,25,0,0,0,9,26,0,0,0,
9,27,0,0,0,9,28,0,0,0,9,
29,0,0,0,9,30,0,0,0,9,31,
0,0,0,9,32,0,0,0,16,3,0,
0,0,29,0,0,0,9,33,0,0,0,
9,34,0,0,0,9,35,0,0,0,9,
36,0,0,0,9,37,0,0,0,9,38,
0,0,0,9,39,0,0,0,9,40,0,
0,0,9,41,0,0,0,9,42,0,0,
0,9,43,0,0,0,9,44,0,0,0,
9,45,0,0,0,9,46,0,0,0,9,
47,0,0,0,9,48,0,0,0,9,49,
0,0,0,9,50,0,0,0,9,51,0,
0,0,9,52,0,0,0,9,53,0,0,
0,9,54,0,0,0,9,55,0,0,0,
9,56,0,0,0,9,57,0,0,0,9,
58,0,0,0,9,59,0,0,0,9,60,
0,0,0,9,61,0,0,0,4,4,0,
0,0,36,83,121,115,116,101,109,46,71,
108,111,98,97,108,105,122,97,116,105,111,
110,46,85,110,105,99,111,100,101,67,97,
116,101,103,111,114,121,1,0,0,0,7,
118,97,108,117,101,95,95,0,8,29,0,
0,0,1,5,0,0,0,4,0,0,0,
28,0,0,0,1,6,0,0,0,4,0,
0,0,27,0,0,0,1,7,0,0,0,
4,0,0,0,26,0,0,0,1,8,0,
0,0,4,0,0,0,25,0,0,0,1,
9,0,0,0,4,0,0,0,24,0,0,
0,1,10,0,0,0,4,0,0,0,23,
0,0,0,1,11,0,0,0,4,0,0,
0,22,0,0,0,1,12,0,0,0,4,
0,0,0,21,0,0,0,1,13,0,0,
0,4,0,0,0,20,0,0,0,1,14,
0,0,0,4,0,0,0,19,0,0,0,
1,15,0,0,0,4,0,0,0,18,0,
0,0,1,16,0,0,0,4,0,0,0,
17,0,0,0,1,17,0,0,0,4,0,
0,0,15,0,0,0,1,18,0,0,0,
4,0,0,0,14,0,0,0,1,19,0,
0,0,4,0,0,0,13,0,0,0,1,
20,0,0,0,4,0,0,0,12,0,0,
0,1,21,0,0,0,4,0,0,0,11,
0,0,0,1,22,0,0,0,4,0,0,
0,10,0,0,0,1,23,0,0,0,4,
0,0,0,9,0,0,0,1,24,0,0,
0,4,0,0,0,8,0,0,0,1,25,
0,0,0,4,0,0,0,7,0,0,0,
1,26,0,0,0,4,0,0,0,6,0,
0,0,1,27,0,0,0,4,0,0,0,
5,0,0,0,1,28,0,0,0,4,0,
0,0,4,0,0,0,1,29,0,0,0,
4,0,0,0,3,0,0,0,1,30,0,
0,0,4,0,0,0,2,0,0,0,1,
31,0,0,0,4,0,0,0,1,0,0,
0,1,32,0,0,0,4,0,0,0,0,
0,0,0,12,62,0,0,0,60,84,111,
111,108,115,44,32,86,101,114,115,105,111,
110,61,48,46,48,46,48,46,48,44,32,
67,117,108,116,117,114,101,61,110,101,117,
116,114,97,108,44,32,80,117,98,108,105,
99,75,101,121,84,111,107,101,110,61,110,
117,108,108,5,33,0,0,0,13,84,111,
111,108,115,46,67,104,97,114,115,101,116,
3,0,0,0,5,109,95,99,97,116,9,
109,95,103,101,110,101,114,105,99,7,109,
95,99,104,97,114,115,3,0,3,36,83,
121,115,116,101,109,46,71,108,111,98,97,
108,105,122,97,116,105,111,110,46,85,110,
105,99,111,100,101,67,97,116,101,103,111,
114,121,3,28,83,121,115,116,101,109,46,
67,111,108,108,101,99,116,105,111,110,115,
46,72,97,115,104,116,97,98,108,101,62,
0,0,0,1,193,255,255,255,4,0,0,
0,29,0,0,0,205,176,9,64,0,0,
0,1,34,0,0,0,33,0,0,0,1,
191,255,255,255,4,0,0,0,28,0,0,
0,194,166,9,66,0,0,0,1,35,0,
0,0,33,0,0,0,1,189,255,255,255,
4,0,0,0,27,0,0,0,94,9,68,
0,0,0,1,36,0,0,0,33,0,0,
0,1,187,255,255,255,4,0,0,0,26,
0,0,0,36,9,70,0,0,0,1,37,
0,0,0,33,0,0,0,1,185,255,255,
255,4,0,0,0,25,0,0,0,60,9,
72,0,0,0,1,38,0,0,0,33,0,
0,0,1,183,255,255,255,4,0,0,0,
24,0,0,0,33,9,74,0,0,0,1,
39,0,0,0,33,0,0,0,1,181,255,
255,255,4,0,0,0,23,0,0,0,194,
187,9,76,0,0,0,1,40,0,0,0,
33,0,0,0,1,179,255,255,255,4,0,
0,0,22,0,0,0,194,171,9,78,0,
0,0,1,41,0,0,0,33,0,0,0,
1,177,255,255,255,4,0,0,0,21,0,
0,0,93,9,80,0,0,0,1,42,0,
0,0,33,0,0,0,1,175,255,255,255,
4,0,0,0,20,0,0,0,91,9,82,
0,0,0,1,43,0,0,0,33,0,0,
0,1,173,255,255,255,4,0,0,0,19,
0,0,0,194,173,9,84,0,0,0,1,
44,0,0,0,33,0,0,0,1,171,255,
255,255,4,0,0,0,18,0,0,0,226,
128,191,9,86,0,0,0,1,45,0,0,
0,33,0,0,0,1,169,255,255,255,4,
0,0,0,17,0,0,0,238,128,128,9,
88,0,0,0,1,46,0,0,0,33,0,
0,0,1,167,255,255,255,4,0,0,0,
15,0,0,0,216,128,9,90,0,0,0,
1,47,0,0,0,33,0,0,0,1,165,
255,255,255,4,0,0,0,14,0,0,0,
1,9,92,0,0,0,1,48,0,0,0,
33,0,0,0,1,163,255,255,255,4,0,
0,0,13,0,0,0,226,128,169,9,94,
0,0,0,1,49,0,0,0,33,0,0,
0,1,161,255,255,255,4,0,0,0,12,
0,0,0,226,128,168,9,96,0,0,0,
1,50,0,0,0,33,0,0,0,1,159,
255,255,255,4,0,0,0,11,0,0,0,
194,160,9,98,0,0,0,1,51,0,0,
0,33,0,0,0,1,157,255,255,255,4,
0,0,0,10,0,0,0,194,178,9,100,
0,0,0,1,52,0,0,0,33,0,0,
0,1,155,255,255,255,4,0,0,0,9,
0,0,0,225,155,174,9,102,0,0,0,
1,53,0,0,0,33,0,0,0,1,153,
255,255,255,4,0,0,0,8,0,0,0,
48,9,104,0,0,0,1,54,0,0,0,
33,0,0,0,1,151,255,255,255,4,0,
0,0,7,0,0,0,210,136,9,106,0,
0,0,1,55,0,0,0,33,0,0,0,
1,149,255,255,255,4,0,0,0,6,0,
0,0,224,164,131,9,108,0,0,0,1,
56,0,0,0,33,0,0,0,1,147,255,
255,255,4,0,0,0,5,0,0,0,204,
128,9,110,0,0,0,1,57,0,0,0,
33,0,0,0,1,145,255,255,255,4,0,
0,0,4,0,0,0,198,187,9,112,0,
0,0,1,58,0,0,0,33,0,0,0,
1,143,255,255,255,4,0,0,0,3,0,
0,0,202,176,9,114,0,0,0,1,59,
0,0,0,33,0,0,0,1,141,255,255,
255,4,0,0,0,2,0,0,0,199,133,
9,116,0,0,0,1,60,0,0,0,33,
0,0,0,1,139,255,255,255,4,0,0,
0,1,0,0,0,97,9,118,0,0,0,
1,61,0,0,0,33,0,0,0,1,137,
255,255,255,4,0,0,0,0,0,0,0,
65,9,120,0,0,0,1,64,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,121,0,0,
0,9,122,0,0,0,1,66,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,123,0,0,
0,9,124,0,0,0,1,68,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,125,0,0,
0,9,126,0,0,0,1,70,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,127,0,0,
0,9,128,0,0,0,1,72,0,0,0,
1,0,0,0,236,81,56,63,3,0,0,
0,10,10,11,0,0,0,9,129,0,0,
0,9,130,0,0,0,1,74,0,0,0,
1,0,0,0,236,81,56,63,7,0,0,
0,10,10,11,0,0,0,9,131,0,0,
0,9,132,0,0,0,1,76,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,133,0,0,
0,9,134,0,0,0,1,78,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,135,0,0,
0,9,136,0,0,0,1,80,0,0,0,
1,0,0,0,236,81,56,63,2,0,0,
0,10,10,11,0,0,0,9,137,0,0,
0,9,138,0,0,0,1,82,0,0,0,
1,0,0,0,236,81,56,63,2,0,0,
0,10,10,11,0,0,0,9,139,0,0,
0,9,140,0,0,0,1,84,0,0,0,
1,0,0,0,236,81,56,63,4,0,0,
0,10,10,11,0,0,0,9,141,0,0,
0,9,142,0,0,0,1,86,0,0,0,
1,0,0,0,236,81,56,63,2,0,0,
0,10,10,11,0,0,0,9,143,0,0,
0,9,144,0,0,0,1,88,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,145,0,0,
0,9,146,0,0,0,1,90,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,147,0,0,
0,9,148,0,0,0,1,92,0,0,0,
1,0,0,0,236,81,56,63,7,0,0,
0,10,10,11,0,0,0,9,149,0,0,
0,9,150,0,0,0,1,94,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,151,0,0,
0,9,152,0,0,0,1,96,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,153,0,0,
0,9,154,0,0,0,1,98,0,0,0,
1,0,0,0,236,81,56,63,2,0,0,
0,10,10,11,0,0,0,9,155,0,0,
0,9,156,0,0,0,1,100,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,157,0,0,
0,9,158,0,0,0,1,102,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,159,0,0,
0,9,160,0,0,0,1,104,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,161,0,0,
0,9,162,0,0,0,1,106,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,163,0,0,
0,9,164,0,0,0,1,108,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,165,0,0,
0,9,166,0,0,0,1,110,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,167,0,0,
0,9,168,0,0,0,1,112,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,169,0,0,
0,9,170,0,0,0,1,114,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,171,0,0,
0,9,172,0,0,0,1,116,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,173,0,0,
0,9,174,0,0,0,1,118,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,175,0,0,
0,9,176,0,0,0,1,120,0,0,0,
1,0,0,0,236,81,56,63,1,0,0,
0,10,10,11,0,0,0,9,177,0,0,
0,9,178,0,0,0,16,121,0,0,0,
1,0,0,0,8,3,205,176,16,122,0,
0,0,1,0,0,0,8,1,1,16,123,
0,0,0,1,0,0,0,8,3,194,166,
16,124,0,0,0,1,0,0,0,8,1,
1,16,125,0,0,0,1,0,0,0,8,
3,94,16,126,0,0,0,1,0,0,0,
8,1,1,16,127,0,0,0,1,0,0,
0,8,3,36,16,128,0,0,0,1,0,
0,0,8,1,1,16,129,0,0,0,3,
0,0,0,8,3,60,8,3,61,8,3,
43,16,130,0,0,0,3,0,0,0,8,
1,1,8,1,1,8,1,1,16,131,0,
0,0,5,0,0,0,8,3,46,8,3,
47,8,3,44,8,3,42,8,3,33,16,
132,0,0,0,5,0,0,0,8,1,1,
8,1,1,8,1,1,8,1,1,8,1,
1,16,133,0,0,0,1,0,0,0,8,
3,194,187,16,134,0,0,0,1,0,0,
0,8,1,1,16,135,0,0,0,1,0,
0,0,8,3,194,171,16,136,0,0,0,
1,0,0,0,8,1,1,16,137,0,0,
0,2,0,0,0,8,3,93,8,3,41,
16,138,0,0,0,2,0,0,0,8,1,
1,8,1,1,16,139,0,0,0,2,0,
0,0,8,3,91,8,3,40,16,140,0,
0,0,2,0,0,0,8,1,1,8,1,
1,16,141,0,0,0,2,0,0,0,8,
3,45,8,3,194,173,16,142,0,0,0,
2,0,0,0,8,1,1,8,1,1,16,
143,0,0,0,2,0,0,0,8,3,226,
128,191,8,3,95,16,144,0,0,0,2,
0,0,0,8,1,1,8,1,1,16,145,
0,0,0,1,0,0,0,8,3,238,128,
128,16,146,0,0,0,1,0,0,0,8,
1,1,16,147,0,0,0,1,0,0,0,
8,3,216,128,16,148,0,0,0,1,0,
0,0,8,1,1,16,149,0,0,0,5,
0,0,0,8,3,1,8,3,13,8,3,
9,8,3,10,8,3,0,16,150,0,0,
0,5,0,0,0,8,1,1,8,1,1,
8,1,1,8,1,1,8,1,1,16,151,
0,0,0,1,0,0,0,8,3,226,128,
169,16,152,0,0,0,1,0,0,0,8,
1,1,16,153,0,0,0,1,0,0,0,
8,3,226,128,168,16,154,0,0,0,1,
0,0,0,8,1,1,16,155,0,0,0,
2,0,0,0,8,3,194,160,8,3,32,
16,156,0,0,0,2,0,0,0,8,1,
1,8,1,1,16,157,0,0,0,1,0,
0,0,8,3,194,178,16,158,0,0,0,
1,0,0,0,8,1,1,16,159,0,0,
0,1,0,0,0,8,3,225,155,174,16,
160,0,0,0,1,0,0,0,8,1,1,
16,161,0,0,0,1,0,0,0,8,3,
48,16,162,0,0,0,1,0,0,0,8,
1,1,16,163,0,0,0,1,0,0,0,
8,3,210,136,16,164,0,0,0,1,0,
0,0,8,1,1,16,165,0,0,0,1,
0,0,0,8,3,224,164,131,16,166,0,
0,0,1,0,0,0,8,1,1,16,167,
0,0,0,1,0,0,0,8,3,204,128,
16,168,0,0,0,1,0,0,0,8,1,
1,16,169,0,0,0,1,0,0,0,8,
3,198,187,16,170,0,0,0,1,0,0,
0,8,1,1,16,171,0,0,0,1,0,
0,0,8,3,202,176,16,172,0,0,0,
1,0,0,0,8,1,1,16,173,0,0,
0,1,0,0,0,8,3,199,133,16,174,
0,0,0,1,0,0,0,8,1,1,16,
175,0,0,0,1,0,0,0,8,3,97,
16,176,0,0,0,1,0,0,0,8,1,
1,16,177,0,0,0,1,0,0,0,8,
3,65,16,178,0,0,0,1,0,0,0,
8,1,1,11,0,1,0,0,0,255,255,
255,255,1,0,0,0,0,0,0,0,4,
1,0,0,0,36,83,121,115,116,101,109,
46,71,108,111,98,97,108,105,122,97,116,
105,111,110,46,85,110,105,99,111,100,101,
67,97,116,101,103,111,114,121,1,0,0,
0,7,118,97,108,117,101,95,95,0,8,
29,0,0,0,11,0,1,0,0,0,255,
255,255,255,1,0,0,0,0,0,0,0,
4,1,0,0,0,14,83,121,115,116,101,
109,46,66,111,111,108,101,97,110,1,0,
0,0,7,109,95,118,97,108,117,101,0,
1,0,11,0,1,0,0,0,255,255,255,
255,1,0,0,0,0,0,0,0,4,1,
0,0,0,28,83,121,115,116,101,109,46,
67,111,108,108,101,99,116,105,111,110,115,
46,72,97,115,104,116,97,98,108,101,7,
0,0,0,10,76,111,97,100,70,97,99,
116,111,114,7,86,101,114,115,105,111,110,
8,67,111,109,112,97,114,101,114,16,72,
97,115,104,67,111,100,101,80,114,111,118,
105,100,101,114,8,72,97,115,104,83,105,
122,101,4,75,101,121,115,6,86,97,108,
117,101,115,0,0,3,3,0,5,5,11,
8,28,83,121,115,116,101,109,46,67,111,
108,108,101,99,116,105,111,110,115,46,73,
67,111,109,112,97,114,101,114,36,83,121,
115,116,101,109,46,67,111,108,108,101,99,
116,105,111,110,115,46,73,72,97,115,104,
67,111,100,101,80,114,111,118,105,100,101,
114,8,236,81,56,63,1,0,0,0,10,
10,11,0,0,0,9,2,0,0,0,9,
3,0,0,0,16,2,0,0,0,1,0,
0,0,6,4,0,0,0,9,89,89,73,
78,73,84,73,65,76,16,3,0,0,0,
1,0,0,0,9,5,0,0,0,12,6,
0,0,0,60,84,111,111,108,115,44,32,
86,101,114,115,105,111,110,61,48,46,48,
46,48,46,48,44,32,67,117,108,116,117,
114,101,61,110,101,117,116,114,97,108,44,
32,80,117,98,108,105,99,75,101,121,84,
111,107,101,110,61,110,117,108,108,5,5,
0,0,0,9,84,111,111,108,115,46,68,
102,97,4,0,0,0,5,109,95,109,97,
112,9,109,95,97,99,116,105,111,110,115,
10,109,95,116,111,107,67,108,97,115,115,
7,109,95,115,116,97,116,101,3,4,1,
0,28,83,121,115,116,101,109,46,67,111,
108,108,101,99,116,105,111,110,115,46,72,
97,115,104,116,97,98,108,101,16,84,111,
111,108,115,46,68,102,97,43,65,99,116,
105,111,110,6,0,0,0,8,6,0,0,
0,9,7,0,0,0,10,6,8,0,0,
0,0,139,0,0,0,1,7,0,0,0,
1,0,0,0,236,81,56,63,20,0,0,
0,10,10,47,0,0,0,9,9,0,0,
0,9,10,0,0,0,16,9,0,0,0,
18,0,0,0,8,3,42,8,3,32,8,
3,199,133,8,3,44,8,3,61,8,3,
9,8,3,41,8,3,48,8,3,43,8,
3,65,8,3,13,8,3,97,8,3,45,
8,3,40,8,3,202,176,8,3,198,187,
8,3,10,8,3,47,16,10,0,0,0,
18,0,0,0,9,11,0,0,0,9,12,
0,0,0,9,13,0,0,0,9,14,0,
0,0,9,15,0,0,0,9,12,0,0,
0,9,17,0,0,0,9,18,0,0,0,
9,19,0,0,0,9,13,0,0,0,9,
12,0,0,0,9,13,0,0,0,9,23,
0,0,0,9,24,0,0,0,9,13,0,
0,0,9,13,0,0,0,9,12,0,0,
0,9,27,0,0,0,1,11,0,0,0,
5,0,0,0,9,28,0,0,0,9,29,
0,0,0,6,30,0,0,0,5,84,105,
109,101,115,158,1,0,0,1,12,0,0,
0,5,0,0,0,9,31,0,0,0,9,
32,0,0,0,9,8,0,0,0,225,2,
0,0,1,13,0,0,0,5,0,0,0,
9,34,0,0,0,9,35,0,0,0,6,
36,0,0,0,10,73,100,101,110,116,105,
102,105,101,114,27,3,0,0,1,14,0,
0,0,5,0,0,0,9,37,0,0,0,
9,38,0,0,0,6,39,0,0,0,5,
67,111,109,109,97,113,1,0,0,1,15,
0,0,0,5,0,0,0,9,40,0,0,
0,9,41,0,0,0,6,42,0,0,0,
6,69,113,117,97,108,115,145,0,0,0,
1,17,0,0,0,5,0,0,0,9,43,
0,0,0,9,44,0,0,0,6,45,0,
0,0,6,67,108,111,115,101,80,207,1,
0,0,1,18,0,0,0,5,0,0,0,
9,46,0,0,0,9,47,0,0,0,6,
48,0,0,0,17,73,110,116,101,103,101,
114,67,111,110,115,116,97,110,116,95,49,
78,2,0,0,1,19,0,0,0,5,0,
0,0,9,49,0,0,0,9,50,0,0,
0,6,51,0,0,0,4,80,108,117,115,
190,0,0,0,1,23,0,0,0,5,0,
0,0,9,52,0,0,0,9,53,0,0,
0,6,54,0,0,0,5,77,105,110,117,
115,42,2,0,0,1,24,0,0,0,5,
0,0,0,9,55,0,0,0,9,56,0,
0,0,6,57,0,0,0,5,79,112,101,
110,80,253,1,0,0,1,27,0,0,0,
5,0,0,0,9,58,0,0,0,9,59,
0,0,0,6,60,0,0,0,3,68,105,
118,236,0,0,0,1,28,0,0,0,1,
0,0,0,236,81,56,63,0,0,0,0,
10,10,11,0,0,0,9,61,0,0,0,
9,62,0,0,0,5,29,0,0,0,16,
84,111,111,108,115,46,68,102,97,43,65,
99,116,105,111,110,2,0,0,0,5,97,
95,97,99,116,6,97,95,110,101,120,116,
0,4,8,16,84,111,111,108,115,46,68,
102,97,43,65,99,116,105,111,110,6,0,
0,0,6,0,0,0,97,0,0,0,10,
1,31,0,0,0,1,0,0,0,236,81,
56,63,0,0,0,0,10,10,11,0,0,
0,9,63,0,0,0,9,64,0,0,0,
1,32,0,0,0,29,0,0,0,136,0,
0,0,10,1,34,0,0,0,1,0,0,
0,236,81,56,63,7,0,0,0,10,10,
11,0,0,0,9,65,0,0,0,9,66,
0,0,0,1,35,0,0,0,29,0,0,
0,49,0,0,0,10,1,37,0,0,0,
1,0,0,0,236,81,56,63,0,0,0,
0,10,10,11,0,0,0,9,67,0,0,
0,9,68,0,0,0,1,38,0,0,0,
29,0,0,0,107,0,0,0,10,1,40,
0,0,0,1,0,0,0,236,81,56,63,
0,0,0,0,10,10,11,0,0,0,9,
69,0,0,0,9,70,0,0,0,1,41,
0,0,0,29,0,0,0,117,0,0,0,
10,1,43,0,0,0,1,0,0,0,236,
81,56,63,0,0,0,0,10,10,11,0,
0,0,9,71,0,0,0,9,72,0,0,
0,1,44,0,0,0,29,0,0,0,87,
0,0,0,10,1,46,0,0,0,1,0,
0,0,236,81,56,63,2,0,0,0,10,
10,11,0,0,0,9,73,0,0,0,9,
74,0,0,0,1,47,0,0,0,29,0,
0,0,2,0,0,0,10,1,49,0,0,
0,1,0,0,0,236,81,56,63,0,0,
0,0,10,10,11,0,0,0,9,75,0,
0,0,9,76,0,0,0,1,50,0,0,
0,29,0,0,0,112,0,0,0,10,1,
52,0,0,0,1,0,0,0,236,81,56,
63,1,0,0,0,10,10,11,0,0,0,
9,77,0,0,0,9,78,0,0,0,1,
53,0,0,0,29,0,0,0,92,0,0,
0,10,1,55,0,0,0,1,0,0,0,
236,81,56,63,0,0,0,0,10,10,11,
0,0,0,9,79,0,0,0,9,80,0,
0,0,1,56,0,0,0,29,0,0,0,
82,0,0,0,10,1,58,0,0,0,1,
0,0,0,236,81,56,63,1,0,0,0,
10,10,11,0,0,0,9,81,0,0,0,
9,82,0,0,0,1,59,0,0,0,29,
0,0,0,102,0,0,0,10,16,61,0,
0,0,0,0,0,0,16,62,0,0,0,
0,0,0,0,16,63,0,0,0,0,0,
0,0,16,64,0,0,0,0,0,0,0,
16,65,0,0,0,7,0,0,0,8,3,
199,133,8,3,198,187,8,3,48,8,3,
202,176,8,3,95,8,3,97,8,3,65,
16,66,0,0,0,7,0,0,0,9,83,
0,0,0,9,83,0,0,0,9,84,0,
0,0,9,83,0,0,0,9,86,0,0,
0,9,83,0,0,0,9,83,0,0,0,
16,67,0,0,0,0,0,0,0,16,68,
0,0,0,0,0,0,0,16,69,0,0,
0,0,0,0,0,16,70,0,0,0,0,
0,0,0,16,71,0,0,0,0,0,0,
0,16,72,0,0,0,0,0,0,0,16,
73,0,0,0,2,0,0,0,8,3,46,
8,3,48,16,74,0,0,0,2,0,0,
0,9,88,0,0,0,9,18,0,0,0,
16,75,0,0,0,0,0,0,0,16,76,
0,0,0,0,0,0,0,16,77,0,0,
0,1,0,0,0,8,3,48,16,78,0,
0,0,1,0,0,0,9,18,0,0,0,
16,79,0,0,0,0,0,0,0,16,80,
0,0,0,0,0,0,0,16,81,0,0,
0,1,0,0,0,8,3,47,16,82,0,
0,0,1,0,0,0,9,90,0,0,0,
1,83,0,0,0,5,0,0,0,9,91,
0,0,0,9,92,0,0,0,6,93,0,
0,0,10,73,100,101,110,116,105,102,105,
101,114,125,3,0,0,1,84,0,0,0,
5,0,0,0,9,94,0,0,0,9,95,
0,0,0,6,96,0,0,0,10,73,100,
101,110,116,105,102,105,101,114,85,3,0,
0,1,86,0,0,0,5,0,0,0,9,
97,0,0,0,9,98,0,0,0,6,99,
0,0,0,10,73,100,101,110,116,105,102,
105,101,114,49,3,0,0,1,88,0,0,
0,5,0,0,0,9,100,0,0,0,10,
9,8,0,0,0,86,2,0,0,1,90,
0,0,0,5,0,0,0,9,102,0,0,
0,9,103,0,0,0,9,8,0,0,0,
245,0,0,0,1,91,0,0,0,1,0,
0,0,236,81,56,63,7,0,0,0,10,
10,11,0,0,0,9,105,0,0,0,9,
106,0,0,0,1,92,0,0,0,29,0,
0,0,49,0,0,0,10,1,94,0,0,
0,1,0,0,0,236,81,56,63,7,0,
0,0,10,10,11,0,0,0,9,107,0,
0,0,9,108,0,0,0,1,95,0,0,
0,29,0,0,0,49,0,0,0,10,1,
97,0,0,0,1,0,0,0,236,81,56,
63,7,0,0,0,10,10,11,0,0,0,
9,109,0,0,0,9,110,0,0,0,1,
98,0,0,0,29,0,0,0,49,0,0,
0,10,1,100,0,0,0,1,0,0,0,
236,81,56,63,1,0,0,0,10,10,11,
0,0,0,9,111,0,0,0,9,112,0,
0,0,1,102,0,0,0,1,0,0,0,
236,81,56,63,44,0,0,0,10,10,107,
0,0,0,9,113,0,0,0,9,114,0,
0,0,1,103,0,0,0,29,0,0,0,
122,0,0,0,10,16,105,0,0,0,7,
0,0,0,8,3,199,133,8,3,198,187,
8,3,48,8,3,202,176,8,3,95,8,
3,97,8,3,65,16,106,0,0,0,7,
0,0,0,9,83,0,0,0,9,83,0,
0,0,9,84,0,0,0,9,83,0,0,
0,9,86,0,0,0,9,83,0,0,0,
9,83,0,0,0,16,107,0,0,0,7,
0,0,0,8,3,199,133,8,3,198,187,
8,3,48,8,3,202,176,8,3,95,8,
3,97,8,3,65,16,108,0,0,0,7,
0,0,0,9,83,0,0,0,9,83,0,
0,0,9,84,0,0,0,9,83,0,0,
0,9,86,0,0,0,9,83,0,0,0,
9,83,0,0,0,16,109,0,0,0,7,
0,0,0,8,3,199,133,8,3,198,187,
8,3,48,8,3,202,176,8,3,95,8,
3,97,8,3,65,16,110,0,0,0,7,
0,0,0,9,83,0,0,0,9,83,0,
0,0,9,84,0,0,0,9,83,0,0,
0,9,86,0,0,0,9,83,0,0,0,
9,83,0,0,0,16,111,0,0,0,1,
0,0,0,8,3,48,16,112,0,0,0,
1,0,0,0,9,128,0,0,0,16,113,
0,0,0,41,0,0,0,8,3,226,128,
191,8,3,205,176,8,3,32,8,3,36,
8,3,216,128,8,3,40,8,3,42,8,
3,44,8,3,46,8,3,48,8,3,60,
8,3,194,171,8,3,194,173,8,3,202,
176,8,3,194,187,8,3,210,136,8,3,
225,155,174,8,3,94,8,3,226,128,168,
8,3,1,8,3,9,8,3,198,187,8,
3,204,128,8,3,238,128,128,8,3,224,
164,131,8,3,199,133,8,3,33,8,3,
41,8,3,43,8,3,45,8,3,47,8,
3,194,160,8,3,194,166,8,3,61,8,
3,65,8,3,194,178,8,3,91,8,3,
93,8,3,95,8,3,97,8,3,226,128,
169,16,114,0,0,0,41,0,0,0,9,
129,0,0,0,9,129,0,0,0,9,129,
0,0,0,9,129,0,0,0,9,129,0,
0,0,9,129,0,0,0,9,129,0,0,
0,9,129,0,0,0,9,129,0,0,0,
9,129,0,0,0,9,129,0,0,0,9,
129,0,0,0,9,129,0,0,0,9,129,
0,0,0,9,129,0,0,0,9,129,0,
0,0,9,129,0,0,0,9,129,0,0,
0,9,129,0,0,0,9,129,0,0,0,
9,129,0,0,0,9,129,0,0,0,9,
129,0,0,0,9,129,0,0,0,9,129,
0,0,0,9,129,0,0,0,9,129,0,
0,0,9,129,0,0,0,9,129,0,0,
0,9,129,0,0,0,9,129,0,0,0,
9,129,0,0,0,9,129,0,0,0,9,
129,0,0,0,9,129,0,0,0,9,129,
0,0,0,9,129,0,0,0,9,129,0,
0,0,9,129,0,0,0,9,129,0,0,
0,9,129,0,0,0,1,128,0,0,0,
5,0,0,0,9,130,0,0,0,9,131,
0,0,0,6,132,0,0,0,14,82,101,
97,108,67,111,110,115,116,97,110,116,95,
49,122,2,0,0,1,129,0,0,0,5,
0,0,0,9,133,0,0,0,9,134,0,
0,0,9,8,0,0,0,246,0,0,0,
1,130,0,0,0,1,0,0,0,236,81,
56,63,1,0,0,0,10,10,11,0,0,
0,9,136,0,0,0,9,137,0,0,0,
1,131,0,0,0,29,0,0,0,19,0,
0,0,10,1,133,0,0,0,1,0,0,
0,236,81,56,63,44,0,0,0,10,10,
107,0,0,0,9,138,0,0,0,9,139,
0,0,0,1,134,0,0,0,29,0,0,
0,122,0,0,0,10,16,136,0,0,0,
1,0,0,0,8,3,48,16,137,0,0,
0,1,0,0,0,9,128,0,0,0,16,
138,0,0,0,41,0,0,0,8,3,226,
128,191,8,3,205,176,8,3,32,8,3,
36,8,3,216,128,8,3,40,8,3,42,
8,3,44,8,3,46,8,3,48,8,3,
60,8,3,194,171,8,3,194,173,8,3,
202,176,8,3,194,187,8,3,210,136,8,
3,225,155,174,8,3,94,8,3,226,128,
168,8,3,1,8,3,9,8,3,198,187,
8,3,204,128,8,3,238,128,128,8,3,
224,164,131,8,3,199,133,8,3,33,8,
3,41,8,3,43,8,3,45,8,3,47,
8,3,194,160,8,3,194,166,8,3,61,
8,3,65,8,3,194,178,8,3,91,8,
3,93,8,3,95,8,3,97,8,3,226,
128,169,16,139,0,0,0,41,0,0,0,
9,129,0,0,0,9,129,0,0,0,9,
129,0,0,0,9,129,0,0,0,9,129,
0,0,0,9,129,0,0,0,9,129,0,
0,0,9,129,0,0,0,9,129,0,0,
0,9,129,0,0,0,9,129,0,0,0,
9,129,0,0,0,9,129,0,0,0,9,
129,0,0,0,9,129,0,0,0,9,129,
0,0,0,9,129,0,0,0,9,129,0,
0,0,9,129,0,0,0,9,129,0,0,
0,9,129,0,0,0,9,129,0,0,0,
9,129,0,0,0,9,129,0,0,0,9,
129,0,0,0,9,129,0,0,0,9,129,
0,0,0,9,129,0,0,0,9,129,0,
0,0,9,129,0,0,0,9,129,0,0,
0,9,129,0,0,0,9,129,0,0,0,
9,129,0,0,0,9,129,0,0,0,9,
129,0,0,0,9,129,0,0,0,9,129,
0,0,0,9,129,0,0,0,9,129,0,
0,0,9,129,0,0,0,11,0,1,0,
0,0,255,255,255,255,1,0,0,0,0,
0,0,0,4,1,0,0,0,28,83,121,
115,116,101,109,46,67,111,108,108,101,99,
116,105,111,110,115,46,72,97,115,104,116,
97,98,108,101,7,0,0,0,10,76,111,
97,100,70,97,99,116,111,114,7,86,101,
114,115,105,111,110,8,67,111,109,112,97,
114,101,114,16,72,97,115,104,67,111,100,
101,80,114,111,118,105,100,101,114,8,72,
97,115,104,83,105,122,101,4,75,101,121,
115,6,86,97,108,117,101,115,0,0,3,
3,0,5,5,11,8,28,83,121,115,116,
101,109,46,67,111,108,108,101,99,116,105,
111,110,115,46,73,67,111,109,112,97,114,
101,114,36,83,121,115,116,101,109,46,67,
111,108,108,101,99,116,105,111,110,115,46,
73,72,97,115,104,67,111,100,101,80,114,
111,118,105,100,101,114,8,236,81,56,63,
15,0,0,0,10,10,23,0,0,0,9,
2,0,0,0,9,3,0,0,0,16,2,
0,0,0,14,0,0,0,6,4,0,0,
0,6,67,108,111,115,101,80,6,5,0,
0,0,14,78,117,109,98,101,114,67,111,
110,115,116,97,110,116,6,6,0,0,0,
5,79,112,101,110,80,6,7,0,0,0,
6,69,113,117,97,108,115,6,8,0,0,
0,12,82,101,97,108,67,111,110,115,116,
97,110,116,6,9,0,0,0,5,67,111,
109,109,97,6,10,0,0,0,5,77,105,
110,117,115,6,11,0,0,0,3,68,105,
118,6,12,0,0,0,10,73,100,101,110,
116,105,102,105,101,114,6,13,0,0,0,
17,73,110,116,101,103,101,114,67,111,110,
115,116,97,110,116,95,49,6,14,0,0,
0,15,73,110,116,101,103,101,114,67,111,
110,115,116,97,110,116,6,15,0,0,0,
14,82,101,97,108,67,111,110,115,116,97,
110,116,95,49,6,16,0,0,0,5,84,
105,109,101,115,6,17,0,0,0,4,80,
108,117,115,16,3,0,0,0,14,0,0,
0,9,18,0,0,0,9,19,0,0,0,
9,20,0,0,0,9,21,0,0,0,9,
22,0,0,0,9,23,0,0,0,9,24,
0,0,0,9,25,0,0,0,9,26,0,
0,0,9,27,0,0,0,9,28,0,0,
0,9,29,0,0,0,9,30,0,0,0,
9,31,0,0,0,12,32,0,0,0,60,
84,111,111,108,115,44,32,86,101,114,115,
105,111,110,61,48,46,48,46,48,46,48,
44,32,67,117,108,116,117,114,101,61,110,
101,117,116,114,97,108,44,32,80,117,98,
108,105,99,75,101,121,84,111,107,101,110,
61,110,117,108,108,5,18,0,0,0,17,
84,111,111,108,115,46,84,111,107,67,108,
97,115,115,68,101,102,4,0,0,0,6,
109,95,110,97,109,101,10,109,95,114,101,
102,84,111,107,101,110,16,109,95,105,110,
105,116,105,97,108,105,115,97,116,105,111,
110,11,109,95,105,109,112,108,101,109,101,
110,116,1,1,1,1,32,0,0,0,9,
4,0,0,0,6,34,0,0,0,5,84,
79,75,69,78,6,35,0,0,0,0,9,
35,0,0,0,1,19,0,0,0,18,0,
0,0,9,5,0,0,0,9,34,0,0,
0,9,35,0,0,0,9,35,0,0,0,
1,20,0,0,0,18,0,0,0,9,6,
0,0,0,9,34,0,0,0,9,35,0,
0,0,9,35,0,0,0,1,21,0,0,
0,18,0,0,0,9,7,0,0,0,9,
34,0,0,0,9,35,0,0,0,9,35,
0,0,0,1,22,0,0,0,18,0,0,
0,9,8,0,0,0,6,46,0,0,0,
14,78,117,109,98,101,114,67,111,110,115,
116,97,110,116,9,35,0,0,0,9,35,
0,0,0,1,23,0,0,0,18,0,0,
0,9,9,0,0,0,9,34,0,0,0,
9,35,0,0,0,9,35,0,0,0,1,
24,0,0,0,18,0,0,0,9,10,0,
0,0,9,34,0,0,0,9,35,0,0,
0,9,35,0,0,0,1,25,0,0,0,
18,0,0,0,9,11,0,0,0,9,34,
0,0,0,9,35,0,0,0,9,35,0,
0,0,1,26,0,0,0,18,0,0,0,
9,12,0,0,0,9,34,0,0,0,9,
35,0,0,0,9,35,0,0,0,1,27,
0,0,0,18,0,0,0,9,13,0,0,
0,9,14,0,0,0,6,62,0,0,0,
32,32,32,123,118,97,108,117,101,32,61,
32,73,110,116,51,50,46,80,97,114,115,
101,40,121,121,116,101,120,116,41,59,125,
9,35,0,0,0,1,28,0,0,0,18,
0,0,0,9,14,0,0,0,6,65,0,
0,0,14,78,117,109,98,101,114,67,111,
110,115,116,97,110,116,9,35,0,0,0,
9,35,0,0,0,1,29,0,0,0,18,
0,0,0,9,15,0,0,0,9,8,0,
0,0,6,69,0,0,0,34,9,32,32,
123,118,97,108,117,101,32,61,32,68,111,
117,98,108,101,46,80,97,114,115,101,40,
121,121,116,101,120,116,41,59,125,9,35,
0,0,0,1,30,0,0,0,18,0,0,
0,9,16,0,0,0,9,34,0,0,0,
9,35,0,0,0,9,35,0,0,0,1,
31,0,0,0,18,0,0,0,9,17,0,
0,0,9,34,0,0,0,9,35,0,0,
0,9,35,0,0,0,11,0};
new Tfactory(this,"CloseP",new TCreator(CloseP_factory));
new Tfactory(this,"NumberConstant",new TCreator(NumberConstant_factory));
new Tfactory(this,"OpenP",new TCreator(OpenP_factory));
new Tfactory(this,"Equals",new TCreator(Equals_factory));
new Tfactory(this,"RealConstant",new TCreator(RealConstant_factory));
new Tfactory(this,"Comma",new TCreator(Comma_factory));
new Tfactory(this,"Minus",new TCreator(Minus_factory));
new Tfactory(this,"Div",new TCreator(Div_factory));
new Tfactory(this,"Identifier",new TCreator(Identifier_factory));
new Tfactory(this,"IntegerConstant_1",new TCreator(IntegerConstant_1_factory));
new Tfactory(this,"IntegerConstant",new TCreator(IntegerConstant_factory));
new Tfactory(this,"RealConstant_1",new TCreator(RealConstant_1_factory));
new Tfactory(this,"Times",new TCreator(Times_factory));
new Tfactory(this,"Plus",new TCreator(Plus_factory));
}
public static object CloseP_factory(Lexer yyl) { return new CloseP(yyl);}
public static object NumberConstant_factory(Lexer yyl) { return new NumberConstant(yyl);}
public static object OpenP_factory(Lexer yyl) { return new OpenP(yyl);}
public static object Equals_factory(Lexer yyl) { return new Equals(yyl);}
public static object RealConstant_factory(Lexer yyl) { return new RealConstant(yyl);}
public static object Comma_factory(Lexer yyl) { return new Comma(yyl);}
public static object Minus_factory(Lexer yyl) { return new Minus(yyl);}
public static object Div_factory(Lexer yyl) { return new Div(yyl);}
public static object Identifier_factory(Lexer yyl) { return new Identifier(yyl);}
public static object IntegerConstant_1_factory(Lexer yyl) { return new IntegerConstant_1(yyl);}
public static object IntegerConstant_factory(Lexer yyl) { return new IntegerConstant(yyl);}
public static object RealConstant_1_factory(Lexer yyl) { return new RealConstant_1(yyl);}
public static object Times_factory(Lexer yyl) { return new Times(yyl);}
public static object Plus_factory(Lexer yyl) { return new Plus(yyl);}
public override TOKEN OldAction(Lexer yym,string yytext, int action, ref bool reject) {
switch(action) {
case -1: break;
case 136: ;
break;
case 122: ;
break;
}
return null;
}}
public class tokens:Lexer {
public tokens():base(new yytokens(new ErrorHandler(false))) {}
public tokens(ErrorHandler eh):base(new yytokens(eh)) {}
public tokens(Tokens tks):base(tks){}
}
}
@@ -1,229 +0,0 @@
%parser BooleanExpressionTokens.lexer
%namespace BCG.Evaluator.BooleanExpression
%left OrOp AndOp XorOp
%right NotOp
%symbol BooleanProgram {
public Definitions definitions;
public BooleanExpressionEvaluator eval;
public BooleanProgram(BooleanExpression expressions) =>
eval = expressions.eval;
public BooleanProgram(Definitions definitions, BooleanExpression expressions) {
this.eval = expressions.eval;
this.definitions = definitions;
}
}
%symbol BooleanExpression {
public BooleanExpressionEvaluator eval;
}
%symbol SingleDef {
public string id;
public DefArgList args;
public BooleanExpressionEvaluator eval;
public SingleDef(string id, DefArgList args, BooleanExpression exp) {
this.id = id;
this.args = args;
this.eval = exp.eval;
}
}
%symbol Definitions {
public SingleDef def;
public Definitions next;
public Definitions(SingleDef def) =>
this.def = def;
public Definitions(SingleDef def, Definitions next) {
this.def = def;
this.next = next;
}
}
%symbol DefArgList {
public string arg;
public DefArgList rest;
public DefArgList(string arg) =>
this.arg = arg;
public DefArgList(string arg, DefArgList rest) {
this.arg = arg;
this.rest = rest;
}
}
%node SubExpression : BooleanExpression {
public SubExpression (BooleanExpression e) =>
eval = e.eval;
}
%node AndNode : BooleanExpression {
public AndNode (BooleanExpression left, BooleanExpression right) =>
eval = new BooleanExpressionEvaluator(
left.eval, right.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.and));
}
%node OrNode : BooleanExpression {
public OrNode (BooleanExpression left, BooleanExpression right) =>
eval = new BooleanExpressionEvaluator(
left.eval, right.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.or));
}
%node XorNode : BooleanExpression {
public XorNode (BooleanExpression left, BooleanExpression right) =>
eval = new BooleanExpressionEvaluator(
left.eval, right.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.xor));
}
%node NotNode : BooleanExpression {
public NotNode (BooleanExpression toperand) =>
eval = new BooleanExpressionEvaluator(
toperand.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.not));
}
%node EqualPredicate : BooleanExpression {
public EqualPredicate(Value left, Value right) =>
eval = new BooleanExpressionEvaluator(
left.eval, right.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.equal));
}
%node SmallerEqualPredicate : BooleanExpression {
public SmallerEqualPredicate(Value left, Value right) =>
eval = new BooleanExpressionEvaluator(
left.eval, right.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.smallerEqual));
}
%node GreaterEqualPredicate : BooleanExpression {
public GreaterEqualPredicate (Value left, Value right) =>
eval = new BooleanExpressionEvaluator(
left.eval, right.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.greaterEqual));
}
%node SmallerPredicate : BooleanExpression {
public SmallerPredicate (Value left, Value right) =>
eval = new BooleanExpressionEvaluator(
left.eval, right.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.smaller));
}
%node GreaterPredicate : BooleanExpression {
public GreaterPredicate (Value left, Value right) =>
eval = new BooleanExpressionEvaluator(
left.eval, right.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.greater));
}
%node DifferentPredicate : BooleanExpression {
public DifferentPredicate (Value left, Value right) =>
eval = new BooleanExpressionEvaluator(
left.eval, right.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.different));
}
%node MatchesPredicate : BooleanExpression {
public MatchesPredicate (Value left, Value right) =>
eval = new BooleanExpressionEvaluator(
left.eval, right.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.matches));
}
%node ValuePredicate : BooleanExpression {
public ValuePredicate(Value v) =>
eval = new BooleanExpressionEvaluator(
v.eval, new BCG.BooleanEval(BooleanExpressionEvaluator.booleanValue));
}
%symbol Value {
public BooleanExpressionValue eval;
}
%node ConstantValue : Value {
public ConstantValue (object tvalue) =>
eval = new BooleanExpressionConstant(tvalue);
}
%node IdentifierValue : Value {
public IdentifierValue (string tidentifier) =>
eval = new BooleanExpressionVariable(tidentifier);
}
%node FunctionValue: Value {
public FunctionValue (string tidentifier, ArgumentList args) =>
eval = new BooleanExpressionFunction(tidentifier,args == null ? null : args.args);
}
%symbol ArgumentList {
public System.Collections.ArrayList args = new System.Collections.ArrayList();
public ArgumentList(SingleArgument s) =>
args.Add(((Value) s.kids[0]).eval);
public ArgumentList(ArgumentList a1,SingleArgument s) {
if (a1 != null) {
args.AddRange(a1.args);
}
args.AddRange(new ArgumentList(s).args);
}
}
BooleanProgram : Definitions BooleanExpression %BooleanProgram($1,$2)
| BooleanExpression %BooleanProgram($1) ;
Definitions : SingleDef %Definitions($1)
| SingleDef Definitions %Definitions($1,$2) ;
SingleDef : Define Identifier OpenParenthesis DefArgList CloseParenthesis BeginDef BooleanExpression EndDef %SingleDef($2.yytext,$4,$7);
DefArgList: %DefArgList(null)
| Identifier %DefArgList($1.yytext)
| Identifier Comma DefArgList %DefArgList($1.yytext, $3 )
;
BooleanExpression : BooleanExpression OrOp BooleanExpression %OrNode($1,$3)
| BooleanExpression AndOp BooleanExpression %AndNode($1,$3)
| BooleanExpression XorOp BooleanExpression %XorNode($1,$3)
| NotOp BooleanExpression %NotNode($2)
| OpenParenthesis BooleanExpression CloseParenthesis %SubExpression ($2)
| Predicate
;
Predicate : Value EqualsOp Value %EqualPredicate ($1,$3)
| Value SmallerEqualOp Value %SmallerEqualPredicate ($1,$3)
| Value GreaterEqualOp Value %GreaterEqualPredicate ($1,$3)
| Value SmallerOp Value %SmallerPredicate ($1,$3)
| Value GreaterOp Value %GreaterPredicate ($1,$3)
| Value DifferentOp Value %DifferentPredicate ($1,$3)
| Value DifferentOp2 Value %DifferentPredicate ($1,$3)
| Value MatchesOp Value %MatchesPredicate ($1,$3)
| Value %ValuePredicate($1)
;
Value : Identifier %IdentifierValue($1.yytext)
| BooleanConstant %ConstantValue($1.value)
| NullConstant %ConstantValue($1.value)
| RealConstant %ConstantValue($1.value)
| StringConstant %ConstantValue($1.value)
| IntegerConstant %ConstantValue($1.value)
| DateTimeConstant %ConstantValue($1.value)
| FunctionCall
;
FunctionCall: Identifier:n OpenParenthesis ArgumentList:al CloseParenthesis %FunctionValue(n.yytext,al) ;
ArgumentList: %null
| SingleArgument %ArgumentList($1)
| ArgumentList Comma SingleArgument %ArgumentList($1,$3)
;
SingleArgument: Value
;
File diff suppressed because it is too large. Load diff
@@ -1,107 +0,0 @@
%lexer
%namespace BCG.Evaluator
// --------------------------------------------------------------------------------
// .CLR types
// --------------------------------------------------------------------------------
'Boolean' %TypeId
'Byte' %TypeId
'DateTime' %TypeId
'SByte' %TypeId
'Char' %TypeId
'Decimal' %TypeId
'Double' %TypeId
'Single' %TypeId
'Int32' %TypeId
'UInt32' %TypeId
'Int64' %TypeId
'UInt64' %TypeId
'Object' %TypeId
'Int16' %TypeId
'UInt16' %TypeId
'String' %TypeId
// -------------------------------------------------------------------------------
// Literal constants
//--------------------------------------------------------------------------------
%define TimeConstant [012]?{Digit}:[0-5]{Digit}:[0-5]{Digit}[ ]('AM'|'PM')
%define DateConstant ([1-9]|'10'|'11'|'12')\/([1-9]|([1-2][0-9])|'30'|'31')\/{Digit}{Digit}{Digit}*
%token Constant {
public object value;
}
%token BooleanConstant : Constant {}
%token NullConstant : Constant {}
%token IntegerConstant : Constant {}
%token RealConstant : Constant {}
%token StringConstant : Constant {
public void cleanUpString(object st) {
var s = (string)st;
s = s.Substring(1,s.Length-2);
s = s.Replace(@"\'","'");
value = s;
}
}
%token CSStringConstant : Constant {}
%token DateTimeConstant : Constant {}
\"([^\"\\]*|\\.)*\" %CSStringConstant {string s = yytext; value = s.Substring(1,s.Length-2);}
\'([^\'\\]*|\\.)*\' %StringConstant {cleanUpString(yytext);}
'true'|'false' %BooleanConstant {value = Boolean.Parse(yytext);}
'null' %NullConstant {value = DBNull.Value;}
-?{Digit}+ %IntegerConstant {value = Int32.Parse(yytext);}
-?{Digit}+\.{Digit}+ %RealConstant {value = Double.Parse(yytext);}
({DateConstant}([ ]{TimeConstant})?)|(({DateConstant}[ ])?{TimeConstant}) %DateTimeConstant {value = DateTime.Parse(yytext);}
// --------------------------------------------------------------------------------
// Relational Operators
// --------------------------------------------------------------------------------
'=' %EqualsOp
'<=' %SmallerEqualOp
'>=' %GreaterEqualOp
'<' %SmallerOp
'>' %GreaterOp
'<>' %DifferentOp
'!=' %DifferentOp2
'~=' %MatchesOp
// --------------------------------------------------------------------------------
// Logical operators
// --------------------------------------------------------------------------------
'or' %OrOp
'and' %AndOp
'not' %NotOp
'xor' %XorOp
// --------------------------------------------------------------------------------
// Definitions
// --------------------------------------------------------------------------------
'define' %Define
'{' %BeginDef
'}' %EndDef
// --------------------------------------------------------------------------------
// Identifiers
// --------------------------------------------------------------------------------
{Letter}({Letter}*{Digit}*_*\.*)* %Identifier
// --------------------------------------------------------------------------------
// Utility tokens
// --------------------------------------------------------------------------------
\( %OpenParenthesis
\) %CloseParenthesis
',' %Comma
'!' %Not
':' %MapsTo
'+' %Ascending
'-' %Descending
'/' %IsOfType
'[' %QuoteOpen
']' %QuoteClose
'\/\/'[^\n\r]* ;
[ \t\r\n] ;
File diff suppressed because it is too large. Load diff
@@ -1,54 +0,0 @@
%parser BooleanExpressionTokens.lexer
%namespace BCG.Evaluator.ColumnMapExpression
%symbol ColumnMapExpression {
public ColumnMapExpression (System.Collections.IDictionary tcolumns, bool tisInclusive)
{
columns = tcolumns;
isInclusive = tisInclusive;
}
public ColumnMapExpression (bool tisInclusive)
{
columns = new System.Collections.Hashtable();
isInclusive = tisInclusive;
}
public System.Collections.IDictionary columns;
public bool isInclusive;
}
%symbol AliasList {
public AliasList (string name, string newName, AliasList oldList)
{
columns = oldList.columns;
columns [name] = newName;
}
public AliasList (string name, string newName)
{
columns = new System.Collections.Hashtable();
columns [name] = newName;
}
public AliasList (string name)
{
columns = new System.Collections.Hashtable();
columns [name] = name;
}
public AliasList (string name, AliasList oldList)
{
columns = oldList.columns;
columns [name] = name;
}
public System.Collections.IDictionary columns;
}
ColumnMapExpression : Not AliasList:al %ColumnMapExpression(al.columns,false)
| Not %ColumnMapExpression(false)
| AliasList:al %ColumnMapExpression(al.columns,true)
;
AliasList : Identifier:old MapsTo Identifier:new %AliasList (old.yytext,new.yytext)
| Identifier:old MapsTo Identifier:new AliasList:rest %AliasList (old.yytext,new.yytext, rest)
| Identifier:c %AliasList (c.yytext)
| Identifier:c AliasList:rest %AliasList (c.yytext,rest)
;
@@ -1,603 +0,0 @@
using System;using Tools;
namespace BCG.Evaluator.ColumnMapExpression {
//%+ColumnMapExpression
[Serializable] public class ColumnMapExpression : SYMBOL{
public ColumnMapExpression (Parser yyp, System . Collections . IDictionary tcolumns , bool tisInclusive ):base(((syntax)yyp)){ columns = tcolumns ;
isInclusive = tisInclusive ;
}
public ColumnMapExpression (Parser yyp, bool tisInclusive ):base(((syntax)yyp)){ columns = new System . Collections . Hashtable ();
isInclusive = tisInclusive ;
}
public System . Collections . IDictionary columns ;
public bool isInclusive ;
public override string yyname() { return "ColumnMapExpression"; }
public ColumnMapExpression(Parser yyp):base(yyp){}}
//%+AliasList
[Serializable] public class AliasList : SYMBOL{
public AliasList (Parser yyp, string name , string newName , AliasList oldList ):base(((syntax)yyp)){ columns = oldList . columns ;
columns[ name ]= newName ;
}
public AliasList (Parser yyp, string name , string newName ):base(((syntax)yyp)){ columns = new System . Collections . Hashtable ();
columns[ name ]= newName ;
}
public AliasList (Parser yyp, string name ):base(((syntax)yyp)){ columns = new System . Collections . Hashtable ();
columns[ name ]= name ;
}
public AliasList (Parser yyp, string name , AliasList oldList ):base(((syntax)yyp)){ columns = oldList . columns ;
columns[ name ]= name ;
}
public System . Collections . IDictionary columns ;
public override string yyname() { return "AliasList"; }
public AliasList(Parser yyp):base(yyp){}}
[Serializable] public class ColumnMapExpression_1 : ColumnMapExpression {
public ColumnMapExpression_1(Parser yyq):base(yyq,
((AliasList)(yyq.StackAt(0).m_value))
.columns,false){}}
[Serializable] public class ColumnMapExpression_2 : ColumnMapExpression {
public ColumnMapExpression_2(Parser yyq):base(yyq,false){}}
[Serializable] public class ColumnMapExpression_3 : ColumnMapExpression {
public ColumnMapExpression_3(Parser yyq):base(yyq,
((AliasList)(yyq.StackAt(0).m_value))
.columns,true){}}
[Serializable] public class AliasList_1 : AliasList {
public AliasList_1(Parser yyq):base(yyq,
((Identifier)(yyq.StackAt(2).m_value))
.yytext,
((Identifier)(yyq.StackAt(0).m_value))
.yytext){}}
[Serializable] public class AliasList_2 : AliasList {
public AliasList_2(Parser yyq):base(yyq,
((Identifier)(yyq.StackAt(3).m_value))
.yytext,
((Identifier)(yyq.StackAt(1).m_value))
.yytext,
((AliasList)(yyq.StackAt(0).m_value))
){}}
[Serializable] public class AliasList_3 : AliasList {
public AliasList_3(Parser yyq):base(yyq,
((Identifier)(yyq.StackAt(0).m_value))
.yytext){}}
[Serializable] public class AliasList_4 : AliasList {
public AliasList_4(Parser yyq):base(yyq,
((Identifier)(yyq.StackAt(1).m_value))
.yytext,
((AliasList)(yyq.StackAt(0).m_value))
){}}
[Serializable] public class yysyntax: Symbols {
public override object Action(Parser yyq,SYMBOL yysym, int yyact) {
switch(yyact) {
case -1: break; //// keep compiler happy
} return null; }
public yysyntax():base() { arr = new byte[] {
0,1,0,0,0,255,255,255,255,1,
0,0,0,0,0,0,0,12,2,0,0,
0,60,84,111,111,108,115,44,32,86,101,
114,115,105,111,110,61,48,46,48,46,48,
46,48,44,32,67,117,108,116,117,114,101,
61,110,101,117,116,114,97,108,44,32,80,
117,98,108,105,99,75,101,121,84,111,107,
101,110,61,110,117,108,108,5,1,0,0,
0,13,84,111,111,108,115,46,67,83,121,
109,98,111,108,4,0,0,0,9,109,95,
115,121,109,116,121,112,101,8,109,95,100,
111,108,108,97,114,3,112,111,115,11,84,
79,75,69,78,43,109,95,115,116,114,4,
2,0,1,21,84,111,111,108,115,46,67,
83,121,109,98,111,108,43,83,121,109,84,
121,112,101,2,0,0,0,8,2,0,0,
0,5,253,255,255,255,21,84,111,111,108,
115,46,67,83,121,109,98,111,108,43,83,
121,109,84,121,112,101,1,0,0,0,7,
118,97,108,117,101,95,95,0,8,2,0,
0,0,2,0,0,0,10,0,0,0,0,
6,4,0,0,0,19,67,111,108,117,109,
110,77,97,112,69,120,112,114,101,115,115,
105,111,110,11,0,1,0,0,0,255,255,
255,255,1,0,0,0,0,0,0,0,12,
2,0,0,0,60,84,111,111,108,115,44,
32,86,101,114,115,105,111,110,61,48,46,
48,46,48,46,48,44,32,67,117,108,116,
117,114,101,61,110,101,117,116,114,97,108,
44,32,80,117,98,108,105,99,75,101,121,
84,111,107,101,110,61,110,117,108,108,5,
1,0,0,0,16,84,111,111,108,115,46,
80,97,114,115,101,83,116,97,116,101,3,
0,0,0,7,109,95,115,116,97,116,101,
17,109,95,97,99,99,101,115,115,105,110,
103,83,121,109,98,111,108,9,109,95,99,
104,97,110,103,101,100,0,4,0,8,13,
84,111,111,108,115,46,67,83,121,109,98,
111,108,2,0,0,0,1,2,0,0,0,
12,0,0,0,9,3,0,0,0,0,5,
3,0,0,0,13,84,111,111,108,115,46,
67,83,121,109,98,111,108,4,0,0,0,
9,109,95,115,121,109,116,121,112,101,8,
109,95,100,111,108,108,97,114,3,112,111,
115,11,84,79,75,69,78,43,109,95,115,
116,114,4,2,0,1,21,84,111,111,108,
115,46,67,83,121,109,98,111,108,43,83,
121,109,84,121,112,101,2,0,0,0,8,
2,0,0,0,5,252,255,255,255,21,84,
111,111,108,115,46,67,83,121,109,98,111,
108,43,83,121,109,84,121,112,101,1,0,
0,0,7,118,97,108,117,101,95,95,0,
8,2,0,0,0,2,0,0,0,10,0,
0,0,0,6,5,0,0,0,19,67,111,
108,117,109,110,77,97,112,69,120,112,114,
101,115,115,105,111,110,11,0,1,0,0,
0,255,255,255,255,1,0,0,0,0,0,
0,0,4,1,0,0,0,28,83,121,115,
116,101,109,46,67,111,108,108,101,99,116,
105,111,110,115,46,72,97,115,104,116,97,
98,108,101,7,0,0,0,10,76,111,97,
100,70,97,99,116,111,114,7,86,101,114,
115,105,111,110,8,67,111,109,112,97,114,
101,114,16,72,97,115,104,67,111,100,101,
80,114,111,118,105,100,101,114,8,72,97,
115,104,83,105,122,101,4,75,101,121,115,
6,86,97,108,117,101,115,0,0,3,3,
0,5,5,11,8,28,83,121,115,116,101,
109,46,67,111,108,108,101,99,116,105,111,
110,115,46,73,67,111,109,112,97,114,101,
114,36,83,121,115,116,101,109,46,67,111,
108,108,101,99,116,105,111,110,115,46,73,
72,97,115,104,67,111,100,101,80,114,111,
118,105,100,101,114,8,236,81,56,63,12,
0,0,0,10,10,23,0,0,0,9,2,
0,0,0,9,3,0,0,0,16,2,0,
0,0,11,0,0,0,8,8,13,0,0,
0,8,8,12,0,0,0,8,8,11,0,
0,0,8,8,9,0,0,0,8,8,8,
0,0,0,8,8,7,0,0,0,8,8,
5,0,0,0,8,8,4,0,0,0,8,
8,2,0,0,0,8,8,1,0,0,0,
8,8,0,0,0,0,16,3,0,0,0,
11,0,0,0,9,4,0,0,0,9,5,
0,0,0,9,6,0,0,0,9,7,0,
0,0,9,8,0,0,0,9,9,0,0,
0,9,10,0,0,0,9,11,0,0,0,
9,12,0,0,0,9,13,0,0,0,9,
14,0,0,0,12,15,0,0,0,60,84,
111,111,108,115,44,32,86,101,114,115,105,
111,110,61,48,46,48,46,48,46,48,44,
32,67,117,108,116,117,114,101,61,110,101,
117,116,114,97,108,44,32,80,117,98,108,
105,99,75,101,121,84,111,107,101,110,61,
110,117,108,108,5,4,0,0,0,16,84,
111,111,108,115,46,80,97,114,115,101,83,
116,97,116,101,3,0,0,0,7,109,95,
115,116,97,116,101,17,109,95,97,99,99,
101,115,115,105,110,103,83,121,109,98,111,
108,9,109,95,99,104,97,110,103,101,100,
0,4,0,8,9,84,111,111,108,115,46,
69,79,70,15,0,0,0,1,15,0,0,
0,13,0,0,0,9,16,0,0,0,0,
1,5,0,0,0,4,0,0,0,12,0,
0,0,9,17,0,0,0,0,1,6,0,
0,0,4,0,0,0,11,0,0,0,9,
18,0,0,0,0,1,7,0,0,0,4,
0,0,0,9,0,0,0,9,19,0,0,
0,0,1,8,0,0,0,4,0,0,0,
8,0,0,0,9,18,0,0,0,0,1,
9,0,0,0,4,0,0,0,7,0,0,
0,9,18,0,0,0,0,1,10,0,0,
0,4,0,0,0,5,0,0,0,9,21,
0,0,0,0,1,11,0,0,0,4,0,
0,0,4,0,0,0,9,22,0,0,0,
0,1,12,0,0,0,4,0,0,0,2,
0,0,0,9,18,0,0,0,0,1,13,
0,0,0,4,0,0,0,1,0,0,0,
9,21,0,0,0,0,1,14,0,0,0,
4,0,0,0,0,0,0,0,10,0,5,
16,0,0,0,9,84,111,111,108,115,46,
69,79,70,4,0,0,0,9,109,95,115,
121,109,116,121,112,101,8,109,95,100,111,
108,108,97,114,3,112,111,115,11,84,79,
75,69,78,43,109,95,115,116,114,4,2,
0,1,21,84,111,111,108,115,46,67,83,
121,109,98,111,108,43,83,121,109,84,121,
112,101,15,0,0,0,8,15,0,0,0,
5,231,255,255,255,21,84,111,111,108,115,
46,67,83,121,109,98,111,108,43,83,121,
109,84,121,112,101,1,0,0,0,7,118,
97,108,117,101,95,95,0,8,15,0,0,
0,6,0,0,0,10,0,0,0,0,6,
26,0,0,0,3,69,79,70,5,17,0,
0,0,13,84,111,111,108,115,46,67,83,
121,109,98,111,108,4,0,0,0,9,109,
95,115,121,109,116,121,112,101,8,109,95,
100,111,108,108,97,114,3,112,111,115,11,
84,79,75,69,78,43,109,95,115,116,114,
4,2,0,1,21,84,111,111,108,115,46,
67,83,121,109,98,111,108,43,83,121,109,
84,121,112,101,15,0,0,0,8,15,0,
0,0,1,229,255,255,255,231,255,255,255,
2,0,0,0,10,0,0,0,0,6,28,
0,0,0,19,67,111,108,117,109,110,77,
97,112,69,120,112,114,101,115,115,105,111,
110,1,18,0,0,0,17,0,0,0,1,
227,255,255,255,231,255,255,255,2,0,0,
0,10,0,0,0,0,6,30,0,0,0,
9,65,108,105,97,115,76,105,115,116,1,
19,0,0,0,17,0,0,0,1,225,255,
255,255,231,255,255,255,1,0,0,0,10,
0,0,0,0,6,32,0,0,0,3,78,
111,116,1,21,0,0,0,17,0,0,0,
1,223,255,255,255,231,255,255,255,1,0,
0,0,10,0,0,0,0,6,34,0,0,
0,10,73,100,101,110,116,105,102,105,101,
114,1,22,0,0,0,17,0,0,0,1,
221,255,255,255,231,255,255,255,1,0,0,
0,10,0,0,0,0,6,36,0,0,0,
6,77,97,112,115,84,111,11,0,1,0,
0,0,255,255,255,255,1,0,0,0,0,
0,0,0,4,1,0,0,0,28,83,121,
115,116,101,109,46,67,111,108,108,101,99,
116,105,111,110,115,46,72,97,115,104,116,
97,98,108,101,7,0,0,0,10,76,111,
97,100,70,97,99,116,111,114,7,86,101,
114,115,105,111,110,8,67,111,109,112,97,
114,101,114,16,72,97,115,104,67,111,100,
101,80,114,111,118,105,100,101,114,8,72,
97,115,104,83,105,122,101,4,75,101,121,
115,6,86,97,108,117,101,115,0,0,3,
3,0,5,5,11,8,28,83,121,115,116,
101,109,46,67,111,108,108,101,99,116,105,
111,110,115,46,73,67,111,109,112,97,114,
101,114,36,83,121,115,116,101,109,46,67,
111,108,108,101,99,116,105,111,110,115,46,
73,72,97,115,104,67,111,100,101,80,114,
111,118,105,100,101,114,8,236,81,56,63,
14,0,0,0,10,10,23,0,0,0,9,
2,0,0,0,9,3,0,0,0,16,2,
0,0,0,13,0,0,0,6,4,0,0,
0,6,77,97,112,115,84,111,6,5,0,
0,0,21,67,111,108,117,109,110,77,97,
112,69,120,112,114,101,115,115,105,111,110,
95,51,6,6,0,0,0,21,67,111,108,
117,109,110,77,97,112,69,120,112,114,101,
115,115,105,111,110,95,50,6,7,0,0,
0,3,69,79,70,6,8,0,0,0,11,
65,108,105,97,115,76,105,115,116,95,52,
6,9,0,0,0,11,65,108,105,97,115,
76,105,115,116,95,51,6,10,0,0,0,
10,73,100,101,110,116,105,102,105,101,114,
6,11,0,0,0,11,65,108,105,97,115,
76,105,115,116,95,50,6,12,0,0,0,
11,65,108,105,97,115,76,105,115,116,95,
49,6,13,0,0,0,9,65,108,105,97,
115,76,105,115,116,6,14,0,0,0,19,
67,111,108,117,109,110,77,97,112,69,120,
112,114,101,115,115,105,111,110,6,15,0,
0,0,3,78,111,116,6,16,0,0,0,
21,67,111,108,117,109,110,77,97,112,69,
120,112,114,101,115,115,105,111,110,95,49,
16,3,0,0,0,13,0,0,0,9,17,
0,0,0,9,18,0,0,0,9,19,0,
0,0,9,20,0,0,0,9,21,0,0,
0,9,22,0,0,0,9,23,0,0,0,
9,24,0,0,0,9,25,0,0,0,9,
26,0,0,0,9,27,0,0,0,9,28,
0,0,0,9,29,0,0,0,12,30,0,
0,0,60,84,111,111,108,115,44,32,86,
101,114,115,105,111,110,61,48,46,48,46,
48,46,48,44,32,67,117,108,116,117,114,
101,61,110,101,117,116,114,97,108,44,32,
80,117,98,108,105,99,75,101,121,84,111,
107,101,110,61,110,117,108,108,5,17,0,
0,0,17,84,111,111,108,115,46,80,97,
114,115,105,110,103,73,110,102,111,2,0,
0,0,9,109,95,115,121,109,78,97,109,
101,12,109,95,112,97,114,115,101,116,97,
98,108,101,1,3,28,83,121,115,116,101,
109,46,67,111,108,108,101,99,116,105,111,
110,115,46,72,97,115,104,116,97,98,108,
101,30,0,0,0,9,4,0,0,0,9,
32,0,0,0,1,18,0,0,0,17,0,
0,0,9,5,0,0,0,9,34,0,0,
0,1,19,0,0,0,17,0,0,0,9,
6,0,0,0,9,34,0,0,0,1,20,
0,0,0,17,0,0,0,9,7,0,0,
0,9,38,0,0,0,1,21,0,0,0,
17,0,0,0,9,8,0,0,0,9,40,
0,0,0,1,22,0,0,0,17,0,0,
0,9,9,0,0,0,9,40,0,0,0,
1,23,0,0,0,17,0,0,0,9,10,
0,0,0,9,44,0,0,0,1,24,0,
0,0,17,0,0,0,9,11,0,0,0,
9,40,0,0,0,1,25,0,0,0,17,
0,0,0,9,12,0,0,0,9,40,0,
0,0,1,26,0,0,0,17,0,0,0,
9,13,0,0,0,9,40,0,0,0,1,
27,0,0,0,17,0,0,0,9,14,0,
0,0,9,34,0,0,0,1,28,0,0,
0,17,0,0,0,9,15,0,0,0,9,
54,0,0,0,1,29,0,0,0,17,0,
0,0,9,16,0,0,0,9,34,0,0,
0,1,32,0,0,0,1,0,0,0,236,
81,56,63,1,0,0,0,10,10,11,0,
0,0,9,57,0,0,0,9,58,0,0,
0,1,34,0,0,0,1,0,0,0,236,
81,56,63,1,0,0,0,10,10,11,0,
0,0,9,59,0,0,0,9,60,0,0,
0,1,38,0,0,0,1,0,0,0,236,
81,56,63,7,0,0,0,10,10,11,0,
0,0,9,61,0,0,0,9,62,0,0,
0,1,40,0,0,0,1,0,0,0,236,
81,56,63,4,0,0,0,10,10,11,0,
0,0,9,63,0,0,0,9,64,0,0,
0,1,44,0,0,0,1,0,0,0,236,
81,56,63,5,0,0,0,10,10,11,0,
0,0,9,65,0,0,0,9,66,0,0,
0,1,54,0,0,0,1,0,0,0,236,
81,56,63,1,0,0,0,10,10,11,0,
0,0,9,67,0,0,0,9,68,0,0,
0,16,57,0,0,0,1,0,0,0,8,
8,1,0,0,0,16,58,0,0,0,1,
0,0,0,9,69,0,0,0,16,59,0,
0,0,1,0,0,0,8,8,0,0,0,
0,16,60,0,0,0,1,0,0,0,9,
70,0,0,0,16,61,0,0,0,7,0,
0,0,8,8,9,0,0,0,8,8,8,
0,0,0,8,8,7,0,0,0,8,8,
5,0,0,0,8,8,2,0,0,0,8,
8,1,0,0,0,8,8,11,0,0,0,
16,62,0,0,0,7,0,0,0,9,71,
0,0,0,9,72,0,0,0,9,73,0,
0,0,9,74,0,0,0,9,75,0,0,
0,9,76,0,0,0,9,77,0,0,0,
16,63,0,0,0,4,0,0,0,8,8,
9,0,0,0,8,8,5,0,0,0,8,
8,1,0,0,0,8,8,0,0,0,0,
16,64,0,0,0,4,0,0,0,9,78,
0,0,0,9,79,0,0,0,9,80,0,
0,0,9,81,0,0,0,16,65,0,0,
0,5,0,0,0,8,8,9,0,0,0,
8,8,5,0,0,0,8,8,4,0,0,
0,8,8,1,0,0,0,8,8,0,0,
0,0,16,66,0,0,0,5,0,0,0,
9,82,0,0,0,9,83,0,0,0,9,
84,0,0,0,9,85,0,0,0,9,86,
0,0,0,16,67,0,0,0,1,0,0,
0,8,8,0,0,0,0,16,68,0,0,
0,1,0,0,0,9,87,0,0,0,5,
69,0,0,0,17,84,111,111,108,115,46,
80,97,114,115,101,114,83,104,105,102,116,
2,0,0,0,6,109,95,110,101,120,116,
8,109,95,97,99,116,105,111,110,4,4,
16,84,111,111,108,115,46,80,97,114,115,
101,83,116,97,116,101,30,0,0,0,18,
84,111,111,108,115,46,80,97,114,115,101,
114,65,99,116,105,111,110,30,0,0,0,
30,0,0,0,9,88,0,0,0,10,1,
70,0,0,0,69,0,0,0,9,89,0,
0,0,10,5,71,0,0,0,18,84,111,
111,108,115,46,80,97,114,115,101,114,82,
101,100,117,99,101,3,0,0,0,7,109,
95,100,101,112,116,104,6,109,95,112,114,
111,100,8,109,95,97,99,116,105,111,110,
0,4,4,8,16,84,111,111,108,115,46,
80,114,111,100,117,99,116,105,111,110,30,
0,0,0,24,84,111,111,108,115,46,80,
97,114,115,101,114,83,105,109,112,108,101,
65,99,116,105,111,110,30,0,0,0,30,
0,0,0,1,0,0,0,9,90,0,0,
0,9,91,0,0,0,1,72,0,0,0,
71,0,0,0,1,0,0,0,9,92,0,
0,0,9,93,0,0,0,1,73,0,0,
0,71,0,0,0,4,0,0,0,9,94,
0,0,0,9,95,0,0,0,1,74,0,
0,0,71,0,0,0,3,0,0,0,9,
96,0,0,0,9,97,0,0,0,1,75,
0,0,0,71,0,0,0,2,0,0,0,
9,98,0,0,0,9,99,0,0,0,1,
76,0,0,0,71,0,0,0,1,0,0,
0,9,100,0,0,0,9,101,0,0,0,
1,77,0,0,0,71,0,0,0,2,0,
0,0,9,102,0,0,0,9,103,0,0,
0,1,78,0,0,0,69,0,0,0,9,
104,0,0,0,10,1,79,0,0,0,69,
0,0,0,9,105,0,0,0,10,1,80,
0,0,0,69,0,0,0,9,106,0,0,
0,10,1,81,0,0,0,69,0,0,0,
9,107,0,0,0,10,1,82,0,0,0,
69,0,0,0,9,108,0,0,0,10,1,
83,0,0,0,69,0,0,0,9,108,0,
0,0,10,1,84,0,0,0,69,0,0,
0,9,109,0,0,0,10,1,85,0,0,
0,69,0,0,0,9,108,0,0,0,10,
1,86,0,0,0,69,0,0,0,9,108,
0,0,0,10,1,87,0,0,0,69,0,
0,0,9,111,0,0,0,10,5,88,0,
0,0,16,84,111,111,108,115,46,80,97,
114,115,101,83,116,97,116,101,3,0,0,
0,7,109,95,115,116,97,116,101,17,109,
95,97,99,99,101,115,115,105,110,103,83,
121,109,98,111,108,9,109,95,99,104,97,
110,103,101,100,0,4,0,8,13,84,111,
111,108,115,46,67,83,121,109,98,111,108,
30,0,0,0,1,30,0,0,0,4,0,
0,0,9,112,0,0,0,0,1,89,0,
0,0,88,0,0,0,12,0,0,0,9,
113,0,0,0,0,5,90,0,0,0,16,
84,111,111,108,115,46,80,114,111,100,117,
99,116,105,111,110,1,0,0,0,5,109,
95,112,110,111,0,8,30,0,0,0,2,
0,0,0,5,91,0,0,0,24,84,111,
111,108,115,46,80,97,114,115,101,114,83,
105,109,112,108,101,65,99,116,105,111,110,
6,0,0,0,5,109,95,115,121,109,5,
109,95,108,101,110,9,109,95,115,121,109,
116,121,112,101,8,109,95,100,111,108,108,
97,114,3,112,111,115,11,84,79,75,69,
78,43,109,95,115,116,114,4,0,4,2,
0,1,13,84,111,111,108,115,46,67,83,
121,109,98,111,108,30,0,0,0,8,21,
84,111,111,108,115,46,67,83,121,109,98,
111,108,43,83,121,109,84,121,112,101,30,
0,0,0,8,30,0,0,0,9,114,0,
0,0,2,0,0,0,5,141,255,255,255,
21,84,111,111,108,115,46,67,83,121,109,
98,111,108,43,83,121,109,84,121,112,101,
1,0,0,0,7,118,97,108,117,101,95,
95,0,8,30,0,0,0,5,0,0,0,
10,235,4,0,0,6,116,0,0,0,20,
37,67,111,108,117,109,110,77,97,112,69,
120,112,114,101,115,115,105,111,110,1,92,
0,0,0,90,0,0,0,3,0,0,0,
1,93,0,0,0,91,0,0,0,9,117,
0,0,0,2,0,0,0,1,138,255,255,
255,141,255,255,255,5,0,0,0,10,52,
5,0,0,6,119,0,0,0,20,37,67,
111,108,117,109,110,77,97,112,69,120,112,
114,101,115,115,105,111,110,1,94,0,0,
0,90,0,0,0,5,0,0,0,1,95,
0,0,0,91,0,0,0,9,120,0,0,
0,5,0,0,0,1,135,255,255,255,141,
255,255,255,5,0,0,0,10,47,6,0,
0,6,122,0,0,0,10,37,65,108,105,
97,115,76,105,115,116,1,96,0,0,0,
90,0,0,0,4,0,0,0,1,97,0,
0,0,91,0,0,0,9,123,0,0,0,
4,0,0,0,1,132,255,255,255,141,255,
255,255,5,0,0,0,10,196,5,0,0,
6,125,0,0,0,10,37,65,108,105,97,
115,76,105,115,116,1,98,0,0,0,90,
0,0,0,7,0,0,0,1,99,0,0,
0,91,0,0,0,9,126,0,0,0,3,
0,0,0,1,129,255,255,255,141,255,255,
255,5,0,0,0,10,228,6,0,0,6,
128,0,0,0,10,37,65,108,105,97,115,
76,105,115,116,1,100,0,0,0,90,0,
0,0,6,0,0,0,1,101,0,0,0,
91,0,0,0,9,129,0,0,0,2,0,
0,0,1,126,255,255,255,141,255,255,255,
5,0,0,0,10,135,6,0,0,6,131,
0,0,0,10,37,65,108,105,97,115,76,
105,115,116,1,102,0,0,0,90,0,0,
0,1,0,0,0,1,103,0,0,0,91,
0,0,0,9,132,0,0,0,3,0,0,
0,1,123,255,255,255,141,255,255,255,5,
0,0,0,10,168,4,0,0,6,134,0,
0,0,20,37,67,111,108,117,109,110,77,
97,112,69,120,112,114,101,115,115,105,111,
110,1,104,0,0,0,88,0,0,0,11,
0,0,0,9,135,0,0,0,0,1,105,
0,0,0,88,0,0,0,7,0,0,0,
9,135,0,0,0,0,1,106,0,0,0,
88,0,0,0,2,0,0,0,9,135,0,
0,0,0,1,107,0,0,0,88,0,0,
0,8,0,0,0,9,135,0,0,0,0,
1,108,0,0,0,88,0,0,0,1,0,
0,0,9,136,0,0,0,0,1,109,0,
0,0,88,0,0,0,5,0,0,0,9,
136,0,0,0,0,1,111,0,0,0,88,
0,0,0,9,0,0,0,9,137,0,0,
0,0,5,112,0,0,0,13,84,111,111,
108,115,46,67,83,121,109,98,111,108,4,
0,0,0,9,109,95,115,121,109,116,121,
112,101,8,109,95,100,111,108,108,97,114,
3,112,111,115,11,84,79,75,69,78,43,
109,95,115,116,114,4,2,0,1,21,84,
111,111,108,115,46,67,83,121,109,98,111,
108,43,83,121,109,84,121,112,101,30,0,
0,0,8,30,0,0,0,1,118,255,255,
255,141,255,255,255,1,0,0,0,10,0,
0,0,0,9,4,0,0,0,1,113,0,
0,0,112,0,0,0,1,116,255,255,255,
141,255,255,255,2,0,0,0,10,0,0,
0,0,9,14,0,0,0,1,114,0,0,
0,112,0,0,0,1,114,255,255,255,141,
255,255,255,3,0,0,0,10,0,0,0,
0,9,6,0,0,0,1,117,0,0,0,
112,0,0,0,1,112,255,255,255,141,255,
255,255,3,0,0,0,10,0,0,0,0,
9,5,0,0,0,1,120,0,0,0,112,
0,0,0,1,110,255,255,255,141,255,255,
255,3,0,0,0,10,0,0,0,0,9,
11,0,0,0,1,123,0,0,0,112,0,
0,0,1,108,255,255,255,141,255,255,255,
3,0,0,0,10,0,0,0,0,9,12,
0,0,0,1,126,0,0,0,112,0,0,
0,1,106,255,255,255,141,255,255,255,3,
0,0,0,10,0,0,0,0,9,8,0,
0,0,1,129,0,0,0,112,0,0,0,
1,104,255,255,255,141,255,255,255,3,0,
0,0,10,0,0,0,0,9,9,0,0,
0,1,132,0,0,0,112,0,0,0,1,
102,255,255,255,141,255,255,255,3,0,0,
0,10,0,0,0,0,9,16,0,0,0,
1,135,0,0,0,112,0,0,0,1,100,
255,255,255,141,255,255,255,2,0,0,0,
10,0,0,0,0,9,13,0,0,0,1,
136,0,0,0,112,0,0,0,1,98,255,
255,255,141,255,255,255,1,0,0,0,10,
0,0,0,0,9,10,0,0,0,1,137,
0,0,0,112,0,0,0,1,96,255,255,
255,141,255,255,255,1,0,0,0,10,0,
0,0,0,9,15,0,0,0,11,0,1,
0,0,0,255,255,255,255,1,0,0,0,
0,0,0,0,4,1,0,0,0,28,83,
121,115,116,101,109,46,67,111,108,108,101,
99,116,105,111,110,115,46,72,97,115,104,
116,97,98,108,101,7,0,0,0,10,76,
111,97,100,70,97,99,116,111,114,7,86,
101,114,115,105,111,110,8,67,111,109,112,
97,114,101,114,16,72,97,115,104,67,111,
100,101,80,114,111,118,105,100,101,114,8,
72,97,115,104,83,105,122,101,4,75,101,
121,115,6,86,97,108,117,101,115,0,0,
3,3,0,5,5,11,8,28,83,121,115,
116,101,109,46,67,111,108,108,101,99,116,
105,111,110,115,46,73,67,111,109,112,97,
114,101,114,36,83,121,115,116,101,109,46,
67,111,108,108,101,99,116,105,111,110,115,
46,73,72,97,115,104,67,111,100,101,80,
114,111,118,105,100,101,114,8,236,81,56,
63,0,0,0,0,10,10,11,0,0,0,
9,2,0,0,0,9,3,0,0,0,16,
2,0,0,0,0,0,0,0,16,3,0,
0,0,0,0,0,0,11,0,1,0,0,
0,255,255,255,255,1,0,0,0,0,0,
0,0,4,1,0,0,0,14,83,121,115,
116,101,109,46,66,111,111,108,101,97,110,
1,0,0,0,7,109,95,118,97,108,117,
101,0,1,1,11,0};
new Sfactory(this,"ColumnMapExpression",new SCreator(ColumnMapExpression_factory));
new Sfactory(this,"ColumnMapExpression_1",new SCreator(ColumnMapExpression_1_factory));
new Sfactory(this,"ColumnMapExpression_3",new SCreator(ColumnMapExpression_3_factory));
new Sfactory(this,"ColumnMapExpression_2",new SCreator(ColumnMapExpression_2_factory));
new Sfactory(this,"AliasList_3",new SCreator(AliasList_3_factory));
new Sfactory(this,"AliasList_4",new SCreator(AliasList_4_factory));
new Sfactory(this,"AliasList_1",new SCreator(AliasList_1_factory));
new Sfactory(this,"AliasList_2",new SCreator(AliasList_2_factory));
new Sfactory(this,"AliasList",new SCreator(AliasList_factory));
new Sfactory(this,"error",new SCreator(error_factory));
}
public static object ColumnMapExpression_factory(Parser yyp) { return new ColumnMapExpression(yyp); }
public static object ColumnMapExpression_1_factory(Parser yyp) { return new ColumnMapExpression_1(yyp); }
public static object ColumnMapExpression_3_factory(Parser yyp) { return new ColumnMapExpression_3(yyp); }
public static object ColumnMapExpression_2_factory(Parser yyp) { return new ColumnMapExpression_2(yyp); }
public static object AliasList_3_factory(Parser yyp) { return new AliasList_3(yyp); }
public static object AliasList_4_factory(Parser yyp) { return new AliasList_4(yyp); }
public static object AliasList_1_factory(Parser yyp) { return new AliasList_1(yyp); }
public static object AliasList_2_factory(Parser yyp) { return new AliasList_2(yyp); }
public static object AliasList_factory(Parser yyp) { return new AliasList(yyp); }
public static object error_factory(Parser yyp) { return new error(yyp); }
}
public class syntax: Parser {
public syntax():base(new yysyntax(),new tokens()) {}
public syntax(Symbols syms):base(syms,new tokens()) {}
public syntax(Symbols syms,ErrorHandler erh):base(syms,new tokens(erh)) {}
}
}
@@ -1,5 +0,0 @@
# Generate CSharp lexers and parsers
```
# Run on Windows. Be sure to commit changes in generated files.
python tools\py\gen_cs_grammar.py --sources src\DataStreamSuite\DataStreamGrammar
```
@@ -1,15 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\client\spark_api\spark_api.csproj" />
<ProjectReference Include="..\..\client\spark_core\spark_core.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</Project>
@@ -1,11 +0,0 @@
using bts.utils;
using mbts.config;
using System;
BTSNativeMethods.provide_command_line(args, args.Length);
// Must initialize config before using log system
Console.WriteLine("Initializing config...");
Configuration.initialize();
bts.Log.Gen.info("Starting DataStreamPublisher...");
@@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
</Project>
@@ -1,3 +0,0 @@
using System;
Console.WriteLine("Starting DataStreamQueryAnalyzer...");
-76
View File
@@ -1,76 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStream", "DataStream\DataStream.csproj", "{049E6723-E859-4829-B9D9-4B47CEA3054D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamCore", "DataStreamCore\DataStreamCore.csproj", "{CF444FFC-2A15-44AE-9DEA-9E0E412AB281}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamPublisher", "DataStreamPublisher\DataStreamPublisher.csproj", "{4B5C4B20-6B37-48BD-A774-08932FA57E23}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamQueryAnalyzer", "DataStreamQueryAnalyzer\DataStreamQueryAnalyzer.csproj", "{A3F8AA9E-6AAA-40EC-9E1C-D4FA400F5147}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PubSub", "PubSub\PubSub.csproj", "{9C45C299-14C5-4F8B-903F-49849D89D1DC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PubSubServer", "PubSubServer\PubSubServer.csproj", "{0DBD814A-E17F-4836-8EEE-6E91B00C578F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BooleanExpressions", "BooleanExpressions\BooleanExpressions.csproj", "{EE53687E-BB62-45C6-A1B0-9B8F16B4E2C1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BooleanExpressionsInterpreter", "BooleanExpressionsInterpreter\BooleanExpressionsInterpreter.csproj", "{60269417-583C-43A1-8AD6-AE82B82A00D3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spark_core", "..\client\spark_core\spark_core.csproj", "{88E70136-91AE-4F56-B243-8F4642B46D6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spark_api", "..\client\spark_api\spark_api.csproj", "{52DD33DB-00F5-44BF-AE0F-5FC58FB2277E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{049E6723-E859-4829-B9D9-4B47CEA3054D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{049E6723-E859-4829-B9D9-4B47CEA3054D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{049E6723-E859-4829-B9D9-4B47CEA3054D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{049E6723-E859-4829-B9D9-4B47CEA3054D}.Release|Any CPU.Build.0 = Release|Any CPU
{CF444FFC-2A15-44AE-9DEA-9E0E412AB281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF444FFC-2A15-44AE-9DEA-9E0E412AB281}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF444FFC-2A15-44AE-9DEA-9E0E412AB281}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF444FFC-2A15-44AE-9DEA-9E0E412AB281}.Release|Any CPU.Build.0 = Release|Any CPU
{4B5C4B20-6B37-48BD-A774-08932FA57E23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B5C4B20-6B37-48BD-A774-08932FA57E23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B5C4B20-6B37-48BD-A774-08932FA57E23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B5C4B20-6B37-48BD-A774-08932FA57E23}.Release|Any CPU.Build.0 = Release|Any CPU
{A3F8AA9E-6AAA-40EC-9E1C-D4FA400F5147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3F8AA9E-6AAA-40EC-9E1C-D4FA400F5147}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3F8AA9E-6AAA-40EC-9E1C-D4FA400F5147}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3F8AA9E-6AAA-40EC-9E1C-D4FA400F5147}.Release|Any CPU.Build.0 = Release|Any CPU
{9C45C299-14C5-4F8B-903F-49849D89D1DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C45C299-14C5-4F8B-903F-49849D89D1DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C45C299-14C5-4F8B-903F-49849D89D1DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C45C299-14C5-4F8B-903F-49849D89D1DC}.Release|Any CPU.Build.0 = Release|Any CPU
{0DBD814A-E17F-4836-8EEE-6E91B00C578F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0DBD814A-E17F-4836-8EEE-6E91B00C578F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0DBD814A-E17F-4836-8EEE-6E91B00C578F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0DBD814A-E17F-4836-8EEE-6E91B00C578F}.Release|Any CPU.Build.0 = Release|Any CPU
{EE53687E-BB62-45C6-A1B0-9B8F16B4E2C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE53687E-BB62-45C6-A1B0-9B8F16B4E2C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE53687E-BB62-45C6-A1B0-9B8F16B4E2C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE53687E-BB62-45C6-A1B0-9B8F16B4E2C1}.Release|Any CPU.Build.0 = Release|Any CPU
{60269417-583C-43A1-8AD6-AE82B82A00D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60269417-583C-43A1-8AD6-AE82B82A00D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60269417-583C-43A1-8AD6-AE82B82A00D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60269417-583C-43A1-8AD6-AE82B82A00D3}.Release|Any CPU.Build.0 = Release|Any CPU
{88E70136-91AE-4F56-B243-8F4642B46D6A}.Debug|Any CPU.ActiveCfg = Debug|x64
{88E70136-91AE-4F56-B243-8F4642B46D6A}.Debug|Any CPU.Build.0 = Debug|x64
{88E70136-91AE-4F56-B243-8F4642B46D6A}.Release|Any CPU.ActiveCfg = Release|x64
{88E70136-91AE-4F56-B243-8F4642B46D6A}.Release|Any CPU.Build.0 = Release|x64
{52DD33DB-00F5-44BF-AE0F-5FC58FB2277E}.Debug|Any CPU.ActiveCfg = Debug|x64
{52DD33DB-00F5-44BF-AE0F-5FC58FB2277E}.Debug|Any CPU.Build.0 = Debug|x64
{52DD33DB-00F5-44BF-AE0F-5FC58FB2277E}.Release|Any CPU.ActiveCfg = Release|x64
{52DD33DB-00F5-44BF-AE0F-5FC58FB2277E}.Release|Any CPU.Build.0 = Release|x64
EndGlobalSection
EndGlobal
@@ -1,9 +0,0 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<DataStreamGrammarDir>$(SparkRoot)\src\DataStreamSuite\DataStreamGrammar</DataStreamGrammarDir>
</PropertyGroup>
</Project>
-8
View File
@@ -1,8 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -1,3 +0,0 @@
using System;
Console.WriteLine("Starting PubSubServer...");
@@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
-89
View File
@@ -1,89 +0,0 @@
<Project>
<PropertyGroup>
<ComputerSpecificConfig>..\tools\override\$(computername).props</ComputerSpecificConfig>
<SparkRoot>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..))</SparkRoot>
<SourceRoot>$([System.IO.Path]::GetFullPath($(SparkRoot)\src))</SourceRoot>
<DepotName>$([System.IO.Path]::GetFileName($([System.IO.Path]::GetFullPath($(SparkRoot)))))</DepotName>
<ErrorReport>None</ErrorReport>
<Prefer32Bit>False</Prefer32Bit>
<Deterministic>true</Deterministic>
<EnableDefaultContentItems>False</EnableDefaultContentItems>
<ShowMissingItemTypes>false</ShowMissingItemTypes>
<Configuration Condition="'$(configuration)'==''">Debug</Configuration>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<LangVersion>11</LangVersion>
</PropertyGroup>
<Choose>
<When Condition="'$(OS)' == 'Windows_NT'">
<PropertyGroup>
<Externals>$(SparkRoot)/externals/windows</Externals>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<Externals>$(SparkRoot)/externals/linux</Externals>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup Label="Output">
<BaseOutputPath>$(SparkRoot)\build\$(Configuration)</BaseOutputPath>
<OutputPath>$(BaseOutputPath)\bin</OutputPath>
<BaseIntermediateOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</IntermediateOutputPath>
<ProtoOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</ProtoOutputPath>
</PropertyGroup>
<Import
Project="$(ComputerSpecificConfig)"
Condition="Exists($(ComputerSpecificConfig))" />
<PropertyGroup Label="ProtoBuf">
<ProtocPluginBase>$(SparkRoot)\src\lib\api\service_compiler</ProtocPluginBase>
</PropertyGroup>
<Choose>
<When Condition="'$(OS)' == 'Windows_NT'">
<PropertyGroup Label="ProtoBuf">
<protoc>$(Externals)/bin/protoc.exe</protoc>
<ProtocPlugin>$(ProtocPluginBase)/plugin.cmd</ProtocPlugin>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Label="ProtoBuf">
<protoc>$(Externals)/bin/protoc</protoc>
<ProtocPlugin>$(ProtocPluginBase)/plugin.sh</ProtocPlugin>
</PropertyGroup>
</Otherwise>
</Choose>
<ItemDefinitionGroup>
<!--
Google automatically converts .proto filenames to TitleCase when
generating .cs files. Unless the .proto file is already in TitleCase
(against Google's recommended practice to use snake_case .proto files),
the 'CSName' must be overridden with the TitleCase formatting.
For example:
<ProtoService Include="foo_bar.proto" CSName="FooBar" />
-->
<Proto>
<OutDir>$(ProtoOutputPath)/</OutDir>
<CSName>%(FileName)</CSName>
</Proto>
<!--
Each .proto (service) input file produces 4 output files. For example,
'foo_bar.proto' produces:
* FooBar.cs
* foo_bar.client.pb.cs
* foo_bar.server.pb.cs
* foo_bar.immutable.pb.cs
-->
<ProtoService>
<OutDir>$(ProtoOutputPath)/</OutDir>
<CSName>%(FileName)</CSName>
</ProtoService>
</ItemDefinitionGroup>
</Project>
-110
View File
@@ -1,110 +0,0 @@
<Project>
<!--
Run this after GetAssemblyVersion because it happens after the Xaml compiler
and exists in both xaml and non-xaml projects. One of the (many) xaml compile
passes wipes out the additional compile includes that we add.
-->
<Target
Name="CompileProtos"
AfterTargets="GetAssemblyVersion"
Condition="'@(Proto)'!=''"
Inputs="$(protoc);
%(Proto.Identity);$(ProtocPluginBase)/plugin.py;
$(ProtocPluginBase)/templates/c#/immutable.pb.cs;"
Outputs="
%(Proto.OutDir)/%(Proto.CSName).cs;
%(Proto.OutDir)/%(Proto.FileName).immutable.pb.cs">
<MakeDir Directories="%(Proto.OutDir)" />
<Message
Importance="High"
Text="Generating Proto %(Proto.FileName)" />
<PropertyGroup>
<GenProtosCmd>$(protoc) %(Proto.FullPath)</GenProtosCmd>
<GenProtosCmd>$(GenProtosCmd) --error_format=msvs</GenProtosCmd>
<GenProtosCmd>$(GenProtosCmd) --proto_path=$(SourceRoot)</GenProtosCmd>
<GenProtosCmd>$(GenProtosCmd) --plugin=&quot;protoc-gen-spark-csharp=$(ProtocPlugin)&quot;</GenProtosCmd>
<GenProtosCmd>$(GenProtosCmd) --spark-csharp_out=lang=c#,templates=immutable.pb.cs,strip_out_path=1:%(Proto.OutDir)</GenProtosCmd>
<GenProtosCmd>$(GenProtosCmd) --csharp_out=%(Proto.OutDir)</GenProtosCmd>
</PropertyGroup>
<Exec Command="$(GenProtosCmd)" WorkingDirectory="%(Proto.RelativeDir)" />
<ItemGroup>
<Compile Include="%(Proto.OutDir)/%(Proto.CSName).cs" />
<Compile Include="%(Proto.OutDir)/%(Proto.FileName).immutable.pb.cs" />
</ItemGroup>
</Target>
<!--
Run this after GetAssemblyVersion because it happens after the Xaml compiler
and exists in both xaml and non-xaml projects. One of the (many) xaml compile
passes wipes out the additional compile includes that we add.
-->
<Target
Name="CompileProtoServices"
AfterTargets="GetAssemblyVersion"
Condition="'@(ProtoService)'!=''"
Inputs="$(protoc);
%(ProtoService.Identity);$(ProtocPluginBase)/plugin.py;
$(ProtocPluginBase)/templates/c#/client.pb.cs;
$(ProtocPluginBase)/templates/c#/server.pb.cs;
$(ProtocPluginBase)/templates/c#/immutable.pb.cs;"
Outputs="
%(ProtoService.OutDir)/%(ProtoService.CSName).cs;
%(ProtoService.OutDir)/%(ProtoService.FileName).client.pb.cs;
%(ProtoService.OutDir)/%(ProtoService.FileName).server.pb.cs;
%(ProtoService.OutDir)/%(ProtoService.FileName).immutable.pb.cs">
<MakeDir Directories="%(ProtoService.OutDir)" />
<Message
Importance="High"
Text="Generating ProtoService %(ProtoService.FileName)" />
<PropertyGroup>
<GenProtosCmd>$(protoc) %(ProtoService.FullPath)</GenProtosCmd>
<GenProtosCmd>$(GenProtosCmd) --error_format=msvs</GenProtosCmd>
<GenProtosCmd>$(GenProtosCmd) --proto_path=$(SourceRoot)</GenProtosCmd>
<GenProtosCmd>$(GenProtosCmd) --plugin=&quot;protoc-gen-service=$(ProtocPlugin)&quot;</GenProtosCmd>
<GenProtosCmd>$(GenProtosCmd) --service_out=lang=c#,strip_out_path=1:%(ProtoService.OutDir)</GenProtosCmd>
<GenProtosCmd>$(GenProtosCmd) --csharp_out=%(ProtoService.OutDir)</GenProtosCmd>
</PropertyGroup>
<Exec Command="$(GenProtosCmd)" WorkingDirectory="%(ProtoService.RelativeDir)" />
<ItemGroup>
<Compile Include="%(ProtoService.OutDir)/%(ProtoService.CSName).cs" />
<Compile Include="%(ProtoService.OutDir)/%(ProtoService.FileName).client.pb.cs" />
<Compile Include="%(ProtoService.OutDir)/%(ProtoService.FileName).server.pb.cs" />
<Compile Include="%(ProtoService.OutDir)/%(ProtoService.FileName).immutable.pb.cs" />
</ItemGroup>
</Target>
<Target Name="RemoveSystemRuntimeFromRefPack"
BeforeTargets="_HandlePackageFileConflicts"
Condition="'@(Reference -> WithMetadataValue('NugetPackageId', 'System.Runtime.Experimental'))' != ''">
<ItemGroup>
<Reference Remove="@(Reference)"
Condition="$([System.String]::Copy(%(Reference.Identity)).Contains('System.Runtime.dll')) and
'%(Reference.NuGetPackageId)' == 'Microsoft.NETCore.App.Ref'" />
</ItemGroup>
</Target>
<Target
Name="CleanProtos"
AfterTargets="Clean">
<Delete Files="%(Proto.OutDir)/%(Proto.CSName).cs" />
<Delete Files="%(Proto.OutDir)/%(Proto.FileName).client.pb.cs" />
<Delete Files="%(Proto.OutDir)/%(Proto.FileName).server.pb.cs" />
<Delete Files="%(Proto.OutDir)/%(Proto.FileName).immutable.pb.cs" />
<Delete Files="%(ProtoService.OutDir)/%(ProtoService.CSName).cs" />
<Delete Files="%(ProtoService.OutDir)/%(ProtoService.FileName).client.pb.cs" />
<Delete Files="%(ProtoService.OutDir)/%(ProtoService.FileName).server.pb.cs" />
<Delete Files="%(ProtoService.OutDir)/%(ProtoService.FileName).immutable.pb.cs" />
</Target>
<Target
Name="Test"
DependsOnTargets="Build"></Target>
</Project>
@@ -1,21 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Spark.Admin.WebApp", "src\Spark.Admin.WebApp.fsproj", "{C3143A6F-8D32-4F9E-84EE-B34AF3F3A862}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C3143A6F-8D32-4F9E-84EE-B34AF3F3A862}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3143A6F-8D32-4F9E-84EE-B34AF3F3A862}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3143A6F-8D32-4F9E-84EE-B34AF3F3A862}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3143A6F-8D32-4F9E-84EE-B34AF3F3A862}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
+55
View File
@@ -0,0 +1,55 @@
<Project>
<PropertyGroup>
<ComputerSpecificConfig>..\..\tools\override\$(computername).props</ComputerSpecificConfig>
<SparkRoot>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\..))</SparkRoot>
<SourceRoot>$([System.IO.Path]::GetFullPath($(SparkRoot)\src))</SourceRoot>
<Externals>$(SparkRoot)\externals\windows</Externals>
<DepotName>$([System.IO.Path]::GetFileName($([System.IO.Path]::GetFullPath($(SparkRoot)))))</DepotName>
<ErrorReport>None</ErrorReport>
<Prefer32Bit>False</Prefer32Bit>
<Deterministic>true</Deterministic>
<EnableDefaultContentItems>False</EnableDefaultContentItems>
<ShowMissingItemTypes>false</ShowMissingItemTypes>
<Configuration Condition="'$(configuration)'==''">Debug</Configuration>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<LangVersion>11</LangVersion>
</PropertyGroup>
<PropertyGroup Label="Output">
<BaseOutputPath>$(SparkRoot)\build\$(Configuration)</BaseOutputPath>
<OutputPath>$(BaseOutputPath)\bin</OutputPath>
<BaseIntermediateOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</IntermediateOutputPath>
<ProtoOutputPath>$(BaseOutputPath)\obj\$(MSBuildProjectName)</ProtoOutputPath>
<GenDir>$(BaseOutputPath)\gen\$(MSBuildProjectName)</GenDir>
</PropertyGroup>
<Import
Project="$(ComputerSpecificConfig)"
Condition="Exists($(ComputerSpecificConfig))" />
<PropertyGroup Label="ProtoBuf">
<ProtocPluginBase>$(SparkRoot)\src\lib\api\service_compiler</ProtocPluginBase>
<protoc>$(Externals)\bin\protoc.exe</protoc>
<protogen>$(Externals)\bin\protogen.exe</protogen>
</PropertyGroup>
<ItemDefinitionGroup>
<Proto2></Proto2>
<Proto3>
<OutBase>$(IntermediateOutputPath)\gen\%(relativedir)</OutBase>
<OutCS>%(OutBase)%(FileName).cs</OutCS>
<OutCSClient>%(OutBase)%(FileName).client.pb.cs</OutCSClient>
<OutCSServer>%(OutBase)%(FileName).server.pb.cs</OutCSServer>
<OutCSImmutable>%(OutBase)%(FileName).immutable.pb.cs</OutCSImmutable>
<CompileOptions></CompileOptions>
</Proto3>
<Proto3Excel>
<OutBase>$(IntermediateOutputPath)\gen\%(relativedir)</OutBase>
<OutCSExcel>%(OutBase)%(FileName).excel.pb.cs</OutCSExcel>
<CompileOptions></CompileOptions>
</Proto3Excel>
</ItemDefinitionGroup>
</Project>
+94
View File
@@ -0,0 +1,94 @@
<Project>
<Target
Name="CompileProto2"
Condition="'@(Proto2)'!=''"
Inputs="$(MSBuildProjectFile);$(protogen);%(Proto2.FullPath)"
Outputs="$(GenDir)\proto2\%(Proto2.filename).cs"
AfterTargets="PreBuildEvent">
<PropertyGroup>
<SourceRelativeFile>$([System.String]::Copy('%(proto2.fullpath)').Replace($(SourceRoot), ''))</SourceRelativeFile>
<SourceRelativeDir>$([System.IO.Path]::GetDirectoryName($(SourceRelativeFile)))</SourceRelativeDir>
<WorkingDirectory>$(GenDir)\proto2</WorkingDirectory>
</PropertyGroup>
<MakeDir Directories="$(WorkingDirectory)" />
<Copy
SourceFiles="%(Proto2.FullPath)"
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)" />
<ItemGroup>
<Compile Include="$(WorkingDirectory)\%(Proto2.filename).cs" />
</ItemGroup>
</Target>
<!--
Run this after GetAssemblyVersion because it happens after the Xaml compiler
and exists in both xaml and non-xaml projects. One of the (many) xaml compile
passes wipes out the additional compile includes that we add.
-->
<Target
Name="CompileProto3"
AfterTargets="GetAssemblyVersion"
Condition="'@(Proto3)'!=''"
Inputs="$(protoc);
%(Proto3.Identity);$(ProtocPluginBase)\plugin.py;
$(ProtocPluginBase)\templates\c#\client.pb.cs;
$(ProtocPluginBase)\templates\c#\server.pb.cs;
$(ProtocPluginBase)\templates\c#\immutable.pb.cs;"
Outputs="%(Proto3.OutCS);%(Proto3.OutCSServer);%(Proto3.OutCSClient);%(Proto3.OutCSImmutable)">
<MakeDir Directories="%(Proto3.OutBase)" />
<Message
Importance="High"
Text="Generating service %(Proto3.FileName)" />
<Exec Command="$(SparkRoot)\.venv\Scripts\activate.bat" />
<Exec Command="set PYTHONPATH=$(SparkRoot)\.venv\Scripts\python" />
<Exec
Command="
$(protoc) %* %(Proto3.FullPath) ^
--error_format=msvs ^
--proto_path=$(SourceRoot) ^
--plugin=&quot;protoc-gen-service=$(ProtocPluginBase)\plugin.cmd&quot; ^
--service_out=lang=c#,strip_out_path=1:%(Proto3.OutBase) ^
--csharp_out=%(CompileOptions)%(Proto3.OutBase)"
WorkingDirectory="%(relativedir)" />
<ItemGroup>
<Compile Include="%(Proto3.OutCS)" />
<Compile Include="%(Proto3.OutCSClient)" />
<Compile Include="%(Proto3.OutCSServer)" />
<Compile Include="%(Proto3.OutCSImmutable)" />
</ItemGroup>
</Target>
<Target Name="RemoveSystemRuntimeFromRefPack"
BeforeTargets="_HandlePackageFileConflicts"
Condition="'@(Reference -> WithMetadataValue('NugetPackageId', 'System.Runtime.Experimental'))' != ''">
<ItemGroup>
<Reference Remove="@(Reference)"
Condition="$([System.String]::Copy(%(Reference.Identity)).Contains('System.Runtime.dll')) and
'%(Reference.NuGetPackageId)' == 'Microsoft.NETCore.App.Ref'" />
</ItemGroup>
</Target>
<Target
Name="AfterClean"
AfterTargets="Clean">
<Delete Files="%(Proto3.OutCS)" />
<Delete Files="%(Proto3.OutCSClient)" />
<Delete Files="%(Proto3.OutCSServer)" />
<Delete Files="%(Proto3.OutCSImmutable)" />
<Delete Files="$(GenDir)\proto2\*" />
</Target>
<Target
Name="Test"
DependsOnTargets="Build"></Target>
</Project>
@@ -1,32 +0,0 @@
namespace Spark.Console {
using CommandLine;
using System;
using System.Collections.Generic;
public static class CommandParserEx {
public static TResult parse_and_run<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(
this Parser parser,
IEnumerable<string> args,
Func<T1, TResult> on_args1,
Func<T2, TResult> on_args2,
Func<T3, TResult> on_args3,
Func<T4, TResult> on_args4,
Func<T5, TResult> on_args5,
Func<T6, TResult> on_args6,
Func<T7, TResult> on_args7,
Func<T8, TResult> on_args8,
Func<IEnumerable<Error>, TResult> on_error) =>
parser.ParseArguments<T1, T2, T3, T4, T5, T6, T7, T8>(args)
.MapResult(
on_args1,
on_args2,
on_args3,
on_args4,
on_args5,
on_args6,
on_args7,
on_args8,
on_error);
}
}
@@ -1,24 +0,0 @@
namespace Spark.Console {
using bts;
using mbts.config;
using System;
using System.Linq;
class ConfigCommand {
public static int run(ConfigCommandOptions opts) {
Configuration.initialize(opts.sparkd);
var keys = opts.keys?.ToArray() ?? Array.Empty<string>();
var excluded_keys = opts.excluded_keys?.ToArray() ?? Array.Empty<string>();
return Configuration.run_config_query(
keys,
keys.Length,
excluded_keys,
excluded_keys.Length,
opts.all,
opts.list_keys,
opts.verbose);
}
}
}
@@ -1,30 +0,0 @@
namespace Spark.Console {
using CommandLine;
using System.Collections.Generic;
[Verb("config", HelpText = "Get config values")]
class ConfigCommandOptions {
[Option(
"query", MetaValue = "keys", HelpText = "Keys to query (supports regular expressions)")]
public IEnumerable<string>? keys { get; set; }
[Option(
"exclude",
MetaValue = "keys",
HelpText = "Keys to exclude from query (supports regular expressions)")]
public IEnumerable<string>? excluded_keys { get; set; }
[Option("all", HelpText = "Query all keys")]
public bool all { get; set; }
[Option("list-keys", HelpText = "List available keys")]
public bool list_keys { get; set; }
[Option("verbose", HelpText = "Show verbose output")]
public bool verbose { get; set; }
[Option("sparkd", MetaValue = "URL", HelpText = "The sparkd server")]
public string? sparkd { get; set; }
}
}
@@ -1,47 +0,0 @@
namespace Spark.Console {
using bts.api;
using bts.api.core;
using bts.md;
using System;
using System.Linq;
static class MBOCommand {
public static int run(MBOCommandOptions o) {
_dump_mbo(o.key, o.side);
return 0;
}
static void _dump_mbo(uint key, Side side) {
using var ctx = new ServiceContext();
var mbo = ctx.locate<MBOService>();
var data = mbo.get_orders_for_security(
new MBOSecurityQuery { SecurityId = key, PriceLevel = double.NaN });
Console.WriteLine($"Order data for {data.SecurityId}");
var price = 0.0;
var color = Console.ForegroundColor;
if (side == Side.Sell || side == Side.Undefined) {
Console.ForegroundColor = ConsoleColor.Red;
foreach (var e in data.Ask.Reverse()) {
if (e.Price != price) {
price = e.Price;
Console.WriteLine("================");
}
Console.WriteLine(e);
}
}
if (side == Side.Buy || side == Side.Undefined) {
Console.ForegroundColor = ConsoleColor.Blue;
foreach (var e in data.Bid) {
if (e.Price != price) {
price = e.Price;
Console.WriteLine("================");
}
Console.WriteLine(e);
}
}
Console.ForegroundColor = color;
}
}
}
@@ -1,14 +0,0 @@
namespace Spark.Console {
using bts.api;
using CommandLine;
[Verb("mbo", HelpText = "MBO diagnostic command")]
public class MBOCommandOptions {
[Option('k', "key", Required = true)]
public uint key { get; set; }
[Option('s', "side", Default = Side.Undefined)]
public Side side { get; set; }
}
}
@@ -1,17 +0,0 @@
namespace Spark.Console {
using CommandLine;
[Verb("order-stress", HelpText = "Create a bunch of orders")]
public class OrderStressOptions {
// Maybe options to create fewer orders or sleep
[Option('s', "sleep", HelpText = "Sleep ms between order submission", Default = 100)]
public int sleep { get; set; }
[Option('d', "depth", HelpText = "How many orders per side", Default = 10u)]
public uint depth { get; set; }
[Option('q', "quanityt", HelpText = "Order quantity", Default = 1u)]
public uint quantity { get; set; }
};
}
@@ -1,110 +0,0 @@
namespace Spark.Console {
using bts.api.core;
using bts.api.diagnostic;
using System;
using System.IO;
using System.Reflection;
using System.Reactive.Linq;
using Spark.Core;
using System.Threading;
static class ScriptCommand {
public static int run(ScriptCommandOptions o) {
if (o.server) {
_run_server();
return 0;
}
if (o.host is null) {
Console.WriteLine("Please specify host");
return 1;
}
if (!o.file.is_null_or_empty() && File.Exists(o.file)) {
_run_client(o.host, File.OpenRead(o.file));
return 0;
}
_run_client(o.host, Console.OpenStandardInput());
return 0;
}
static void _run_client(string qualifier, Stream stream) {
using var ctx = new ServiceContext();
ShellDiagnosticService diag = ctx.locate<ShellDiagnosticService>(qualifier);
var script_id = diag.create(null);
ShellScriptHost script = ctx.locate<ShellScriptHost>(script_id.Id);
try {
using var sub = script.subscribei_output().Subscribe(_script_output);
using var reader = new StreamReader(stream);
var status = ScriptResult.Complete;
for (var line = string.Empty; line != "#q"; line = prompt_input()) {
var result = script.run(new ScriptLines { Lines = { line } });
status = result.Res;
switch (status) {
case ScriptResult.Invalid:
Console.WriteLine($"Syntax error: '{result.Message}'");
break;
case ScriptResult.RunError:
Console.WriteLine($"Exception: {result.Message}");
break;
case ScriptResult.Complete:
if (!result.Message.is_null_or_empty()) {
Console.WriteLine(result.Message);
}
break;
}
}
string prompt_input() {
_write_prompt(status);
return reader.ReadLine() ??
throw new InvalidOperationException("Received null input");
}
} catch (Exception e) {
Console.WriteLine($"Done. {e.Message}");
} finally {
try {
script.dispose(null);
script.Dispose();
} catch (Exception) { }
}
}
static void _script_output(Update<ScriptLinesImmutable, int> update) {
foreach (var lines in update.added) {
foreach (var line in lines.Lines) {
Console.WriteLine(line);
}
}
}
static void _write_prompt(ScriptResult status) {
switch (status) {
case ScriptResult.Complete:
Console.Write(">>> ");
break;
case ScriptResult.Incomplete:
Console.Write("... ");
break;
case ScriptResult.Invalid:
Console.Write("?>> ");
break;
case ScriptResult.RunError:
Console.Write("!>> ");
break;
}
}
static void _run_server() {
// for debugging
using var ctx = new ServiceContext();
var stype = SparkReflectionHelper.find_type(
"bts.api.diagnostic.ShellDiagnosticsServiceServer");
var server = Activator.CreateInstance(stype, ctx);
while (true) {
Thread.Sleep(1000);
GC.KeepAlive(server);
}
}
}
}
@@ -1,15 +0,0 @@
namespace Spark.Console {
using CommandLine;
[Verb("script", HelpText = "Remote control for shell diagnostic host")]
public class ScriptCommandOptions {
[Option('s', "server", HelpText = "Run a script server for testing.")]
public bool server { get; set; }
[Option('h', "host", HelpText = "Connect to {host}")]
public string? host { get; set; }
[Option('f', "fromfile", HelpText = "Read commands from file instead of stdin")]
public string? file { get; set; }
}
}
@@ -1,16 +0,0 @@
namespace Spark.Console {
using bts;
using System;
using System.Reflection;
class SettingsCommand {
public static int run(SettingsCommandOptions _) {
var type = SparkReflectionHelper.find_type(
"bts.api.diagnostic.ShellDiagnosticsServiceServer");
var run = type.GetMethod("run", BindingFlags.Static | BindingFlags.Public);
Log.notnull(run).Invoke(null, Array.Empty<object>());
return 0;
}
}
}
@@ -1,6 +0,0 @@
namespace Spark.Console {
using CommandLine;
[Verb("settings", HelpText = "Copy workspaces around")]
class SettingsCommandOptions { }
}
@@ -1,95 +0,0 @@
namespace Spark.Console {
using bts.api.core;
using bts.test;
using Newtonsoft.Json;
using System;
using System.Linq;
using System.Threading;
class TailService {
static PrintFormat _format = PrintFormat.ToString;
static bool _timestamp = false;
enum PrintFormat {
ToString,
Json
}
public static int run(TailServiceOptions o) {
var split = o.method?.Split('.');
if (split?.Length != 2) {
Console.WriteLine("Try --method [ServiceName].[Method]");
return -1;
}
if (o.json) {
_format = PrintFormat.Json;
}
if (o.time) {
_timestamp = true;
}
_tail(split[0], split[1]);
return 0;
}
class SubscriptionLogger<T> : IObserver<T> {
public void OnCompleted() =>
ConsoleEx.WriteLine("Completed.", ConsoleColor.Yellow);
public void OnError(Exception error) =>
ConsoleEx.WriteLine($"Error. '{error}'", ConsoleColor.Red);
public void OnNext(T value) {
if (_timestamp) {
Console.Write(DateTime.Now.ToString("HH:mm:ss.fff"));
Console.Write(" ");
}
if (value is null) {
return;
}
switch (_format) {
case PrintFormat.Json:
dynamic dv = value;
var json = JsonConvert.SerializeObject(new { dv.added, dv.removed, dv.changed });
Console.WriteLine(json);
break;
case PrintFormat.ToString:
Console.WriteLine(value);
break;
}
}
}
static void _tail(string service_name, string method_name) {
var service_type = SparkReflectionHelper.find_service_type(service_name);
var subscribe_method = service_type.GetMethod("subscribei_" + method_name) ??
throw new InvalidOperationException();
using var ctx = new ServiceContext();
var locate = typeof(ServiceContext).GetMethod("locate")?.MakeGenericMethod(service_type) ??
throw new InvalidOperationException();
var service = locate.Invoke(ctx, new[] { string.Empty });
// Subscribe with null qualifier
object observable = subscribe_method.Invoke(service, new object?[] { null })
?? throw new InvalidOperationException();
Type update_type = observable.GetType().GetGenericArguments()
.First(arg => arg.Name.StartsWith("Update"));
Type observer_type = typeof(SubscriptionLogger<>).MakeGenericType(update_type);
var observer = Activator.CreateInstance(observer_type)
?? throw new InvalidOperationException(
$"Activator failed to instantiate observer of type '{observer_type}'");
var subscribe = observable.GetType().GetMethod("Subscribe", new[] { observer_type }) ??
throw new InvalidOperationException(
"Failed to find 'IObservable.Subscribe' method via reflection");
var dispose = subscribe.Invoke(observable, new[] { observer });
while (true) {
Thread.Sleep(1000);
}
}
}
}
@@ -1,21 +0,0 @@
namespace Spark.Console {
using CommandLine;
[Verb("tail", HelpText = "'console dsqa'")]
class TailServiceOptions {
[Option('m', "method", Required = true, HelpText = "'[ServiceName].[Method]' to call")]
public string? method { get; set; }
[Option('t', "time", HelpText = "Include timestamp")]
public bool time { get; set; }
[Option('p', "path", HelpText = "Path inside the row to use for display. Ex: 'Id' or 'Name' ")]
public string? path { get; set; }
[Option('a', "all", HelpText = "Include 'all' rows on every print")]
public bool all { get; set; }
[Option('j', "json", HelpText = "Format rows as json")]
public bool json { get; set; }
}
}
@@ -1,83 +0,0 @@
namespace Spark.Console {
using bts.test;
using mbts.config;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
static class TestCommand {
static readonly Lazy<TestEnumerator> _enumerator_backing = new(
() => new TestEnumerator("spark_test"));
static TestEnumerator _enumerator => _enumerator_backing.Value;
public static int run(TestCommandOptions o) {
if (o.type == TestType.Unit) {
// Skip loading any local config
Configuration.initialize_for_test();
} else {
Configuration.initialize(o.sparkd);
}
ConsoleEx.WriteLine(JsonConvert.SerializeObject(o), ConsoleColor.DarkGray);
if (o.list) {
_list_tests(o.type);
return 0;
}
if (o.tests is null) {
Console.WriteLine("Please specify test(s) to run");
return 1;
}
if (o.timeout == 0 && o.tests.TryGetSingle(out var test) && !o.self_contained) {
using var trr = new TestResultReceiver(true);
InProcessTestRunner.run_test_synchronously(
test, o.type, _enumerator, trr.get_reporter());
trr.print_summary();
if (trr.ResultCount == 0) {
ConsoleEx.Write("No ", ConsoleColor.Red);
ConsoleEx.Write(o.type.ToString(), ConsoleColor.Yellow);
ConsoleEx.WriteLine($" tests matched filter '{test}'", ConsoleColor.Red);
return -1;
}
return trr.ErrorCount;
}
if (o.tests.Any()) {
return _run_tests(o, _enumerator.match(o.type, o.tests));
}
return _run_tests(o, _enumerator.get_of_type(o.type));
}
static int _run_tests(TestCommandOptions o, IEnumerable<TestMethod> tests) {
var runner = new TestRunner();
// waits for all child processes to exit or time out
return runner.run_tests(tests, o.timeout, o.self_contained);
}
static void _list_tests(TestType test_type) {
Console.WriteLine("All tests: ");
foreach (var t in _enumerator.get_groups_of_type(test_type)) {
ConsoleEx.WriteLine(t.name, ConsoleColor.Green);
foreach (var test in t.methods) {
Console.Write($" {test.name}");
if (test.ignored) {
var reason = test.ignored_reason;
if (string.IsNullOrEmpty(reason)) {
ConsoleEx.Write(" (ignored)", ConsoleColor.Yellow);
continue;
}
ConsoleEx.Write($" (ignored: '{test.ignored_reason}')", ConsoleColor.Yellow);
}
Console.WriteLine();
}
}
}
}
}
@@ -1,28 +0,0 @@
namespace Spark.Console {
using bts.test;
using CommandLine;
using System.Collections.Generic;
[Verb("test", HelpText = "Run Tests")]
class TestCommandOptions {
[Option('t', "timeout", HelpText = "Timeout unit tets", Default = 0u)]
public uint timeout { get; set; }
[Option('l', "list", HelpText = "List tests")]
public bool list { get; set; }
[Option('i', "insular", HelpText = "Tests run sparkd and use their own config (if specified)")]
public bool self_contained { get; set; }
[Option("type", HelpText = "Run all tests of type [Unit|System|Shell]")]
public TestType type { get; set; }
[Value(1, MetaName = "Tests", HelpText = "Test list")]
public IEnumerable<string>? tests { get; set; }
[Option("sparkd", MetaValue = "URL", HelpText = "The sparkd server")]
public string? sparkd { get; set; }
}
}
@@ -1,128 +0,0 @@
namespace Spark.Console {
using bts.api;
using bts.api.admin;
using bts.api.core;
using bts.api.synthetic;
using bts.api.user;
using bts.metrics;
using System;
using System.Threading;
class TestService {
public static int run(TestServiceOptions o) {
if (o.synthetic) {
_synthetic_test();
}
if (o.user) {
_user_test();
}
if (o.admin) {
_admin_test();
}
if (o.latency) {
_latency_test();
}
if (o.market_data) {
_market_data();
}
return 0;
}
static void _market_data() {
using var ctx = new ServiceContext();
var md = ctx.locate<MarketDataService>();
md.subscribe_securities().Table().Subscribe(update => {
Console.WriteLine($"got {update.state.Count} securities");
});
while (true) {
Thread.Sleep(1000);
}
}
static void _synthetic_test() {
using var ctx = new ServiceContext();
var security = new Security {
Symbol = "ES",
Exchange = Venue.Bts,
Currency = "USD",
Synthetic = new SyntheticContract {
Name = "Synthetic1",
PriceCalc = SyntheticContract.Types.PriceCalc.Standard,
Legs = {
new ContractLeg {
Security = new Security {
Id = 2,
Symbol = "ES",
// ESH8
Future = new FutureContract {
ExpirationYear = 2018,
ExpirationMonth = 3,
ExpirationDay = 16
}
}
},
new ContractLeg {
Security = new Security {
Id = 5,
Symbol = "ES",
// ESU8
Future = new FutureContract {
ExpirationYear = 2018,
ExpirationMonth = 9,
ExpirationDay = 21
}
}
}
}
}
};
var service = ctx.locate<SyntheticSecurityService>();
try {
var result = service.create_synthetic(security);
if (result.Error == CreateResult.Types.Error.Ok) {
Console.WriteLine(result.Key);
}
} catch (ApiException e) {
Console.WriteLine(e.Message);
}
}
static void _user_test() {
var ctx = new ServiceContext();
var s = ctx.locate<AuthService>();
var resp = s.get_users(new GetUsersRequest());
Console.WriteLine("{0}", resp);
}
static void _admin_test() {
var ctx = new ServiceContext();
var s = ctx.locate<AdminService>();
using var d = s.subscribei_admin_data().Subscribe(Console.WriteLine);
while (true) {
Thread.Sleep(100);
}
}
static void _latency_test() {
var ctx = new ServiceContext();
var s = ctx.locate<ShellLatencyService>();
ulong sequence = 0;
var factor = TimeSpan.TicksPerMillisecond / 1000;
while (true) {
var sw = new System.Diagnostics.Stopwatch();
sw.Start();
var reply = s.ping(new BufferMessage() { Sequence = ++sequence });
sw.Stop();
Console.WriteLine(
$"{reply.Sequence} - {sw.ElapsedMilliseconds}ms -- {sw.ElapsedTicks / factor} us");
Thread.Sleep(1000);
}
}
}
}
@@ -1,21 +0,0 @@
namespace Spark.Console {
using CommandLine;
[Verb("test-service", HelpText = "Scratch space for testing services")]
public class TestServiceOptions {
[Option(nameof(synthetic))]
public bool synthetic { get; set; }
[Option(nameof(user))]
public bool user { get; set; }
[Option(nameof(admin))]
public bool admin { get; set; }
[Option(nameof(latency))]
public bool latency { get; set; }
[Option("md")]
public bool market_data { get; set; }
}
}
-45
View File
@@ -1,45 +0,0 @@
namespace Spark.Console {
using bts;
using bts.utils;
using System;
using CommandLine;
class Program {
static int Main(string[] args) {
// Initializing config is up to each individual command
// We call provide_command_line here in case config is first
// initialized from c++ instead of c#
BTSNativeMethods.provide_command_line(args, args.Length);
var parser = new Parser(ps => {
ps.CaseInsensitiveEnumValues = true;
ps.HelpWriter = Console.Out;
});
// Note: this can be made to infer the options type list from the list of delegates
return parser.parse_and_run<
ConfigCommandOptions,
ScriptCommandOptions,
TailServiceOptions,
TestServiceOptions,
SettingsCommandOptions,
TestCommandOptions,
OrderStressOptions,
MBOCommandOptions,
int
>(
BTS.remove_config_arg(args),
ConfigCommand.run,
ScriptCommand.run,
TailService.run,
TestService.run,
SettingsCommand.run,
TestCommand.run,
OrderStressCommand.run,
MBOCommand.run,
errors => 1);
}
}
}
@@ -1,37 +0,0 @@
namespace Spark.Console {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
static class SparkReflectionHelper {
static readonly Assembly _spark_api_assembly;
static readonly Assembly _spark_assembly;
static SparkReflectionHelper() {
_spark_assembly = load_assembly("Spark");
_spark_api_assembly = load_assembly("spark_api");
static Assembly load_assembly(string ass_name) =>
Assembly.Load(ass_name) ?? throw new InvalidOperationException(
$"Failed to load assembly '{ass_name}'");
}
static IEnumerable<Assembly> _assemblies {
get {
yield return _spark_assembly;
yield return _spark_api_assembly;
}
}
public static Type find_type(string name) =>
_assemblies.Select(a => a.GetType(name)).ExceptNull().FirstOrDefault() ??
throw new InvalidOperationException($"Failed to find type '{name}'");
public static Type find_service_type(string name) =>
_spark_api_assembly.GetExportedTypes()
.FirstOrDefault(t => t.Name == name) ??
throw new InvalidOperationException(
$"Failed to find service '{name}' in spark_api.dll");
}
}
@@ -148,7 +148,7 @@ namespace mbts.spark {
private static bool _direct_valid_driver(SecurityExpiration driver_exp) {
return driver_exp != null && /*driver_exp.expiration >= DateTime.Now.Date &&*/
(driver_exp.security_tuple.security_type == SecurityType.Future ||
driver_exp.security_tuple.security_type == SecurityType.Spot);
driver_exp.security_tuple.security_type == SecurityType.Stock);
}
// returns the driver sectup (it assumes all expirations of this option sectup
// are being driven by the same sectup)
@@ -202,4 +202,4 @@ namespace mbts.spark {
}
#endregion
}
}
}
@@ -123,10 +123,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.Items.Count}");
foreach (var u in vs_usage.Items) {
string option_name = u.OptionName;
string vs_name = u.VsName;
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;
int vs_key;
if (name_to_ids.TryGetValue(vs_name, out vs_key)) {
ulist.UsageList.Add(new VolSurfaceUsageEntry() {
@@ -32,7 +32,7 @@ namespace mbts.spark {
}
);
foreach (var sec_md in exp_secs) {
rv[sec_md.security.Id] = kv.Value;
rv.Add(sec_md.security.Id, kv.Value);
}
}
return rv;
@@ -12,7 +12,7 @@ namespace mbts.spark {
using Spark.Analytics.View;
using Spark.Core.Disposables;
using Spark.Core.Reactive;
using Spark.Core.Protobuf;
using System;
using System.Collections;
@@ -254,7 +254,7 @@ namespace mbts.spark.VolSurface {
var new_hash = cols_new.aggregate_hash();
var old_hash = _columns_model.models.aggregate_hash();
if (new_hash != old_hash) {
_columns_model.models.sync_with(cols_new, allow_duplicates: false);
CollectionHelper.sync_with_never_duplicate(_columns_model.models, cols_new);
RaisePropertyChanged("super_headers");
}
// Add/remove rows too
@@ -14,7 +14,7 @@ namespace mbts.spark {
class VolSurfaceAdvancedSettingsEditorVM : ViewModelBase {
readonly VolSurfaceAdvancedSettings _settings;
public VolSurfaceAdvancedSettingsEditorVM(VolSurfaceAdvancedSettings settings, string vs_name, Action<VolSurfaceAdvancedSettings> commit) {
public VolSurfaceAdvancedSettingsEditorVM(VolSurfaceAdvancedSettings settings, string vs_name) {
_settings = settings;
_settings.theo_handle_measure = VolSurfaceEnums.GeneralChangeMeasure.Absolute;
_settings.slide_handle_measure = VolSurfaceEnums.GeneralChangeMeasure.Percentage;
@@ -23,7 +23,7 @@ namespace mbts.spark {
if (_settings.precomputed_theo_handles == null)
_settings.precomputed_theo_handles = new List<double>();
vol_surface_name = vs_name;
this.commit = new DelegateCommand(() => request_commit?.Invoke(ProtobufSerializationHelper.clone(_settings)));
commit = new DelegateCommand(() => request_commit?.Invoke(ProtobufSerializationHelper.clone(_settings)));
}
public event Action<VolSurfaceAdvancedSettings> request_commit;
+18 -15
View File
@@ -121,21 +121,24 @@ namespace mbts.spark {
if (settings == null) {
return null;
}
// return new VolSurfaceAdvancedSettingsEditor {
// DataContext = new VolSurfaceAdvancedSettingsEditorVM(
// VolSurfaceUtilityFunctions.clone_proto(settings.advanced_settings),
// settings.core_settings.vol_surface_name,
// advanced_settings => {
// var current_settings = _get_volsurface_settings();
// if (current_settings == null) BTSMessageBox.Show("Error changing settings", "VS Settings", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error, true, true, true);
// else {
// current_settings.advanced_settings = advanced_settings;
// _model.set_candidate_settings(current_settings);
// }
// }
// )
// };
return null;
var vm = new VolSurfaceAdvancedSettingsEditorVM(
VolSurfaceUtilityFunctions.clone_proto(settings.advanced_settings),
settings.core_settings.vol_surface_name);
vm.request_commit += commit_advanced_settings;
return new VolSurfaceAdvancedSettingsEditor {
DataContext = vm
};
async void commit_advanced_settings(VolSurfaceAdvancedSettings value) {
var current_settings = await _get_volsurface_settings();
if (current_settings == null) {
BTSMessageBox.Show("Error changing settings", "VS Settings");
}
else {
current_settings.advanced_settings = value;
_model.set_candidate_settings(current_settings);
}
}
}
Window? mk_grid_settings_win() {
+1 -2
View File
@@ -162,8 +162,7 @@ namespace mbts.spark {
api_sec_exp.Exchange.to_venue(),
api_sec_exp.SecurityType.contract_case(),
api_sec_exp.Symbol,
api_sec_exp.HasExpiration ?
api_sec_exp.Expiration.date_time() : SecurityExpiration.empty.expiration);
api_sec_exp.Expiration.date_time());
public static SecurityExpiration to_sec_exp(this Security sec) =>
to_sec_exp(new SecurityImmutable(sec));
+12 -20
View File
@@ -6,7 +6,6 @@ using bts.collections;
using bts.utils;
using Spark.Core.Disposables;
using Spark.Core.Reactive;
using System;
using System.Collections.Generic;
@@ -27,7 +26,6 @@ namespace mbts.spark {
: this(bus, service, user.Value) { }
AdminModel(IBus bus, AdminService service, UserTuple user) {
var bootstraps = new DisposableBuilder();
this.user = user;
// accounts
on_accounts = service.subscribei_admin_data()
@@ -43,30 +41,24 @@ namespace mbts.spark {
.RefCount();
// users
on_users = Observable.Return(DictionaryHelper.wrap_value(user.id, user.name));
if (user.permissions == UserTuple.Permissions.Admin) {
all_user_tuples = bootstraps.emplace(
service.subscribei_admin_data()
.Select(u => u.all.FirstOrNull())
.Where(ad => ad.HasValue)
.Select(ad => ad.Value.Users
.Where(u => user.can_access_user_data(u.Id))
.Select(u => new UserTuple(u.Id, u.Name))
.ToDictionary(UserTuple.key_fn))
.Table(UserTuple.key_fn)
.Cache()
.ToObservable());
} else {
all_user_tuples = Observable.Return(
TableUpdate<UserTuple, uint>.mk_empty(UserTuple.key_fn).with_added(new[] { user }));
}
all_user_tuples = user.permissions == UserTuple.Permissions.Admin ?
service.subscribei_admin_data()
.Select(u => u.all.FirstOrNull())
.Where(ad => ad.HasValue)
.Select(ad => ad.Value.Users
.Where(u => user.can_access_user_data(u.Id))
.Select(u => new UserTuple(u.Id, u.Name))
.ToDictionary(UserTuple.key_fn))
.Table(UserTuple.key_fn)
.Cache() :
Observable.Return(TableUpdate<UserTuple, uint>.mk_empty(UserTuple.key_fn).with_added(new[] { user }));
_dispose = Disposable.Create(
all_user_tuples.Subscribe(t => bus.post(SparkTags.Users, t.state)),
on_accounts.Subscribe(map => {
_account_map = map;
var account_tuple_map = MappedDictionary.create(map, (id, name) => new AccountTuple(id, name));
bus.post(SparkTags.AccountsTag, account_tuple_map);
}),
bootstraps);
}));
bus.post(SparkTags.CurrentUser, user);
}
@@ -1,15 +1,10 @@
using bts;
using bts.api;
using bts.api.core;
using bts.collections;
using mbts.spark.utilities;
using mbts.ui.utility;
using mbts.utils;
using Spark.Core.Data;
using Spark.Core.Disposables;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -21,18 +16,11 @@ using System.Text.RegularExpressions;
using AlgoType = bts.api.orderman.CustomOrderDefinition.CustomOneofCase;
namespace mbts.spark {
class AlgoProviderFactory : IDisposable {
IDisposable _dispose;
class AlgoProviderFactory {
[ImportingConstructor]
public AlgoProviderFactory(
IAlgoStudioModel studio_model,
OrderFactory order_factory,
ISecurityMetadataStore sec_meta_store
) {
public AlgoProviderFactory(IAlgoStudioModel studio_model, DynamicOrderHelper dynamic_helper, ISecurityAuxiliaryDataModel security_auxiliary_model) {
var from_conf = config.Configuration.get<bts.config.AlgoTypeRuleSet>();
var disposables = new List<IDisposable>();
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.
@@ -50,18 +38,13 @@ namespace mbts.spark {
AlgoType.Tick,
AlgoType.Trigger,
AlgoType.QueueHolder)),
ImmutableHashSet.CreateRange(order_factory.dynamic_types()));
ImmutableHashSet.CreateRange(dynamic_helper.dynamic_types));
var rules = new[] {
// Glbx: Futures/Spreads
new SecurityAlgoTypeSetImmutable(
new SecurityCriteriaClause(
exchanges: new[] { Venue.Glbx },
security_types: new[] {
SecurityType.Spot,
SecurityType.Future,
SecurityType.Spread,
SecurityType.Option
}),
security_types: new[] { SecurityType.Future, SecurityType.Spread, SecurityType.Option }),
new AlgoTypeSetImmutable(
full_algo_set.factory_types.Except(new[] { AlgoType.Spreader }),
full_algo_set.dynamic_types)),
@@ -69,12 +52,7 @@ namespace mbts.spark {
new SecurityAlgoTypeSetImmutable(
new SecurityCriteriaClause(
exchanges: EnumHelper.get_values_except(Venue.Glbx, Venue.Unset).ToArray(),
security_types: new[] {
SecurityType.Spot,
SecurityType.Future,
SecurityType.Spread,
SecurityType.Option
}),
security_types: new[] { SecurityType.Future, SecurityType.Spread, SecurityType.Option }),
new AlgoTypeSetImmutable(
full_algo_set.factory_types.Except(new[] { AlgoType.Spreader, AlgoType.GlbxIceberg }),
full_algo_set.dynamic_types)),
@@ -122,35 +100,18 @@ namespace mbts.spark {
"\n\n\tAttachable\n" +
attachable_rules.fmt_diagnostic("\n\t\t"));
var security_algo_provider = new AlgoProvider(
rules, studio_model, order_factory, sec_meta_store);
var attachable_algo_provider = new AttachableAlgoProvider(
attachable_rules, studio_model, order_factory, sec_meta_store);
this.security_algo_provider = security_algo_provider;
this.attachable_algo_provider = attachable_algo_provider;
disposables.AddRange(security_algo_provider, attachable_algo_provider);
security_algo_provider = new AlgoProvider(rules, studio_model, dynamic_helper, security_auxiliary_model);
attachable_algo_provider = new AttachableAlgoProvider(attachable_rules, studio_model, dynamic_helper, security_auxiliary_model);
} else {
var algo_type_data =
EnumHelper.get_values_except(AlgoType.Dynamic, AlgoType.Composite, AlgoType.None)
.Select(t => _get_type_data(t))
.Concat(order_factory.dynamic_types().Select(dt => _get_type_data(AlgoType.Dynamic, dt)))
.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, order_factory, algo_type_data)).ToList();
var security_algo_provider = new AlgoProvider(
conf_sets.Select(tup => tup.standard).ToList(),
studio_model,
order_factory,
sec_meta_store);
var attachable_algo_provider = new AttachableAlgoProvider(
conf_sets.Select(tup => tup.attachable).ToList(),
studio_model,
order_factory,
sec_meta_store);
this.security_algo_provider = security_algo_provider;
this.attachable_algo_provider = attachable_algo_provider;
disposables.AddRange(security_algo_provider, attachable_algo_provider);
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);
}
_dispose = Disposable.Create(disposables);
}
[Export]
@@ -158,9 +119,6 @@ namespace mbts.spark {
[Export]
public IAttachableAlgoProvider attachable_algo_provider { get; }
public void Dispose() =>
Disposable.dispose(ref _dispose);
static (string name, AlgoType factory, string dynamic) _get_type_data(AlgoType type, string dynamic_type = null) {
string type_name = type.ToString();
return (type_name, type, dynamic_type ?? type_name);
@@ -170,42 +128,39 @@ namespace mbts.spark {
context == null ?
new SecurityCriteriaClause() :
new SecurityCriteriaClause(
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());
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());
static (SecurityAlgoTypeSetImmutable standard, SecurityAlgoTypeSetImmutable attachable) _to_security_algo_set(
bts.config.AlgoTypeRule rule,
OrderFactory order_factory,
DynamicOrderHelper dynamic_helper,
IEnumerable<(string name, AlgoType factory, string dynamic)> algo_type_data) {
//
var factory_types = ImmutableHashSet<AlgoType>.Empty.ToBuilder();
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.IsAttachable);
continue;
}
var dyn_desc = order_factory.dynamic_descriptor(a.Name);
if (dyn_desc is not null) {
on_dyn_match(dyn_desc.DynamicOrderType, a.IsAttachable);
continue;
}
foreach (var (name, factory, dynamic) in algo_type_data) {
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.IsAttachable);
break;
default:
on_sys_match(factory, a.IsAttachable);
break;
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);
} else {
foreach (var (name, factory, dynamic) in algo_type_data) {
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);
break;
default:
on_sys_match(factory, a.is_attachable);
break;
}
}
}
}
@@ -213,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())));
+4 -5
View File
@@ -80,7 +80,7 @@ namespace mbts.spark {
public static IEnumerable<AlgoData> define_algos(
this AlgoTypeSetImmutable algo_set,
Func<string, CustomOrderDefinitionImmutable> dynamic_order_factory,
DynamicOrderHelper dynamic_helper,
Func<CustomOrderDefinitionImmutable, CustomOrderDefinitionImmutable> fit_to_type = null,
double display_qty_divisor = 1) =>
//
@@ -101,13 +101,13 @@ namespace mbts.spark {
}
return def;
})
.Concat(algo_set.dynamic_types.Select(dynamic_order_factory))
.Concat(algo_set.dynamic_types.Select(dynamic_helper.create_custom_defi))
.Select(AlgoData.from_custom_def);
public static ImmutableDictionary<AlgoKey, AlgoData> match_algos(
this IEnumerable<SecurityAlgoTypeSetImmutable> security_algo_sets,
SecurityCriteriaClause clause,
Func<string, CustomOrderDefinitionImmutable> dynamic_order_factory,
DynamicOrderHelper dynamic_helper,
Func<CustomOrderDefinitionImmutable, CustomOrderDefinitionImmutable> fit_to_type = null,
double display_qty_divisor = 1) {
//
@@ -117,8 +117,7 @@ namespace mbts.spark {
continue;
} else if (rv == null) {
rv = ImmutableDictionary.CreateRange(
set.algo_type_set.define_algos(
dynamic_order_factory, fit_to_type, display_qty_divisor)
set.algo_type_set.define_algos(dynamic_helper, fit_to_type, display_qty_divisor)
.Select(a => new KeyValuePair<AlgoKey, AlgoData>(a.key, a)));
} else {
foreach (var kv in rv) {
+14 -36
View File
@@ -8,13 +8,6 @@ using mbts.spark.utilities;
using mbts.ui.utility;
using mbts.utils;
using Spark.Api.Orders;
using Spark.Core;
using Spark.Core.Data;
using Spark.Core.Disposables;
using Spark.Core.Reactive;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -34,28 +27,23 @@ namespace mbts.spark {
// from the standard one wrt MEF export/import.
interface IAttachableAlgoProvider : IAlgoProvider { }
class AlgoProvider : IAlgoProvider, IDisposable {
class AlgoProvider : IAlgoProvider {
readonly IEnumerable<SecurityAlgoTypeSetImmutable> _security_algo_types;
readonly IAlgoStudioModel _studio_model;
readonly ISecurityAuxiliaryDataModel _security_auxiliary_model;
readonly IObservable<TableUpdate<AlgoData, AlgoKey>> _studio_algos_source;
readonly OrderFactory _order_factory;
readonly ISecurityMetadataStore _sec_meta_store;
readonly DynamicOrderHelper _dynamic_helper;
readonly AlgoTypeSetImmutable _full_set;
IDisposable _dispose;
public AlgoProvider(
IEnumerable<SecurityAlgoTypeSetImmutable> algo_sets,
IAlgoStudioModel studio_model,
OrderFactory order_factory,
ISecurityMetadataStore sec_meta_store) {
public AlgoProvider(IEnumerable<SecurityAlgoTypeSetImmutable> algo_sets, IAlgoStudioModel studio_model, DynamicOrderHelper dynamic_helper, ISecurityAuxiliaryDataModel security_auxiliary_model) {
_security_algo_types = algo_sets;
_studio_model = studio_model;
_order_factory = order_factory;
_dynamic_helper = dynamic_helper;
_full_set = new AlgoTypeSetImmutable(
ImmutableHashSet.CreateRange(
EnumHelper.get_values_except(CustomOrderDefinition.CustomOneofCase.None, CustomOrderDefinition.CustomOneofCase.Dynamic, CustomOrderDefinition.CustomOneofCase.Composite)),
ImmutableHashSet.CreateRange(_order_factory.dynamic_types()));
_sec_meta_store = sec_meta_store;
ImmutableHashSet.CreateRange(dynamic_helper.dynamic_types));
_security_auxiliary_model = security_auxiliary_model;
/// initialize <see cref="_studio_algos_source"/> with an empty table, so the
/// <see cref="UpdateExtensions.AppendTable{T, TKey}(IObservable{TableUpdate{T, TKey}}, IEnumerable{T})"/>
/// calls made by the 'subscribe_algos' methods will fire at least once, even if the underlying
@@ -63,15 +51,9 @@ namespace mbts.spark {
/// <see cref="subscribe_algos"/>,
/// <see cref="subscribe_algos(SecurityCriteriaClause)"/>,
/// <see cref="subscribe_algos(SecurityImmutable)"/>
var bootstraps = new DisposableBuilder();
_studio_algos_source = bootstraps.emplace(studio_model.definitions.Cache().ToObservable());
_dispose = bootstraps;
_studio_algos_source = studio_model.definitions.Cache();
}
public void Dispose() =>
Disposable.dispose(ref _dispose);
public AlgoTypeSetImmutable get_permitted_algos(SecurityImmutable security) =>
_security_algo_types.Where(p => p.security_criteria.includes(security))
.Select(sec_algos => sec_algos.algo_type_set)
@@ -88,12 +70,12 @@ namespace mbts.spark {
.AppendTable(_security_algo_types
.Select(s => s.algo_type_set)
.Aggregate(AlgoTypeSetImmutable.empty, (a, b) => a.union_with(b))
.define_algos(t => _order_factory.custom_defi(t).assert_value()));
.define_algos(_dynamic_helper));
public IObservable<TableUpdate<AlgoData, AlgoKey>> subscribe_algos(SecurityCriteriaClause security_clause) {
var system_algos = _security_algo_types.match_algos(
security_clause,
t => _order_factory.custom_defi(t).assert_value(),
_dynamic_helper,
def => _fit_to_type(def, security_clause, _security_algo_types));
return _studio_algos_source
@@ -112,9 +94,9 @@ namespace mbts.spark {
// i.e., non-studio algos
var system_algos = _security_algo_types.match_algos(
clause,
t => _order_factory.custom_defi(t).assert_value(),
_dynamic_helper,
def => _fit_to_type(def, security, _security_algo_types),
_sec_meta_store.get_qty_display_divisor(security));
_security_auxiliary_model.get_display_quantity_divisor(security));
var filtered_studio_algos = _studio_algos_source
.StartWith(TableUpdate<AlgoData, AlgoKey>.mk_empty(AlgoData.key_fn))
@@ -198,12 +180,8 @@ namespace mbts.spark {
}
class AttachableAlgoProvider : AlgoProvider, IAttachableAlgoProvider {
public AttachableAlgoProvider(
IEnumerable<SecurityAlgoTypeSetImmutable> algo_sets,
IAlgoStudioModel studio_model,
OrderFactory order_factory,
ISecurityMetadataStore sec_meta_store)
: base(algo_sets, studio_model, order_factory, sec_meta_store) { }
public AttachableAlgoProvider(IEnumerable<SecurityAlgoTypeSetImmutable> algo_sets, IAlgoStudioModel studio_model, DynamicOrderHelper dynamic_helper, ISecurityAuxiliaryDataModel security_auxiliary_model)
: base(algo_sets, studio_model, dynamic_helper, security_auxiliary_model) { }
// arbitrarily assign LimitOrderDefinition (this is just a placeholder; the real child is the attach target algo).
// Note: although 'None' might seem approrpriate, the server requires a valid definition (perhaps this will change in the future).
@@ -1,7 +1,7 @@
namespace mbts.analytics {
using System;
public readonly struct GreeksTuple : IEquatable<GreeksTuple> {
readonly struct GreeksTuple : IEquatable<GreeksTuple> {
public GreeksTuple(
double vol = double.NaN,
double driver = double.NaN,
@@ -58,7 +58,7 @@ namespace mbts.analytics {
public static bool operator !=(GreeksTuple a, GreeksTuple b) => !a.Equals(b);
}
public static class GreeksTupleExtensions {
static class GreeksTupleExtensions {
public static GreeksTuple with(
this GreeksTuple greeks_tuple,
double? vol = null,
@@ -3,7 +3,6 @@ namespace mbts {
using bts.api;
using bts.utils;
using mbts.spark;
using mbts.ui.utility;
using mbts.utils;
@@ -26,9 +25,6 @@ namespace mbts {
SecurityTuple.empty.security_name,
DateTime.MinValue);
public static bts.api.domain.SecurityExpirationImmutable empty_api_sec_expi =>
empty.to_api_sec_expi();
// for deserialization
SecurityExpiration() =>
security_tuple = SecurityTuple.empty;
@@ -131,14 +127,13 @@ namespace mbts {
public bool Equals(SecurityExpiration? other) =>
other is not null &&
security_tuple.safe_equals(other.security_tuple) &&
expiration == other.expiration &&
id == other.id;
expiration == other.expiration;
public override bool Equals(object? obj) =>
Equals(obj as SecurityExpiration);
public override int GetHashCode() =>
HashCode.Combine(security_tuple, expiration, id ?? 0);
HashCode.Combine(security_tuple, expiration);
object ICloneable.Clone() =>
Clone();
@@ -162,7 +157,7 @@ namespace mbts {
public double expiration_oa_date { get; set; }
public SecurityExpirationProto Clone() =>
new() { security = security, expiration_oa_date = expiration_oa_date };
new() { security = security, expiration_oa_date = expiration_oa_date};
public bool Equals(SecurityExpirationProto? other) =>
other is not null &&
@@ -9,26 +9,34 @@ namespace mbts.analytics
[ProtoBuf.ProtoContract(Name = "VolSurfaceAdvancedSettings")]
public class VolSurfaceAdvancedSettings
{
public static VolSurfaceAdvancedSettings Default =>
new() {
number_of_cashed_saved_days = double.NaN,
precomputed_theo_handles = new(0),
theo_handle_measure = VolSurfaceEnums.GeneralChangeMeasure.Absolute,
precomputed_slide_handles = new(0),
slide_handle_measure = VolSurfaceEnums.GeneralChangeMeasure.Percentage,
publish_from_client = false,
publish_from_client_user = string.Empty,
strike_normalization_axis = VolSurfaceEnums.VolCurveStrikeAxis.RawStrike,
};
[ProtoBuf.ProtoMember(1)]
[System.ComponentModel.DefaultValue(Double.NaN)]
public double number_of_cashed_saved_days;
[ProtoBuf.ProtoMember(10)]
public List<double> precomputed_theo_handles;
[ProtoBuf.ProtoMember(15)]
[System.ComponentModel.DefaultValue(VolSurfaceEnums.GeneralChangeMeasure.Absolute)]
public VolSurfaceEnums.GeneralChangeMeasure theo_handle_measure;
[ProtoBuf.ProtoMember(20)]
public List<double> precomputed_slide_handles;
[ProtoBuf.ProtoMember(25)]
[System.ComponentModel.DefaultValue(VolSurfaceEnums.GeneralChangeMeasure.Percentage)]
public VolSurfaceEnums.GeneralChangeMeasure slide_handle_measure;
[ProtoBuf.ProtoMember(30)]
//[System.ComponentModel.DefaultValue(false)]
public bool publish_from_client;
[ProtoBuf.ProtoMember(40)]
@@ -38,5 +46,11 @@ namespace mbts.analytics
[ProtoBuf.ProtoMember(50)]
[System.ComponentModel.DefaultValue(VolSurfaceEnums.VolCurveStrikeAxis.RawStrike)]
public VolSurfaceEnums.VolCurveStrikeAxis strike_normalization_axis;
public void ensure_no_nulls() {
precomputed_theo_handles ??= new(0);
precomputed_slide_handles ??= new(0);
publish_from_client_user ??= string.Empty;
}
}
}
@@ -25,7 +25,8 @@ namespace mbts.analytics {
volpath_settings = new(),
safety_limits = new(),
},
polynomial_model_settings = new()
polynomial_model_settings = new(),
advanced_settings = VolSurfaceAdvancedSettings.Default
};
[ProtoMember(10)]
@@ -79,6 +80,8 @@ namespace mbts.analytics {
if (core_settings.time_settings == null) {
core_settings.time_settings = new VolSurfaceTimeSettings();
}
advanced_settings ??= VolSurfaceAdvancedSettings.Default;
advanced_settings.ensure_no_nulls();
return this;
}
}
@@ -3,16 +3,15 @@
using mbts.co2;
namespace mbts.analytics {
using Size = System.Single;
public class VolSurfaceMDUnit : IEquatable<VolSurfaceMDUnit> {
public readonly double bid_price, ask_price;
public readonly Size bid_size, ask_size;
public readonly uint bid_size, ask_size;
public readonly double mark_price = double.NaN;
private static VolSurfaceMDUnit _empty =
new VolSurfaceMDUnit(Double.NaN, 0, Double.NaN, 0, Double.NaN);
public VolSurfaceMDUnit(double this_bid_price, Size this_bid_size,
double this_ask_price, Size this_ask_size,
public VolSurfaceMDUnit(double this_bid_price, uint this_bid_size,
double this_ask_price, uint this_ask_size,
double this_mark_price) {
bid_price = this_bid_price;
bid_size = this_bid_size;
@@ -42,7 +41,7 @@ namespace mbts.analytics {
}
public double get_weighted_mid_price(bool get_one_sided_mid = true) {
Size sum_q = bid_size + ask_size;
uint sum_q = bid_size + ask_size;
if (sum_q == 0) {
return Double.NaN;
}
@@ -40,10 +40,8 @@ namespace mbts.analytics {
/// last computed min/max driver for each exp
private IDictionary<VolSurfaceExpiration, Tuple<double, double>>
_computed_driver_range_map = new Dictionary<VolSurfaceExpiration, Tuple<double, double>>();
private readonly IEnumerable<double> _default_abs_moves =
new double[] { 300, -200, -125, -100, -75, -50, -25, 0, 25, 50, 75, 100, 125, 200, 300 };
private readonly IEnumerable<double> _default_abs_moves = config.Configuration.get<bts.config.VolSurface>().default_abs_moves;
private readonly double _cushion_percentage = 25.0;
public event
Action<IDictionary<VolSurfaceExpiration, IEnumerable<Theos>>, double, double> on_theos =
(o, vt, tt) => { };
@@ -52,7 +50,7 @@ namespace mbts.analytics {
(o, vt, tt) => { };
public VolSurfaceInterpGreeksProducer(int vs_id) {
Log.Gen.info($"VolSurfaceInterpGreeksProducer.cons vs_id: {vs_id}");
Log.Gen.info($"VolSurfaceInterpGreeksProducer.cons vs_id: {vs_id}, _default_abs_moves: {string.Join(", ", _default_abs_moves)}");
_vs_id = vs_id;
}
@@ -72,7 +70,7 @@ namespace mbts.analytics {
}
public void set_vol_data(VolSurfaceInput vs_input) {
Log.Gen.info($"VolSurfaceInterpGreeksProducer.set_vol_data vs_id: {_vs_id}");
Log.Gen.info($"VolSurfaceInterpGreeksProducer.set_vol_data vs_id: {_vs_id} precomputed_theo_handles?: {string.Join(", ", (vs_input?.surface_settings?.advanced_settings?.precomputed_theo_handles).empty_if_null())}");
_vs_input = vs_input != null ? VolSurfaceUtilityFunctions.clone_proto(vs_input) : null;
_compute_and_fire(InputType.Vol);
}
@@ -155,8 +153,7 @@ namespace mbts.analytics {
var master_exp_keys =
_exp_strikes_map.Keys.Select(k =>
new SecurityExpiration(Venue.Unset, SecurityType.Option, k.symbol, k.expiration));
// TODO: add exchange to key (so we don't have to 'Crush' the duplicate keys)
var exp_params_no_exch = _exp_params_map.ToDictionaryCrushed(
var exp_params_no_exch = _exp_params_map.ToDictionary(
kv => kv.Key.unset_exchange(), kv => kv.Value);
return exp_params_no_exch.sync(master_exp_keys, true,
exp => AnalyticsExpirationParameters.empty);
@@ -211,4 +208,4 @@ namespace mbts.analytics {
kv.Value.driver_price + max_move));
}
}
}
}
@@ -50,7 +50,9 @@ namespace mbts.analytics {
deliverable_security ??= SecurityExpiration.empty;
roll_schedule_expiration ??= SecurityExpiration.empty;
this.driver = driver ?? _default_driver;
this.driver = driver ?? new(new() {
TimeWeightedInterpolated = new()
});
_deliverable = deliverable_security.to_api_sec_expi();
_roll_schedule = roll_schedule_expiration.to_api_sec_expi();
this.roll_target = roll_target;
@@ -61,10 +63,10 @@ namespace mbts.analytics {
}
public AnalyticsExpirationParameters(ExpirationParameterEntryImmutable db_i) {
_security = db_i.HasSecurityExpiration ? db_i.SecurityExpiration : _default_api_sec_expi;
_deliverable = db_i.HasDeliverable ? db_i.Deliverable : _default_api_sec_expi;
_roll_schedule = db_i.HasRollSchedule ? db_i.RollSchedule : _default_api_sec_expi;
driver = db_i.HasDriver ? db_i.Driver : _default_driver;
_security = db_i.SecurityExpiration;
_deliverable = db_i.Deliverable;
_roll_schedule = db_i.RollSchedule;
driver = db_i.Driver;
roll_target = db_i.RollTarget;
riskless_rate = db_i.RisklessRate;
settlement_price = db_i.SettlementPrice;
@@ -72,12 +74,6 @@ namespace mbts.analytics {
vega_beta = db_i.VegaBeta;
}
static ExpirationDriverImmutable _default_driver =>
new(new() { TimeWeightedInterpolated = new() });
static bts.api.domain.SecurityExpirationImmutable _default_api_sec_expi =>
SecurityExpiration.empty_api_sec_expi;
public SecurityExpiration security => _security.to_sec_exp();
public SecurityExpiration driver_security => driver.HasSecurity ?
driver.Security.to_sec_exp() : SecurityExpiration.empty;
+47 -8
View File
@@ -5,10 +5,9 @@ namespace mbts.ui.shell {
using CommandLine;
using mbts.ui.native;
using Spark.Cli;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
@@ -22,7 +21,7 @@ namespace mbts.ui.shell {
static readonly Mutex _mutex;
ShellBootstrapper _runtime;
SparkCmdOpts _opts;
CLIOptions _opts;
Process _stunnel_process;
static App() {
@@ -44,13 +43,25 @@ namespace mbts.ui.shell {
#endif
public new int Run() {
var argv = SparkCmdOpts.conform_opts(Environment.GetCommandLineArgs().Skip(1));
var argv = Environment.GetCommandLineArgs().ToList();
// TODO: Add configserver arg to CLIOptions (for now, just strip it
// out before parsing)
for (int i = 0; i < argv.Count; i++) {
if (argv[i].ToLower() == "-configserver") {
argv.RemoveAt(i);
if (i < argv.Count) {
argv.RemoveAt(i);
}
break;
}
}
int exit_code = 1;
Parser.Default.ParseArguments<SparkCmdOpts>(argv).WithParsed(opts => {
Parser.Default.ParseArguments<CLIOptions>(argv).WithParsed(opts => {
_opts = opts;
var opt_desc = TableFormatter.fmt_table(
typeof(SparkCmdOpts).GetProperties()
typeof(CLIOptions).GetProperties()
.Select(p => (p.Name, p.GetValue(opts))), field_separator: "\n\t");
Log.Ui.info($"Running spark_client with options:\n\t{opt_desc}");
try {
@@ -83,8 +94,7 @@ namespace mbts.ui.shell {
CultureInfo.DefaultThreadCurrentUICulture = us_culture;
base.OnStartup(e);
_runtime = new ShellBootstrapper(
_opts?.user, _opts?.password, _opts?.sparkd, _opts?.restore_workspace);
_runtime = new ShellBootstrapper(_opts?.user, _opts?.password, _opts?.restore_workspace);
_runtime.Run();
// Select text on tab in
@@ -149,5 +159,34 @@ namespace mbts.ui.shell {
stunnel_job_error = "Error starting stunnel: " + ex.Message;
}
}
class CLIOptions {
[Option("multiple", HelpText = "Allow multple shells to run simultaneously")]
public bool allow_multiple_shells { get; set; }
[Option("stunnel", HelpText = "Use stunnel")]
public bool stunnel { get; set; }
[Option("no-stunnel", HelpText = "Don't use stunnel")]
public bool no_stunnel {
get => !stunnel;
set => stunnel = !value;
}
[Option("user", HelpText = "The user with which to login")]
public string user { get; set; }
[Option("password", HelpText = "The password with which to login")]
public string password { get; set; }
[Option("restore-workspace", HelpText = "Whether or not to restore the user's last workspace", Default = true)]
public bool restore_workspace { get; set; }
[Option("no-restore-workspace", HelpText = "Whether or not to restore the user's last workspace")]
public bool no_restore_workspace {
get => !restore_workspace;
set => restore_workspace = !value;
}
}
}
}
+1 -4
View File
@@ -38,10 +38,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.SystemConfig>().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) => {
@@ -4,9 +4,7 @@ using bts.spark;
using mbts.spark;
using mbts.ui;
using Spark.Api.Orders;
using Spark.Core.Disposables;
using Spark.Core.Reactive;
using System;
using System.Collections.Generic;
+1 -1
View File
@@ -104,7 +104,7 @@ namespace bts {
rv.ContractSpec.CashPerPoint = 50;
rv.ContractSpec.PriceMultiplier = 1.0;
// Currency
rv.Currency = "USD";
rv.Currency = Currency.Usd;
}
public static void fill_security_future(ref Security rv, DateTime exp) {
Loaded 100 of 1967 files, more files were not shown because too many files have changed in this diff. Show more