Compare commits
392
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
758e9e2d94 | ||
|
|
a5f86ed839 | ||
|
|
dbfdf59bfe | ||
|
|
abacf29b85 | ||
|
|
5e7a31e5c5 | ||
|
|
ab78ae867a | ||
|
|
5e60f38b9b | ||
|
|
8f4b4be6db | ||
|
|
696195aefd | ||
|
|
36f0a544e9 | ||
|
|
f23242b18c | ||
|
|
75dd6d659b | ||
|
|
a23d8228b4 | ||
|
|
59f3d54597 | ||
|
|
8b3166582d | ||
|
|
fd13316b8e | ||
|
|
5991ab03ec | ||
|
|
b9bc6184d4 | ||
|
|
aab3e836c3 | ||
|
|
ed0fc60900 | ||
|
|
6764ae268e | ||
|
|
6d3d9ddacf | ||
|
|
ccd76ec284 | ||
|
|
d52ea0e997 | ||
|
|
15e23fe486 | ||
|
|
d9e5b11026 | ||
|
|
21c19c94c2 | ||
|
|
c31d9d6c72 | ||
|
|
a7e89b075b | ||
|
|
f50430e9e2 | ||
|
|
4891250959 | ||
|
|
ad1b89ff88 | ||
|
|
49053d31c2 | ||
|
|
651ebdbb41 | ||
|
|
d21de803f6 | ||
|
|
bb81151392 | ||
|
|
2b277b84a2 | ||
|
|
2bf4502d06 | ||
|
|
94d1b9d784 | ||
|
|
ceee66d5f2 | ||
|
|
2e9a968752 | ||
|
|
6c2989b139 | ||
|
|
6c2bfee616 | ||
|
|
30c5ea7fb2 | ||
|
|
a6831b5548 | ||
|
|
b42943fe8d | ||
|
|
06c833e96c | ||
|
|
9aff02b225 | ||
|
|
4229a523a8 | ||
|
|
82e9e6b6bf | ||
|
|
904a6db1d0 | ||
|
|
2a9f03741e | ||
|
|
fd3de056c1 | ||
|
|
978a1e8566 | ||
|
|
36e1771579 | ||
|
|
0d23fd50f5 | ||
|
|
367c9c1c7c | ||
|
|
78f5526ce7 | ||
|
|
a1d7ebd260 | ||
|
|
3fda1cb369 | ||
|
|
2c2a68022b | ||
|
|
bb321926bc | ||
|
|
45c35ba1b2 | ||
|
|
77c61d5e3f | ||
|
|
12962ed5ca | ||
|
|
f472db002c | ||
|
|
6939f32f69 | ||
|
|
0107d934e5 | ||
|
|
ce9880a9b1 | ||
|
|
317f17d7da | ||
|
|
7da128da6b | ||
|
|
f603866860 | ||
|
|
dc2d525955 | ||
|
|
e97335189a | ||
|
|
81ce58268f | ||
|
|
7dace3fc1d | ||
|
|
f4794bea33 | ||
|
|
b044ff3b2a | ||
|
|
cd7856c46e | ||
|
|
3be0ee6072 | ||
|
|
198d26fda1 | ||
|
|
8b26ac4456 | ||
|
|
d6f172e953 | ||
|
|
91ee9b739a | ||
|
|
b568128180 | ||
|
|
53a87530ee | ||
|
|
450de301a9 | ||
|
|
462b0f4eda | ||
|
|
17402ce94a | ||
|
|
b7fae8a6f5 | ||
|
|
4058a98290 | ||
|
|
06d7693ed6 | ||
|
|
2b01f3d902 | ||
|
|
d231ee50b7 | ||
|
|
815546d5ab | ||
|
|
3fda0e4427 | ||
|
|
a1eec029ac | ||
|
|
2bbe92dbab | ||
|
|
b3d0040faa | ||
|
|
c3e924be17 | ||
|
|
dc5574e660 | ||
|
|
5c19b391b1 | ||
|
|
79cb3162f2 | ||
|
|
e49254356a | ||
|
|
3192ef5561 | ||
|
|
8158bcb4f3 | ||
|
|
b03cb94d60 | ||
|
|
0f968c65b6 | ||
|
|
6b92773e87 | ||
|
|
870e1b7301 | ||
|
|
477a2f6da3 | ||
|
|
85fe84406d | ||
|
|
e8096a4db9 | ||
|
|
e68e673835 | ||
|
|
53274e865a | ||
|
|
64df20cb36 | ||
|
|
1977ad8ad4 | ||
|
|
a7e63d02e9 | ||
|
|
593be8d069 | ||
|
|
f7e173f902 | ||
|
|
7eefae4c42 | ||
|
|
7bb0951169 | ||
|
|
787fb879d2 | ||
|
|
c23dafcb89 | ||
|
|
111278b63b | ||
|
|
2008478378 | ||
|
|
d5de60bc21 | ||
|
|
76172d0a5f | ||
|
|
1893df1f5c | ||
|
|
a07fa26bfe | ||
|
|
41447067a2 | ||
|
|
1dd3d39a21 | ||
|
|
4f772a1d57 | ||
|
|
97bd49d221 | ||
|
|
b4374cec6b | ||
|
|
7e5c1218a3 | ||
|
|
475970659c | ||
|
|
e0706dde01 | ||
|
|
986ea74e63 | ||
|
|
fa0e6f7c10 | ||
|
|
ea5156122c | ||
|
|
97b974a31f | ||
|
|
ef98682620 | ||
|
|
d70eb158c4 | ||
|
|
6fc34e922a | ||
|
|
fe65554c7a | ||
|
|
78d9b678a8 | ||
|
|
88302c9470 | ||
|
|
ac6c9e5c46 | ||
|
|
b1de323151 | ||
|
|
24e57872ce | ||
|
|
ddd3f301b3 | ||
|
|
7007fc9d6b | ||
|
|
7ca407fc42 | ||
|
|
5217e8801e | ||
|
|
ddd50cd916 | ||
|
|
9ae3ababfa | ||
|
|
753cac0e7a | ||
|
|
6c3c9ebbcb | ||
|
|
3aaa25a3e8 | ||
|
|
3fc0bce1de | ||
|
|
fdb4544cb5 | ||
|
|
f5741d8095 | ||
|
|
539d1cfeae | ||
|
|
c1ed79757c | ||
|
|
c37727f482 | ||
|
|
b25cd39481 | ||
|
|
5f93bed074 | ||
|
|
ef9502c81b | ||
|
|
4b2c2de990 | ||
|
|
79dc76c5df | ||
|
|
fdbc64dfc5 | ||
|
|
62c20c96b4 | ||
|
|
6b491ec209 | ||
|
|
d009deea0e | ||
|
|
390d901463 | ||
|
|
a0bd207d93 | ||
|
|
d62f88691c | ||
|
|
b7c018b664 | ||
|
|
83127523b9 | ||
|
|
86c824e28d | ||
|
|
0349ff95bf | ||
|
|
f62c867a20 | ||
|
|
b403cacb93 | ||
|
|
4499a3751f | ||
|
|
6d887cb72f | ||
|
|
10e13dd51d | ||
|
|
85edf68ff0 | ||
|
|
259ac99cdd | ||
|
|
39c3a34158 | ||
|
|
dde8223052 | ||
|
|
2548f27527 | ||
|
|
ff03f092f5 | ||
|
|
53ef67869b | ||
|
|
d48f34d109 | ||
|
|
a2d9c39325 | ||
|
|
0c4f684036 | ||
|
|
e587c8dbd7 | ||
|
|
069ab45164 | ||
|
|
7b7de6f8fc | ||
|
|
9ed3b2aecb | ||
|
|
ecf3f922df | ||
|
|
1aa283fc8c | ||
|
|
bfbf640986 | ||
|
|
b6cd470ca6 | ||
|
|
d826cff9d7 | ||
|
|
ff65a5ca5b | ||
|
|
9e012a2b3a | ||
|
|
a6f1c51539 | ||
|
|
655f27543b | ||
|
|
762baca586 | ||
|
|
ec769b49f6 | ||
|
|
5153e8725c | ||
|
|
f79f2cc5b9 | ||
|
|
cdf4f341d4 | ||
|
|
f649c26304 | ||
|
|
3a8d759a26 | ||
|
|
29ca6e98fb | ||
|
|
328dd9b2d3 | ||
|
|
a1e58e5498 | ||
|
|
ef43aebc5d | ||
|
|
9a3304201e | ||
|
|
cd88710385 | ||
|
|
2b3e4a4579 | ||
|
|
05731cb9a2 | ||
|
|
01eeadaf42 | ||
|
|
b4721882ec | ||
|
|
3e894d0e27 | ||
|
|
4e42125398 | ||
|
|
664cc37a03 | ||
|
|
f4a0da3518 | ||
|
|
5339d4ff93 | ||
|
|
a31368f08d | ||
|
|
136938ba1e | ||
|
|
09316b630d | ||
|
|
99a661089f | ||
|
|
f26cb80e5f | ||
|
|
cda3d18838 | ||
|
|
fae0325e87 | ||
|
|
118ca7248d | ||
|
|
afa194ac54 | ||
|
|
3538712692 | ||
|
|
604c34384c | ||
|
|
c18f1baafa | ||
|
|
8e04920ab9 | ||
|
|
aa3147a4a6 | ||
|
|
f7ab968e1b | ||
|
|
5ce3d9d1a9 | ||
|
|
e2a9c91d3f | ||
|
|
78a8652e7a | ||
|
|
e9c536df96 | ||
|
|
94429a1fbc | ||
|
|
f2728dcf78 | ||
|
|
cbfd18c371 | ||
|
|
60a31eb102 | ||
|
|
7c1e95d35d | ||
|
|
90a046d539 | ||
|
|
935a6f846c | ||
|
|
d641eba252 | ||
|
|
77697f4312 | ||
|
|
247d8b7ee8 | ||
|
|
06bed8747f | ||
|
|
954dc582dc | ||
|
|
df510f0e3b | ||
|
|
ef9b3b0544 | ||
|
|
b8b3a57e8e | ||
|
|
d18020a45c | ||
|
|
e652c1cd24 | ||
|
|
8f5d6ccd51 | ||
|
|
cbe4a488b9 | ||
|
|
8ce3ef69d0 | ||
|
|
ab9fab13d9 | ||
|
|
309b0e64b2 | ||
|
|
a6324a9aa2 | ||
|
|
64417a6867 | ||
|
|
8e16dcde0d | ||
|
|
2d8f6df0e2 | ||
|
|
10199fb7ad | ||
|
|
6f6ac2866c | ||
|
|
46837facbf | ||
|
|
4916211301 | ||
|
|
1d8c4a0954 | ||
|
|
64601914b2 | ||
|
|
b3ca5f133e | ||
|
|
9c3397d367 | ||
|
|
b3dfce9f91 | ||
|
|
590d0028c2 | ||
|
|
67cf817aa9 | ||
|
|
35811512a4 | ||
|
|
c13c85ed44 | ||
|
|
5c85dabad8 | ||
|
|
c134b0f5ca | ||
|
|
d92ad7e2b6 | ||
|
|
4547d8cec1 | ||
|
|
402a1f50f2 | ||
|
|
bada16ade7 | ||
|
|
9794465d88 | ||
|
|
1f163615c5 | ||
|
|
4304d7f786 | ||
|
|
38a5d95df9 | ||
|
|
4897195629 | ||
|
|
1416f05fbd | ||
|
|
ac1f64c3f5 | ||
|
|
8fa82840be | ||
|
|
af92b8922f | ||
|
|
f3d1569cb3 | ||
|
|
da41a23c0e | ||
|
|
e79aebbc8a | ||
|
|
fcd6038d5d | ||
|
|
d1fe0a03b5 | ||
|
|
cfdca08cfe | ||
|
|
d400bf6263 | ||
|
|
fa438db001 | ||
|
|
31dd34522f | ||
|
|
f5221910c8 | ||
|
|
6e7e1980f5 | ||
|
|
11e884e166 | ||
|
|
88943f0857 | ||
|
|
a5459a3aff | ||
|
|
e8fa4f23c6 | ||
|
|
df82c0790b | ||
|
|
81f1d91f5b | ||
|
|
abf0d45784 | ||
|
|
556e2ab99e | ||
|
|
4b60fb5141 | ||
|
|
5eb9c57ba1 | ||
|
|
e08b80afee | ||
|
|
9b8e5896a2 | ||
|
|
55e8c60a0b | ||
|
|
a30b026c9d | ||
|
|
cb79cbeb45 | ||
|
|
0e101aaf8b | ||
|
|
e8244595f3 | ||
|
|
37512eb8d6 | ||
|
|
567db063f3 | ||
|
|
cc1484a81e | ||
|
|
0dc278eed5 | ||
|
|
43ba30365a | ||
|
|
02ac95404d | ||
|
|
8388bdf1ec | ||
|
|
019c3dd8db | ||
|
|
481380f883 | ||
|
|
7c66260ff1 | ||
|
|
ad465b593f | ||
|
|
00d702f998 | ||
|
|
872f55d6c3 | ||
|
|
84f4c38336 | ||
|
|
b9b907490a | ||
|
|
8c6835a919 | ||
|
|
3a6bda4e08 | ||
|
|
60f76344c2 | ||
|
|
1fff7d5bcd | ||
|
|
d77d3ab6c7 | ||
|
|
2eca4f7f14 | ||
|
|
053fa461a2 | ||
|
|
aa997466f0 | ||
|
|
fdf4fce5fa | ||
|
|
5746460e8d | ||
|
|
569ac8e3e0 | ||
|
|
d9efbb879d | ||
|
|
92ff4198ef | ||
|
|
48bd3ab49a | ||
|
|
9c7fc000e5 | ||
|
|
d2454b6b85 | ||
|
|
b4cda81535 | ||
|
|
2d0fae0cbe | ||
|
|
5515404062 | ||
|
|
24c4dc1861 | ||
|
|
3b1a2357cc | ||
|
|
35371fe971 | ||
|
|
365394f28b | ||
|
|
88c70a3ea0 | ||
|
|
b0eb1175c1 | ||
|
|
e90d627125 | ||
|
|
c1190d4ef9 | ||
|
|
67487415ad | ||
|
|
dcf80d7067 | ||
|
|
99a778811a | ||
|
|
eb76f0a6c5 | ||
|
|
b8de813859 | ||
|
|
6b480afd43 | ||
|
|
40d21542ae | ||
|
|
a8af5d2523 | ||
|
|
bfd12aed63 | ||
|
|
76936ea50d | ||
|
|
6947aea35e | ||
|
|
34be51c648 | ||
|
|
56b68b9a24 | ||
|
|
84e6f010d7 | ||
|
|
b360f953db | ||
|
|
51c89fb8cc | ||
|
|
ded674d87c |
No files matched your search
@@ -4,6 +4,7 @@ BinPackParameters: false
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
PenaltyReturnTypeOnItsOwnLine: 140
|
||||
ReflowComments: false
|
||||
---
|
||||
Language: Proto
|
||||
IndentWidth: 2
|
||||
|
||||
+5
-1
@@ -50,4 +50,8 @@ trace_data/
|
||||
*.tmp/*
|
||||
/.venv*/*
|
||||
.cache/
|
||||
src/web/api/tsconfig.*.g.json
|
||||
/src/Spark.Admin.WebApp/tsconfig.*.g.json
|
||||
/src/Spark.Admin.WebApp/src/bin/
|
||||
**/CMakeDeps.cmake
|
||||
**/CMakeDeps_win.cmake
|
||||
**/devcontainer.json
|
||||
@@ -1,9 +1,3 @@
|
||||
[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
|
||||
+153
-72
@@ -13,101 +13,182 @@ set(
|
||||
CACHE
|
||||
STRING
|
||||
"External dependencies root folder (should contain folders: lib, bin, include")
|
||||
set(SPARK_PYTHON "${EXTERNALS_ROOT}/python")
|
||||
set(SPARK_BIN "${EXTERNALS_ROOT}/bin")
|
||||
set(SPARK_INCLUDE "${EXTERNALS_ROOT}/include")
|
||||
set(SPARK_LIB "${EXTERNALS_ROOT}/lib/${CMAKE_BUILD_TYPE}")
|
||||
set(SPARK_LIB "${EXTERNALS_ROOT}/lib/$<CONFIG>")
|
||||
set(BUILD_SPARK_CONFIG OFF CACHE BOOL "Build lib_spark_config")
|
||||
set(BUILD_API_SERVER OFF CACHE BOOL "Build the api server")
|
||||
set(BUILD_DOCS OFF CACHE BOOL "Build documentation")
|
||||
set(BUILD_SDK OFF CACHE BOOL "Build the sdk")
|
||||
set(BUILD_WEB ON CACHE BOOL "Build the web server")
|
||||
set(BUILD_ADMIN_WEB_APP ON CACHE BOOL "Build the Admin WebApp")
|
||||
if (WIN32)
|
||||
set(BUILD_SPARKD OFF CACHE BOOL "Build sparkd")
|
||||
else()
|
||||
set(BUILD_SPARKD ON CACHE BOOL "Build sparkd")
|
||||
endif()
|
||||
|
||||
include_directories(BEFORE SYSTEM ${SPARK_INCLUDE} ${EXTERNALS_ROOT}/include/zlib)
|
||||
link_directories(${SPARK_LIB})
|
||||
|
||||
if(WIN32)
|
||||
# flags
|
||||
set(
|
||||
CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} \
|
||||
/MP \
|
||||
/WX /wd4251 /wd4250 /wd4251 /wd4244 /wd4267 /wd4355 /wd4275 /wd4345 \
|
||||
/bigobj \
|
||||
/DCURL_STATICLIB \
|
||||
/D_WINSOCK_DEPRECATED_NO_WARNINGS \
|
||||
/D__TBB_NO_IMPLICIT_LINKAGE \
|
||||
/DBOOST_ALL_NO_LIB \
|
||||
/std:c++17 \
|
||||
/D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} /MT")
|
||||
set(
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE
|
||||
"${CMAKE_SHARED_LINKER_FLAGS_RELEASE} \
|
||||
/DEBUG \
|
||||
/OPT:REF \
|
||||
/OPT:ICF \
|
||||
/LTCG")
|
||||
|
||||
add_compile_definitions(SHARED_MEMORY_PREFIX="spark")
|
||||
add_compile_definitions(APP_DATA_DIR="\$\{APPDATA\}/bts/")
|
||||
# subdirs
|
||||
add_subdirectory(src/lib_expression)
|
||||
add_subdirectory(src/lib)
|
||||
elseif(BUILD_SPARK_CONFIG)
|
||||
add_compile_definitions(SHARED_MEMORY_PREFIX="sparkd")
|
||||
add_compile_definitions(APP_DATA_DIR="\$\{HOME\}/sparkdata/")
|
||||
add_subdirectory(src/lib_core)
|
||||
add_subdirectory(src/lib_logging)
|
||||
add_subdirectory(src/lib_io)
|
||||
add_subdirectory(src/lib_domain)
|
||||
add_subdirectory(src/lib_protobuf)
|
||||
add_subdirectory(src/lib_threading)
|
||||
add_subdirectory(src/lib_expression)
|
||||
add_subdirectory(src/lib_md)
|
||||
add_subdirectory(src/lib_spark_config)
|
||||
else()
|
||||
# make sparkd look for libspark.so in its directory
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set(CMAKE_INSTALL_RPATH ".")
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install/${CMAKE_BUILD_TYPE}/sparkd")
|
||||
add_compile_definitions(SPARK_ENABLE_CCAPI)
|
||||
add_compile_definitions(CCAPI_ENABLE_SERVICE_MARKET_DATA)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_FTX)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE)
|
||||
add_compile_definitions(CCAPI_ENABLE_LOG_WARN)
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
|
||||
set(SPARK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/$<CONFIG>")
|
||||
|
||||
# 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")
|
||||
if(BUILD_API_SERVER)
|
||||
add_compile_definitions(SPARK_ENABLE_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 exchanges/services
|
||||
add_compile_definitions(CCAPI_ENABLE_SERVICE_MARKET_DATA)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_DERIBIT)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_FTX)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_US)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_USDS_FUTURES)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_BINANCE_COIN_FUTURES)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_HUOBI)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_HUOBI_USDT_SWAP)
|
||||
add_compile_definitions(CCAPI_ENABLE_EXCHANGE_HUOBI_COIN_SWAP)
|
||||
|
||||
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")
|
||||
|
||||
endif()
|
||||
|
||||
# subdirs
|
||||
add_subdirectory(src/server/sparkd)
|
||||
if (BUILD_SPARKD)
|
||||
add_subdirectory(src/server/sparkd)
|
||||
add_subdirectory(src/data_files)
|
||||
# add_subdirectory(src/lib_md)
|
||||
add_subdirectory(src/lib_core)
|
||||
add_subdirectory(src/lib_logging)
|
||||
add_subdirectory(src/lib_threading)
|
||||
add_subdirectory(src/lib_expression)
|
||||
add_subdirectory(src/lib_spark_config)
|
||||
endif()
|
||||
add_subdirectory(src/lib)
|
||||
if (BUILD_WEB)
|
||||
add_subdirectory(src/web)
|
||||
if (BUILD_ADMIN_WEB_APP)
|
||||
add_subdirectory(src/Spark.Admin.WebApp)
|
||||
endif()
|
||||
if (BUILD_API_SERVER)
|
||||
set(_cs_source_dirs
|
||||
spark_api
|
||||
spark_api_server
|
||||
spark_core
|
||||
spark_websocket)
|
||||
foreach(cs_source_dir IN LISTS _cs_source_dirs)
|
||||
file(GLOB cs_source_dir "${CMAKE_SOURCE_DIR}/src/client/${cs_source_dir}/*.cs")
|
||||
list(APPEND _api_server_sources ${cs_source_dir})
|
||||
endforeach()
|
||||
|
||||
list(APPEND _api_server_sources
|
||||
${CMAKE_SOURCE_DIR}/src/client/spark_api/spark_api.csproj
|
||||
${CMAKE_SOURCE_DIR}/src/client/spark_api_server/spark_api_server.csproj
|
||||
${CMAKE_SOURCE_DIR}/src/client/spark_core/spark_core.csproj
|
||||
${CMAKE_SOURCE_DIR}/src/client/spark_websocket/spark_websocket.csproj)
|
||||
|
||||
set(_out_dir ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
||||
set(_api_server_dlls
|
||||
${CMAKE_BINARY_DIR}/$<CONFIG>/bin/net7.0/spark_api.dll
|
||||
${CMAKE_BINARY_DIR}/$<CONFIG>/bin/net7.0/spark_core.dll
|
||||
${CMAKE_BINARY_DIR}/$<CONFIG>/bin/net7.0/spark_websocket.dll
|
||||
${CMAKE_BINARY_DIR}/$<CONFIG>/bin/net7.0/spark_api_server)
|
||||
add_custom_command(
|
||||
OUTPUT ${_api_server_dlls}
|
||||
COMMAND dotnet build ${CMAKE_SOURCE_DIR}/Spark.Api.Server.sln --verbosity minimal --configuration $<CONFIG>
|
||||
COMMENT "Building Spark.Api.Server.sln"
|
||||
DEPENDS ${_api_server_sources})
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_BINARY_DIR}/$<CONFIG>/bin/net7.0/libspark.so
|
||||
COMMAND ln -sf ARGS ${CMAKE_BINARY_DIR}/src/lib/$<CONFIG>/libspark.so ${CMAKE_BINARY_DIR}/$<CONFIG>/bin/net7.0
|
||||
COMMENT "Symlink libspark to api server bins"
|
||||
DEPENDS ${_api_server_dlls})
|
||||
add_custom_target(websocket_api_layout ALL DEPENDS ${CMAKE_BINARY_DIR}/$<CONFIG>/bin/net7.0/libspark.so)
|
||||
endif()
|
||||
if(BUILD_DOCS)
|
||||
add_subdirectory(doc/user)
|
||||
endif()
|
||||
add_subdirectory(doc/user)
|
||||
if(BUILD_SDK)
|
||||
add_subdirectory(src/sdk)
|
||||
endif()
|
||||
add_subdirectory(src/data_files)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/src/server/sparkd/sparkd ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/web ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/data_files ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND ln ARGS -sf ${CMAKE_BINARY_DIR}/src/lib/libspark.so ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND
|
||||
ln ARGS -sf
|
||||
${EXTERNALS_ROOT}/lib/Release/libOnixS.IceImpactMulticastPriceFeedHandlerCpp.so.3.16.0.0
|
||||
${CMAKE_BINARY_DIR}/server
|
||||
COMMAND ln ARGS -sf ${EXTERNALS_ROOT}/lib/Release/libACE-5.7.5.so ${CMAKE_BINARY_DIR}/server
|
||||
COMMAND mkdir ARGS -p ${CMAKE_BINARY_DIR}/server/plugins
|
||||
COMMENT "Creating server runtime layout"
|
||||
DEPENDS sparkd data_files_dir)
|
||||
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_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 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)
|
||||
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()
|
||||
endif()
|
||||
@@ -0,0 +1,283 @@
|
||||
{
|
||||
"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++17 /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_SHARED_LINKER_FLAGS_RELEASE": "/DEBUG /OPT:REF /OPT:ICF /LTCG",
|
||||
"EXTERNALS_ROOT": "${sourceDir}/externals/windows"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "sparkd",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Linux"
|
||||
},
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"cacheVariables": {
|
||||
"platform": "",
|
||||
"CMAKE_BUILD_WITH_INSTALL_RPATH": {
|
||||
"type": "BOOL",
|
||||
"value": "ON"
|
||||
},
|
||||
"CMAKE_INSTALL_RPATH": ".",
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}/sparkd",
|
||||
"CMAKE_EXE_LINKER_FLAGS": "-Wno-undef",
|
||||
"EXTERNALS_ROOT": "${sourceDir}/externals/linux",
|
||||
"CMAKE_CXX_STANDARD": "17",
|
||||
"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": "Debug"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "sparkd-release",
|
||||
"inherits": "sparkd",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CCAPI_LOG_LEVEL": "Warn"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"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++17 -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++17 -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++17 -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++17 -fdiagnostics-color -Wno-stringop-overread -Wno-maybe-uninitialized -fno-omit-frame-pointer -DNDEBUG -O3",
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/gcc/release/sparkd"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "sparkd-publish",
|
||||
"inherits": "sparkd-release-gcc",
|
||||
"displayName": "Publish",
|
||||
"description": "Production build compiled w/ gcc and ready to ship"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "spark-config",
|
||||
"displayName": "Spark Config",
|
||||
"description": "Test build for lib_spark_config",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"generator": "Unix Makefiles",
|
||||
"cacheVariables": {
|
||||
"platform": "linux",
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_BUILD_WITH_INSTALL_RPATH": {
|
||||
"type": "BOOL",
|
||||
"value": "ON"
|
||||
},
|
||||
"CMAKE_INSTALL_RPATH": ".",
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
|
||||
"CMAKE_EXE_LINKER_FLAGS": "-Wno-undef",
|
||||
"EXTERNALS_ROOT": "${sourceDir}/externals/linux",
|
||||
"CMAKE_CXX_STANDARD": "17",
|
||||
"BUILD_SPARKD": {
|
||||
"type": "BOOL",
|
||||
"value": "OFF"
|
||||
},
|
||||
"BUILD_DOCS": {
|
||||
"type": "BOOL",
|
||||
"value": "OFF"
|
||||
},
|
||||
"BUILD_SDK": {
|
||||
"type": "BOOL",
|
||||
"value": "OFF"
|
||||
},
|
||||
"BUILD_SPARK_CONFIG": {
|
||||
"type": "BOOL",
|
||||
"value": "ON"
|
||||
},
|
||||
"BUILD_ADMIN_WEB_APP": {
|
||||
"type": "BOOL",
|
||||
"value": "OFF"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "spark",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
},
|
||||
"hidden": true,
|
||||
"jobs": 4
|
||||
},
|
||||
|
||||
{
|
||||
"name": "spark-dev",
|
||||
"displayName": "Development",
|
||||
"inherits": "spark",
|
||||
"configurePreset": "spark",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "spark-prod",
|
||||
"displayName": "Production",
|
||||
"inherits": "spark",
|
||||
"configurePreset": "spark",
|
||||
"configuration": "Release"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "sparkd",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Linux"
|
||||
},
|
||||
"hidden": true,
|
||||
"jobs": 4,
|
||||
"targets": [
|
||||
"data_files_dir",
|
||||
"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-config",
|
||||
"configurePreset": "spark-config",
|
||||
"displayName": "Spark Config",
|
||||
"inherits": "sparkd"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "sparkd-publish",
|
||||
"configurePreset": "sparkd-publish",
|
||||
"displayName": "Publish",
|
||||
"inherits": "sparkd",
|
||||
"targets": "install"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
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
|
||||
+23
-12
@@ -16,13 +16,26 @@ function(Protobuf_Generate_Cpp SRCS HDRS)
|
||||
|
||||
list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
|
||||
list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
|
||||
|
||||
set(PROTOBUF_INCLUDE_DIR_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
# list(APPEND PROTOBUF_INCLUDE_DIR_ARGS " -I ")
|
||||
# list(APPEND PROTOBUF_INCLUDE_DIR_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
foreach(INC ${PROTOBUF_INCLUDE_DIRS})
|
||||
set(PROTOBUF_INCLUDE_DIR_ARGS ${PROTOBUF_INCLUDE_DIR_ARGS} -I ${INC})
|
||||
# list(APPEND PROTOBUF_INCLUDE_DIR_ARGS " -I ")
|
||||
# list(APPEND PROTOBUF_INCLUDE_DIR_ARGS ${INC})
|
||||
endforeach()
|
||||
set(PROTOBUF_INCLUDE_DIR_ARGS ${PROTOBUF_INCLUDE_DIR_ARGS} -I ${CMAKE_CURRENT_BINARY_DIR})
|
||||
# string(JOIN " -I " PROTOBUF_INCLUDE_DIR_ARGS_ ${PROTOBUF_INCLUDE_DIR_ARGS})
|
||||
message("pb inc: ${PROTOBUF_INCLUDE_DIR_ARGS}")
|
||||
# set(cmd_text "${Protobuf_PROTOC_EXECUTABLE} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} -I ${PROTOBUF_INCLUDE_DIR_ARGS_} -I ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL}")
|
||||
message("CMD: ${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out=${CMAKE_CURRENT_BINARY_DIR} -I ${PROTOBUF_INCLUDE_DIR_ARGS} ${ABS_FIL}")
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
|
||||
COMMAND
|
||||
${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out=${CMAKE_BINARY_DIR}/src -I
|
||||
${PROTOBUF_INCLUDE_DIRS} -I ${CMAKE_SOURCE_DIR}/src ${ABS_FIL}
|
||||
COMMAND ${Protobuf_PROTOC_EXECUTABLE} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} -I ${PROTOBUF_INCLUDE_DIR_ARGS} ${ABS_FIL}
|
||||
# COMMAND
|
||||
# ${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out=${CMAKE_CURRENT_BINARY_DIR} -I
|
||||
# ${PROTOBUF_INCLUDE_DIR_ARGS} ${ABS_FIL}
|
||||
DEPENDS ${ABS_FIL}
|
||||
COMMENT "Running C++ protocol buffer compiler on ${FIL}"
|
||||
VERBATIM)
|
||||
@@ -90,10 +103,10 @@ function(Service_Compiler_Generate_Cpp SRCS HDRS)
|
||||
COMMAND SET PYTHONPATH=${SPARK_PYTHON}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/.venv/Scripts/activate.bat
|
||||
COMMAND
|
||||
${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out=${CMAKE_BINARY_DIR}/src
|
||||
${Protobuf_PROTOC_EXECUTABLE} ARGS --cpp_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
--plugin=protoc-gen-service=${CMAKE_SOURCE_DIR}/src/lib/api/service_compiler/plugin.cmd
|
||||
--service_out=lang=cpp:${CMAKE_BINARY_DIR}/src -I
|
||||
${PROTOBUF_INCLUDE_DIRS} -I ${CMAKE_SOURCE_DIR}/src ${ABS_FIL}
|
||||
--service_out=lang=cpp:${CMAKE_CURRENT_BINARY_DIR} -I
|
||||
${PROTOBUF_INCLUDE_DIRS} -I ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL}
|
||||
DEPENDS ${ABS_FIL} ${TEMPLATES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/api/service_compiler/plugin.py
|
||||
COMMENT "Running C++ service compiler on ${FIL}"
|
||||
@@ -109,10 +122,10 @@ function(Service_Compiler_Generate_Cpp SRCS HDRS)
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/tools/venv_exec.sh
|
||||
ARGS
|
||||
${Protobuf_PROTOC_EXECUTABLE}
|
||||
--cpp_out=${CMAKE_BINARY_DIR}/src
|
||||
--cpp_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
--plugin=protoc-gen-service=${CMAKE_SOURCE_DIR}/src/lib/api/service_compiler/plugin.py
|
||||
--service_out=lang=cpp,make_file_name=${ABS_FIL}:${CMAKE_BINARY_DIR}/src
|
||||
-I ${PROTOBUF_INCLUDE_DIRS} -I ${CMAKE_SOURCE_DIR}/src ${ABS_FIL}
|
||||
--service_out=lang=cpp,make_file_name=${ABS_FIL}:${CMAKE_CURRENT_BINARY_DIR}
|
||||
-I ${PROTOBUF_INCLUDE_DIRS} -I ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL}
|
||||
DEPENDS ${ABS_FIL} ${TEMPLATES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/api/service_compiler/plugin.py
|
||||
COMMENT "Running C++ service compiler on ${FIL}"
|
||||
@@ -121,8 +134,6 @@ 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
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
[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
|
||||
[py venv]: https://docs.python.org/3/library/venv.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 Sparkd on Linux
|
||||
|
||||
**Notes**
|
||||
* Sparkd is built using **[CMakePresets][cmake presets]**
|
||||
|
||||
**Steps**
|
||||
1. Set up the **[Python virtual environment][py venv]**<br>
|
||||
* *Run commands from the repo root dir unless otherwise noted*
|
||||
1. Create the virtual environment
|
||||
```
|
||||
python3 -m venv .venv
|
||||
```
|
||||
2. Activate the virtual environment
|
||||
```
|
||||
. .venv/bin/activate
|
||||
```
|
||||
3. Verify `python` in the venv is first in the path<br>
|
||||
* ***Expected:** output shows the absolute path to `.venv/bin/python`*
|
||||
```
|
||||
which python
|
||||
```
|
||||
4. Update `pip`<br>
|
||||
* *The venv module initializes virtual environments with its own version
|
||||
of pip, rather than the system's version. Even if the latter is up-to-date, the
|
||||
former may not be.*
|
||||
```
|
||||
python -m pip install --upgrade pip
|
||||
```
|
||||
5. Install the packages listed `requirements.txt`
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
2. Build **Sparkd**<br>
|
||||
* From the terminal
|
||||
```
|
||||
tools/build_sparkd.sh
|
||||
```
|
||||
* *Run with `--help` to see available options*
|
||||
* From VS Code
|
||||
1. Install the **[CMake extension][cmake ext]**
|
||||
2. In the VS Code Command Palette, run **CMake: Select Configure
|
||||
Preset**, then select the **[preset][cmake presets]** you wish to
|
||||
build from the dropdown
|
||||
3. Run **CMake: Build** in the command palette.
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"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 +0,0 @@
|
||||
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)
|
||||
-1
Submodule docker/linux deleted from 6537812262.
@@ -1,98 +1,66 @@
|
||||
FROM ubuntu:latest
|
||||
FROM ubuntu:22.10
|
||||
|
||||
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 \
|
||||
RUN \
|
||||
apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
clang-13 \
|
||||
clang-format-13 \
|
||||
clangd-13 \
|
||||
clang-15 \
|
||||
clang-format-15 \
|
||||
clangd-15
|
||||
|
||||
# g++
|
||||
RUN apt-get update && apt-get install -y \
|
||||
clangd-15 \
|
||||
cmake \
|
||||
curl \
|
||||
dotnet7 \
|
||||
fish \
|
||||
g++-11 \
|
||||
g++-12
|
||||
|
||||
# python
|
||||
RUN apt-get update && apt-get install -y \
|
||||
g++-12 \
|
||||
gnupg \
|
||||
liblttng-ust-dev \
|
||||
libssh2-1-dev \
|
||||
libpcap0.8-dev \
|
||||
locales \
|
||||
ninja-build \
|
||||
nodejs \
|
||||
npm \
|
||||
openssh-server \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
&& python3 -m pip install --upgrade pip
|
||||
rapidjson-dev \
|
||||
software-properties-common \
|
||||
sqlite3 \
|
||||
sudo \
|
||||
tar \
|
||||
vim \
|
||||
wget
|
||||
|
||||
# dotnet
|
||||
RUN apt-get update && apt-get install -y \
|
||||
dotnet7
|
||||
|
||||
# ssh
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libssh2-1-dev \
|
||||
openssh-server
|
||||
|
||||
# cmake
|
||||
# this is done here so that ccache sees clang++ installed, not clang-10
|
||||
RUN \
|
||||
curl -fsSL https://apt.kitware.com/keys/kitware-archive-latest.asc 2> /dev/null \
|
||||
| gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg > /dev/null \
|
||||
&& apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y cmake
|
||||
apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y ccache
|
||||
|
||||
# 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 \
|
||||
# emumba deps
|
||||
RUN \
|
||||
apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
tzdata \
|
||||
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
|
||||
|
||||
# dev utils
|
||||
RUN apt-get update && apt-get install -y \
|
||||
fish \
|
||||
git-all \
|
||||
sudo \
|
||||
vim \
|
||||
wget
|
||||
libboost-date-time-dev \
|
||||
zlib1g-dev \
|
||||
netcat-traditional \
|
||||
net-tools \
|
||||
gdb gdbserver \
|
||||
pkg-config
|
||||
|
||||
# set up default executables (update-alternatives)
|
||||
RUN \
|
||||
|
||||
@@ -55,7 +55,7 @@ then select your container in the dropdown
|
||||
3. Push the new image to Docker Hub
|
||||
|
||||
```
|
||||
docker push bluetradingsystems/sparkd-dev:latest
|
||||
docker push johncolvin/bluetradingsystems:sparkd-dev
|
||||
```
|
||||
***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
|
||||
|
||||
@@ -116,8 +116,4 @@ if ! shopt -oq posix; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -v XDG_CONFIG_HOME ]]; then
|
||||
export XDG_CONFIG_HOME="$HOME/.config"
|
||||
fi
|
||||
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
@@ -1,6 +1,3 @@
|
||||
if ! set -q XDG_CONFIG_HOME
|
||||
set -g XDG_CONFIG_HOME "$HOME/.config"
|
||||
end
|
||||
set fish_config_home $XDG_CONFIG_HOME/fish
|
||||
if test -f "$fish_config_home/aliases.fish"
|
||||
source "$fish_config_home/aliases.fish"
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
{
|
||||
"image": "bluetradingsystems/sparkd-dev:latest",
|
||||
"initializeCommand": "${localWorkspaceFolder}/docker/sparkd/dev/devcontainer_initialize.sh",
|
||||
"hostRequirements": {
|
||||
"memory": "4gb",
|
||||
"storage": "6gb"
|
||||
},
|
||||
"postCreateCommand": "/home/bts/spark/docker/sparkd/dev/devcontainer_post_create.sh",
|
||||
"containerUser": "bts",
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/home/bts/spark,type=bind",
|
||||
@@ -15,8 +11,6 @@
|
||||
// unique set of ports. Usually we just add 1000 to each port as needed. For
|
||||
// example, if 8000-8003 is taken, go with 9000-9003, then 10000-10003, etc.
|
||||
"runArgs": [
|
||||
"--shm-size",
|
||||
"2gb",
|
||||
"-p",
|
||||
"8000:8000",
|
||||
"-p",
|
||||
|
||||
Submodule docker/windows deleted from de7d40c09d.
+1
-1
Submodule externals updated: 101e97a20c...4aaae5b1eb.
+1
-1
@@ -6,7 +6,7 @@ isort==5.9.3
|
||||
lazy-object-proxy==1.6.0
|
||||
mccabe==0.6.1
|
||||
platformdirs==2.3.0
|
||||
protobuf==3.19.1
|
||||
protobuf==4.21.12
|
||||
pybars3==0.9.7
|
||||
pycodestyle==2.7.0
|
||||
pycparser==2.20
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26730.10
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sparkd", "src\server\sparkd\sparkd.vcxproj", "{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspark", "build\src\lib\libspark.vcxproj", "{502FD050-679A-3B50-B438-098500700919}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
MinSizeRel|x64 = MinSizeRel|x64
|
||||
Release|x64 = Release|x64
|
||||
RelWithDebInfo|x64 = RelWithDebInfo|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.Debug|x64.Build.0 = Debug|x64
|
||||
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.MinSizeRel|x64.ActiveCfg = Release|x64
|
||||
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.MinSizeRel|x64.Build.0 = Release|x64
|
||||
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.Release|x64.ActiveCfg = Release|x64
|
||||
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.Release|x64.Build.0 = Release|x64
|
||||
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.RelWithDebInfo|x64.ActiveCfg = Release|x64
|
||||
{BBBAFD38-312D-4A8D-9AF0-F2BDEE72CE6F}.RelWithDebInfo|x64.Build.0 = Release|x64
|
||||
{502FD050-679A-3B50-B438-098500700919}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{502FD050-679A-3B50-B438-098500700919}.Debug|x64.Build.0 = Debug|x64
|
||||
{502FD050-679A-3B50-B438-098500700919}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
|
||||
{502FD050-679A-3B50-B438-098500700919}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
|
||||
{502FD050-679A-3B50-B438-098500700919}.Release|x64.ActiveCfg = Release|x64
|
||||
{502FD050-679A-3B50-B438-098500700919}.Release|x64.Build.0 = Release|x64
|
||||
{502FD050-679A-3B50-B438-098500700919}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
|
||||
{502FD050-679A-3B50-B438-098500700919}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {6A7249D7-B40C-4656-9347-60072D0B8FDB}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+1
-1
@@ -8,7 +8,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspark", "build\src\lib\l
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spark", "src\client\spark\Spark.csproj", "{9A4D4D07-1AB6-4B2B-B111-A4F34D6C267E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "sparkcmd", "src\client\sparkcmd\sparkcmd.csproj", "{387566C6-C6F6-412C-A30C-9855BBCB4816}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spark.Console", "src\client\Spark.Console\Spark.Console.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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(web)
|
||||
project(Spark.Admin.WebApp)
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/safe_dep_glob.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/Protobuf.cmake)
|
||||
@@ -24,45 +24,48 @@ file(
|
||||
${PROTO_GLOBS})
|
||||
|
||||
file(
|
||||
GLOB_RECURSE _api_ts_SOURCES
|
||||
GLOB_RECURSE _ts_SOURCES
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
api/src/*.ts)
|
||||
src/*.ts)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE _ui_fs_SOURCES
|
||||
GLOB_RECURSE _fs_SOURCES
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
ui/src/*.fs)
|
||||
src/*.fs)
|
||||
|
||||
set(_tools ${CMAKE_SOURCE_DIR}/tools)
|
||||
set(_quiet_exec ${_tools}/quiet_exec.sh)
|
||||
set(_venv_exec ${_tools}/venv_exec.sh)
|
||||
set(_tools_py ${CMAKE_SOURCE_DIR}/tools/py)
|
||||
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} _build_type)
|
||||
set(_tsconfig_base ${CMAKE_CURRENT_SOURCE_DIR}/api/tsconfig.${_build_type}.json)
|
||||
set(WEB_TSCONFIG_NAME "last" CACHE STRING "Name for the generated tsconfig file")
|
||||
set(_tsconfig "${CMAKE_CURRENT_SOURCE_DIR}/api/tsconfig.${WEB_TSCONFIG_NAME}.g.json")
|
||||
# The tsconfig file is generated as a function of the cmake build type, and
|
||||
# binary dir. Depending on the build type, it extends either
|
||||
# 'tsconfig.debug.json' or 'tsconfig.release.json'.
|
||||
set(_tsconfig_base "${CMAKE_CURRENT_SOURCE_DIR}/tsconfig.$<IF:$<CONFIG:Debug>,debug,release>.json")
|
||||
set(WEBPACK_MODE $<IF:$<CONFIG:Debug>,"development","production">)
|
||||
set(_tsconfig "${CMAKE_CURRENT_BINARY_DIR}/tsconfig.json")
|
||||
|
||||
set(_venv_python ${CMAKE_SOURCE_DIR}/.venv/bin/python)
|
||||
set(_gen_tsconfig_py ${_tools_py}/gen_tsconfig.py)
|
||||
set(_build_web_py ${_tools_py}/build_web.py)
|
||||
set(_build_admin_web_app_py ${_tools_py}/build_admin_web_app.py)
|
||||
|
||||
set(_gen_tsconfig_deps ${_venv_exec} ${_venv_python} ${_gen_tsconfig_py} ${_tsconfig_base})
|
||||
|
||||
set(_build_web_deps
|
||||
set(_build_admin_web_app_deps
|
||||
${_quiet_exec}
|
||||
${_venv_exec}
|
||||
${_venv_python}
|
||||
${_build_web_py}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ui/src/ui.fsproj
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ui/webpack.config.js
|
||||
${_build_admin_web_app_py}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Spark.Admin.WebApp.fsproj
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/webpack.config.js
|
||||
${CMAKE_SOURCE_DIR}/src/lib/api/service_compiler/templates/fs/fable.fs
|
||||
${CMAKE_SOURCE_DIR}/src/web/api/package-lock.json
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/package-lock.json
|
||||
${_proto_rel_SOURCES}
|
||||
${_api_ts_SOURCES}
|
||||
${_ui_fs_SOURCES}
|
||||
${_tsconfig})
|
||||
|
||||
update_deps_file("${_build_web_deps}")
|
||||
update_deps_file("${_build_admin_web_app_deps}")
|
||||
|
||||
function(npm_install path)
|
||||
add_custom_command(
|
||||
@@ -73,8 +76,7 @@ function(npm_install path)
|
||||
COMMENT "Run 'npm install' in ${path}")
|
||||
endfunction()
|
||||
|
||||
npm_install(${CMAKE_CURRENT_SOURCE_DIR}/api)
|
||||
npm_install(${CMAKE_CURRENT_SOURCE_DIR}/ui)
|
||||
npm_install(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${_tsconfig}
|
||||
@@ -84,22 +86,23 @@ add_custom_command(
|
||||
${_gen_tsconfig_py}
|
||||
--config-base ${_tsconfig_base}
|
||||
--config-out ${_tsconfig}
|
||||
--build-out ${CMAKE_BINARY_DIR}/web/api
|
||||
--build-out ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS ${_gen_tsconfig_deps})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/web/ui/bundle.js
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bundle.js
|
||||
COMMAND ${_quiet_exec}
|
||||
ARGS
|
||||
${_venv_exec}
|
||||
${_venv_python}
|
||||
${_build_web_py}
|
||||
${_build_admin_web_app_py}
|
||||
--protos ${_proto_abs_SOURCES}
|
||||
--tsconfig ${_tsconfig}
|
||||
--output-dir ${CMAKE_BINARY_DIR}/web
|
||||
COMMENT "Building Web UI"
|
||||
DEPENDS ${_build_web_deps})
|
||||
--mode ${WEBPACK_MODE}
|
||||
--output-dir ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Building Spark.Admin.WebApp"
|
||||
DEPENDS ${_build_admin_web_app_deps})
|
||||
|
||||
add_custom_target(web_ui_bundle ALL DEPENDS ${CMAKE_BINARY_DIR}/web/ui/bundle.js)
|
||||
add_custom_target(admin_web_app_bundle ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bundle.js)
|
||||
|
||||
install(DIRECTORY "${CMAKE_BINARY_DIR}/web" DESTINATION bin)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DESTINATION "${SPARK_INSTALL_PREFIX}/bin")
|
||||
File renamed without changes.
@@ -0,0 +1,21 @@
|
||||
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
|
||||
File renamed without changes.
File renamed without changes.
+7321
-152
File diff suppressed because it is too large.
Load diff
@@ -19,6 +19,8 @@
|
||||
"react-dom": "^18.2.0",
|
||||
"remotedev": "^0.2.9",
|
||||
"ts2fable": "^0.7.1",
|
||||
"tslib": "^2.5.0",
|
||||
"watch": "^1.0.2",
|
||||
"webpack": "^5.75.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -29,13 +31,19 @@
|
||||
"core-js": "^3.28.0",
|
||||
"css-loader": "^6.7.3",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"jest": "^29.4.3",
|
||||
"mini-css-extract-plugin": "^2.7.2",
|
||||
"npx": "^10.2.2",
|
||||
"protobufjs-cli": "^1.1.1",
|
||||
"sass": "^1.58.3",
|
||||
"sass-loader": "^13.2.0",
|
||||
"style-loader": "^3.3.1",
|
||||
"tslib": "^2.5.0",
|
||||
"ts-jest": "^29.0.5",
|
||||
"ts-loader": "^9.4.2",
|
||||
"tsutils": "^3.21.0",
|
||||
"typescript": "^4.9.5",
|
||||
"webpack-cli": "^5.0.1",
|
||||
"webpack-dev-server": "^4.11.1"
|
||||
"webpack-dev-server": "^4.11.1",
|
||||
"ws": "^8.12.1"
|
||||
}
|
||||
}
|
||||
Vendored
File renamed without changes.
File renamed without changes.
File renamed without changes.
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -4,8 +4,8 @@
|
||||
<title>BTS Spark Admin</title>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="shortcut icon" type="image/ico" href="img/favicon.ico" />
|
||||
<link rel="stylesheet" href="font-awesome.min.css" />
|
||||
<link rel="shortcut icon" type="image/ico" href="public/img/favicon.ico" />
|
||||
<link rel="stylesheet" href="public/font-awesome.min.css" />
|
||||
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=es6"></script>
|
||||
</head>
|
||||
<body>
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -52,7 +52,7 @@ let update msg model =
|
||||
// View
|
||||
|
||||
let root model dispatch =
|
||||
let sparkImg = "img/BTS-300.png"
|
||||
let sparkImg = "public/img/BTS-300.png"
|
||||
let handler msg (ev:Browser.Types.Event) =
|
||||
!!ev.target?value |> msg |> dispatch
|
||||
section [ ClassName "hero is-fullheight is-primary" ] [
|
||||
File renamed without changes.
File renamed without changes.
@@ -5,14 +5,14 @@
|
||||
<AssemblyVersion>1.0.0</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(WEB_BUILD_PATH)'==''">
|
||||
<When Condition="'$(SPARK_ADMIN_WEB_APP_OUTPUT_DIR)'==''">
|
||||
<PropertyGroup>
|
||||
<API>../../../../build/web/api</API>
|
||||
<API>../../../build/Spark.Admin.WebApp</API>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<PropertyGroup>
|
||||
<API>$(WEB_BUILD_PATH)/api</API>
|
||||
<API>$(SPARK_ADMIN_WEB_APP_OUTPUT_DIR)</API>
|
||||
</PropertyGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -25,9 +25,9 @@ process.env.NODE_ENV = isProduction ? 'production' : 'development'
|
||||
console.log("Bundling for " + (isProduction ? "production" : "development") + "...");
|
||||
|
||||
module.exports = env => {
|
||||
const build_path = process.env.WEB_BUILD_PATH
|
||||
const output_path = build_path + "/ui/";
|
||||
const api_path = build_path + "/api/";
|
||||
const build_path = process.env.SPARK_ADMIN_WEB_APP_OUTPUT_DIR
|
||||
const output_path = build_path
|
||||
const api_path = build_path
|
||||
return {
|
||||
watchOptions: {
|
||||
ignored: "./**/*"
|
||||
@@ -58,6 +58,12 @@ module.exports = env => {
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.([cm]?ts|tsx)$/,
|
||||
use: [
|
||||
"ts-loader"
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
@@ -1,94 +0,0 @@
|
||||
<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="protoc-gen-service=$(ProtocPluginBase)\plugin.cmd" ^
|
||||
--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>
|
||||
@@ -4,7 +4,6 @@
|
||||
<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>
|
||||
@@ -16,13 +15,25 @@
|
||||
<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>
|
||||
<GenDir>$(BaseOutputPath)\gen\$(MSBuildProjectName)</GenDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import
|
||||
@@ -31,25 +42,41 @@
|
||||
|
||||
<PropertyGroup Label="ProtoBuf">
|
||||
<ProtocPluginBase>$(SparkRoot)\src\lib\api\service_compiler</ProtocPluginBase>
|
||||
<protoc>$(Externals)\bin\protoc.exe</protoc>
|
||||
<protogen>$(Externals)\bin\protogen.exe</protogen>
|
||||
</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>
|
||||
<Proto2></Proto2>
|
||||
<!--
|
||||
Each .proto 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
|
||||
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:
|
||||
<Proto3 Include="foo_bar.proto" CSName="FooBar" />
|
||||
-->
|
||||
<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>
|
||||
<OutDir>$(ProtoOutputPath)/</OutDir>
|
||||
<CSName>%(FileName)</CSName>
|
||||
</Proto3>
|
||||
<Proto3Excel>
|
||||
<OutBase>$(IntermediateOutputPath)\gen\%(relativedir)</OutBase>
|
||||
<OutCSExcel>%(OutBase)%(FileName).excel.pb.cs</OutCSExcel>
|
||||
<CompileOptions></CompileOptions>
|
||||
</Proto3Excel>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,68 @@
|
||||
<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="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.OutDir)/%(Proto3.CSName).cs;
|
||||
%(Proto3.OutDir)/%(Proto3.FileName).client.pb.cs;
|
||||
%(Proto3.OutDir)/%(Proto3.FileName).server.pb.cs;
|
||||
%(Proto3.OutDir)/%(Proto3.FileName).immutable.pb.cs">
|
||||
<MakeDir Directories="%(Proto3.OutDir)" />
|
||||
|
||||
<Message
|
||||
Importance="High"
|
||||
Text="Generating service %(Proto3.FileName)" />
|
||||
|
||||
<PropertyGroup>
|
||||
<GenProtosCmd>$(protoc) %(Proto3.FullPath)</GenProtosCmd>
|
||||
<GenProtosCmd>$(GenProtosCmd) --error_format=msvs</GenProtosCmd>
|
||||
<GenProtosCmd>$(GenProtosCmd) --proto_path=$(SourceRoot)</GenProtosCmd>
|
||||
<GenProtosCmd>$(GenProtosCmd) --plugin="protoc-gen-service=$(ProtocPlugin)"</GenProtosCmd>
|
||||
<GenProtosCmd>$(GenProtosCmd) --service_out=lang=c#,strip_out_path=1:%(Proto3.OutDir)</GenProtosCmd>
|
||||
<GenProtosCmd>$(GenProtosCmd) --csharp_out=%(Proto3.OutDir)</GenProtosCmd>
|
||||
</PropertyGroup>
|
||||
<Exec Command="$(GenProtosCmd)" WorkingDirectory="%(Proto3.RelativeDir)" />
|
||||
<ItemGroup>
|
||||
<Compile Include="%(Proto3.OutDir)/%(Proto3.CSName).cs" />
|
||||
<Compile Include="%(Proto3.OutDir)/%(Proto3.FileName).client.pb.cs" />
|
||||
<Compile Include="%(Proto3.OutDir)/%(Proto3.FileName).server.pb.cs" />
|
||||
<Compile Include="%(Proto3.OutDir)/%(Proto3.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="AfterClean"
|
||||
AfterTargets="Clean">
|
||||
<Delete Files="%(Proto3.OutDir)/%(Proto3.CSName).cs" />
|
||||
<Delete Files="%(Proto3.OutDir)/%(Proto3.FileName).client.pb.cs" />
|
||||
<Delete Files="%(Proto3.OutDir)/%(Proto3.FileName).server.pb.cs" />
|
||||
<Delete Files="%(Proto3.OutDir)/%(Proto3.FileName).immutable.pb.cs" />
|
||||
</Target>
|
||||
|
||||
<Target
|
||||
Name="Test"
|
||||
DependsOnTargets="Build"></Target>
|
||||
|
||||
</Project>
|
||||
@@ -3,6 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net7.0</TargetFrameworks>
|
||||
<Nullable>enable</Nullable>
|
||||
<RuntimeIdentifiers>win10-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
|
||||
<Authors>Blue Trading Systems</Authors>
|
||||
<Company>Blue Trading Systems</Company>
|
||||
@@ -14,10 +15,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../spark_api/spark_api.csproj" />
|
||||
<!--<ProjectReference Include="..\spark\Spark.csproj" />-->
|
||||
<ProjectReference Include="..\spark_core\spark_core.csproj" />
|
||||
<ProjectReference Include="..\spark_test\spark_test.csproj" />
|
||||
<!--<Proto3 Include="**/*.proto" />-->
|
||||
<ProjectReference Include="../spark_core/spark_core.csproj" />
|
||||
<ProjectReference Include="../spark_test/spark_test.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace Spark.Console {
|
||||
using bts;
|
||||
|
||||
using mbts.config;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
class ConfigCommand {
|
||||
public static int run(ConfigCommandOptions opts) {
|
||||
if (opts.sparkd is not null) {
|
||||
var args = Environment.GetCommandLineArgs();
|
||||
BTS.set_config_arg(args, 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
+159
-168
@@ -1,168 +1,159 @@
|
||||
using bts.api;
|
||||
using bts.api.core;
|
||||
using bts.api.orderman;
|
||||
using bts.co2;
|
||||
using bts.test;
|
||||
using CommandLine;
|
||||
using mbts.co2;
|
||||
using mbts.config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bts {
|
||||
|
||||
[Verb("orderstress", 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; }
|
||||
};
|
||||
|
||||
public struct Market {
|
||||
public SecurityImmutable security;
|
||||
public IntPrice? bid;
|
||||
public IntPrice? ask;
|
||||
}
|
||||
|
||||
public static class OrderStress {
|
||||
static IEnumerable<Market> all_markets(ServiceContext ctx) {
|
||||
var channels =
|
||||
UserSymbol.get_all()
|
||||
.Select(u =>
|
||||
new SecurityChannel() {
|
||||
Time = 0,
|
||||
Flags = (int)(MDRequest.Types.Flags.Direct | MDRequest.Types.Flags.Implied),
|
||||
Type = u.type,
|
||||
Symbol = u.symbol,
|
||||
Exchange = u.exchange
|
||||
}
|
||||
);
|
||||
var request = new MDRequest() { Host = "system_test" };
|
||||
request.Channels.AddRange(channels);
|
||||
|
||||
var relay = ctx.locate<MarketDataRelay>();
|
||||
System.Threading.Thread.Sleep(100);
|
||||
var result = relay.requestmd(request);
|
||||
|
||||
foreach (var ch in result.Channels) {
|
||||
// if (ch.Platform != Platform.Sim) continue;
|
||||
foreach (var update in ch.Updates) {
|
||||
if (update.Security != null) {
|
||||
var m = new Market() {
|
||||
security = new SecurityImmutable(update.Security),
|
||||
bid = best(
|
||||
(a,b) => a > b ? a : b,
|
||||
update.Direct?.Bids?.FirstOrDefault(), update.Implied?.Bids?.FirstOrDefault()),
|
||||
ask = best(
|
||||
(a,b) => a < b ? a : b,
|
||||
update.Direct?.Asks?.FirstOrDefault(), update.Implied?.Asks?.FirstOrDefault())
|
||||
};
|
||||
if (m.bid.HasValue || m.ask.HasValue) {
|
||||
yield return m;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPrice? best(Func<IntPrice, IntPrice,IntPrice> comp, params PriceSizeMessage[] ps) {
|
||||
IntPrice? result = null;
|
||||
foreach (var p in ps) {
|
||||
if (p != null) {
|
||||
var ip = new IntPrice(p.Mantissa, (sbyte)p.Exponent);
|
||||
if (result == null) {
|
||||
result = ip;
|
||||
}
|
||||
else {
|
||||
result = comp(result.Value, ip);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static Create mkorder(uint security, double price, uint size, Side side) {
|
||||
return new Create {
|
||||
Price = price,
|
||||
Quantity = size,
|
||||
NewOrder = new OrderDefinition {
|
||||
SecurityKey = security,
|
||||
Side = side,
|
||||
TimeInForce = TimeInForce.Day,
|
||||
ManualOrderIndicator = ManualOrderIndicator.Yes,
|
||||
CtiCode = CTICode.CtiCode1,
|
||||
CustomerOrFirm = CustomerOrFirm.Firm,
|
||||
AccountId = 1,
|
||||
UserId = 1,
|
||||
CustomDef = new CustomOrderDefinition {
|
||||
Limit = new LimitOrderDefinition()
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static int Run(OrderStressOptions o) {
|
||||
|
||||
var ctx = new ServiceContext();
|
||||
ConsoleEx.WriteLine("Please log in to Spark", ConsoleColor.Yellow);
|
||||
ConsoleEx.Write("Username: ", ConsoleColor.Yellow);
|
||||
var name = Console.ReadLine();
|
||||
ConsoleEx.Write("Password: ", ConsoleColor.Yellow);
|
||||
var pw = Console.ReadLine();
|
||||
|
||||
var login_result = ctx.login(name, pw);
|
||||
if (!login_result.Result.success) {
|
||||
ConsoleEx.WriteLine("Invalid Credentials", ConsoleColor.Red);
|
||||
}
|
||||
|
||||
if (Configuration.get<config.DeploymentType>().type.ToUpper() == "PROD") {
|
||||
ConsoleEx.WriteLine("Refusing to run on production system", ConsoleColor.Red);
|
||||
return -1;
|
||||
}
|
||||
|
||||
var orders = ctx.locate<OrderService>();
|
||||
var factor = TimeSpan.TicksPerMillisecond / 1000;
|
||||
foreach (var m in all_markets(ctx)) {
|
||||
ConsoleEx.WriteLine(m.security.security_desc(), ConsoleColor.White);
|
||||
var tick = m.security.ContractSpec.LowTick;
|
||||
if (m.ask.HasValue) {
|
||||
for (var x = 0; x < o.depth; ++x) {
|
||||
var price = m.ask.Value.price() + (tick * x);
|
||||
ConsoleEx.WriteLine($"Sell {o.quantity} at {price}", ConsoleColor.Red);
|
||||
var sw = new System.Diagnostics.Stopwatch();
|
||||
sw.Start();
|
||||
var r = orders.create_order(mkorder(m.security.Id, price, o.quantity, Side.Sell));
|
||||
sw.Stop();
|
||||
// Log.Api.info($"Order: id {r.OrderKey} time {sw.ElapsedTicks/factor}us");
|
||||
Log.Api.info($"Order {m.security.security_desc()}: id {r.OrderKey} {r.ErrorCode} time {sw.ElapsedTicks/factor}us");
|
||||
System.Threading.Thread.Sleep(o.sleep);
|
||||
}
|
||||
}
|
||||
if (m.bid.HasValue) {
|
||||
// start at bid and place 1 order at 10 levels
|
||||
for (var x=0; x < o.depth; ++x) {
|
||||
var price = m.bid.Value.price() - (tick * x);
|
||||
ConsoleEx.WriteLine($"Buy {o.quantity} at {price}", ConsoleColor.Blue);
|
||||
var sw = new System.Diagnostics.Stopwatch();
|
||||
sw.Start();
|
||||
var r = orders.create_order(mkorder(m.security.Id, price, o.quantity, Side.Buy));
|
||||
sw.Stop();
|
||||
Log.Api.info($"Order {m.security.security_desc()}: id {r.OrderKey} {r.ErrorCode} time {sw.ElapsedTicks/factor}us");
|
||||
System.Threading.Thread.Sleep(o.sleep);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
namespace Spark.Console {
|
||||
using bts;
|
||||
using bts.api;
|
||||
using bts.api.core;
|
||||
using bts.api.orderman;
|
||||
using bts.co2;
|
||||
using bts.config;
|
||||
using bts.test;
|
||||
|
||||
using mbts.co2;
|
||||
using mbts.config;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
static class OrderStressCommand {
|
||||
public static int run(OrderStressOptions o) {
|
||||
var ctx = new ServiceContext();
|
||||
ConsoleEx.WriteLine("Please log in to Spark", ConsoleColor.Yellow);
|
||||
var name = ConsoleEx.prompt("Username: ", ConsoleColor.Yellow);
|
||||
var pw = ConsoleEx.prompt("Password: ", ConsoleColor.Yellow);
|
||||
|
||||
var login_result = ctx.login(name, pw);
|
||||
if (!login_result.Result.success) {
|
||||
ConsoleEx.WriteLine("Invalid Credentials", ConsoleColor.Red);
|
||||
}
|
||||
|
||||
if (Configuration.get<DeploymentType>().Type.ToUpper() == "PROD") {
|
||||
ConsoleEx.WriteLine("Refusing to run on production system", ConsoleColor.Red);
|
||||
return -1;
|
||||
}
|
||||
|
||||
var orders = ctx.locate<OrderService>();
|
||||
var factor = TimeSpan.TicksPerMillisecond / 1000;
|
||||
|
||||
string fmt_order(Market m, Response r, long elapsed_ticks) =>
|
||||
$"Order {m.security.security_desc()}. id: {r.OrderKey}; err: {r.ErrorCode}; " +
|
||||
$"time: {elapsed_ticks / factor}us";
|
||||
|
||||
foreach (var m in _all_markets(ctx)) {
|
||||
ConsoleEx.WriteLine(m.security.security_desc(), ConsoleColor.White);
|
||||
var tick = m.security.ContractSpec.LowTick;
|
||||
if (m.ask.HasValue) {
|
||||
for (var x = 0; x < o.depth; ++x) {
|
||||
var price = m.ask.Value.price() + (tick * x);
|
||||
ConsoleEx.WriteLine($"Sell {o.quantity} at {price}", ConsoleColor.Red);
|
||||
var sw = new Stopwatch();
|
||||
sw.Start();
|
||||
var r = orders.create_order(_mkorder(m.security.Id, price, o.quantity, Side.Sell));
|
||||
sw.Stop();
|
||||
Log.Api.info(fmt_order(m, r, sw.ElapsedTicks));
|
||||
Thread.Sleep(o.sleep);
|
||||
}
|
||||
}
|
||||
if (m.bid.HasValue) {
|
||||
// start at bid and place 1 order at 10 levels
|
||||
for (var x = 0; x < o.depth; ++x) {
|
||||
var price = m.bid.Value.price() - (tick * x);
|
||||
ConsoleEx.WriteLine($"Buy {o.quantity} at {price}", ConsoleColor.Blue);
|
||||
var sw = new Stopwatch();
|
||||
sw.Start();
|
||||
var r = orders.create_order(_mkorder(m.security.Id, price, o.quantity, Side.Buy));
|
||||
sw.Stop();
|
||||
Log.Api.info(fmt_order(m, r, sw.ElapsedTicks));
|
||||
Thread.Sleep(o.sleep);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
static IEnumerable<Market> _all_markets(ServiceContext ctx) {
|
||||
var channels =
|
||||
UserSymbol.get_all()
|
||||
.Select(u =>
|
||||
new SecurityChannel() {
|
||||
Time = 0,
|
||||
Flags = (int)(MDRequest.Types.Flags.Direct | MDRequest.Types.Flags.Implied),
|
||||
Type = u.type,
|
||||
Symbol = u.symbol,
|
||||
Exchange = u.exchange
|
||||
}
|
||||
);
|
||||
var request = new MDRequest() { Host = "system_test" };
|
||||
request.Channels.AddRange(channels);
|
||||
|
||||
var relay = ctx.locate<MarketDataRelay>();
|
||||
Thread.Sleep(100);
|
||||
var result = relay.requestmd(request);
|
||||
|
||||
foreach (var ch in result.Channels) {
|
||||
// if (ch.Platform != Platform.Sim) continue;
|
||||
foreach (var update in ch.Updates) {
|
||||
if (update.Security != null) {
|
||||
var m = new Market() {
|
||||
security = new SecurityImmutable(update.Security),
|
||||
bid = _best(
|
||||
(a, b) => a > b ? a : b,
|
||||
update.Direct.Bids.FirstOrDefault(),
|
||||
update.Implied.Bids.FirstOrDefault()),
|
||||
ask = _best(
|
||||
(a, b) => a < b ? a : b,
|
||||
update.Direct.Asks.FirstOrDefault(),
|
||||
update.Implied.Asks.FirstOrDefault())
|
||||
};
|
||||
if (m.bid.HasValue || m.ask.HasValue) {
|
||||
yield return m;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static IntPrice? _best(
|
||||
Func<IntPrice, IntPrice, IntPrice> comp, params PriceSizeMessage?[] ps) {
|
||||
IntPrice? result = null;
|
||||
foreach (var p in ps) {
|
||||
if (p != null) {
|
||||
var ip = new IntPrice(p.Mantissa, (sbyte)p.Exponent);
|
||||
if (result == null) {
|
||||
result = ip;
|
||||
} else {
|
||||
result = comp(result.Value, ip);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static Create _mkorder(uint security, double price, uint size, Side side) {
|
||||
return new Create {
|
||||
Price = price,
|
||||
Quantity = size,
|
||||
NewOrder = new OrderDefinition {
|
||||
SecurityKey = security,
|
||||
Side = side,
|
||||
TimeInForce = TimeInForce.Day,
|
||||
ManualOrderIndicator = ManualOrderIndicator.Yes,
|
||||
CtiCode = CTICode.CtiCode1,
|
||||
CustomerOrFirm = CustomerOrFirm.Firm,
|
||||
AccountId = 1,
|
||||
UserId = 1,
|
||||
CustomDef = new CustomOrderDefinition {
|
||||
Limit = new LimitOrderDefinition()
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
struct Market {
|
||||
public SecurityImmutable security;
|
||||
public IntPrice? bid;
|
||||
public IntPrice? ask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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; }
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Spark.Console {
|
||||
using CommandLine;
|
||||
|
||||
[Verb("settings", HelpText = "Copy workspaces around")]
|
||||
class SettingsCommandOptions { }
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
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();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
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 = 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ namespace mbts.spark {
|
||||
using bts.api;
|
||||
using bts.api.analytics;
|
||||
using bts.collections;
|
||||
using bts.reactive;
|
||||
using bts.utils;
|
||||
|
||||
using mbts;
|
||||
@@ -17,7 +18,6 @@ namespace mbts.spark {
|
||||
using Spark.Core;
|
||||
using Spark.Core.Collections;
|
||||
using Spark.Core.Disposables;
|
||||
using Spark.Core.Reactive;
|
||||
using Spark.ViewModel.Commands;
|
||||
|
||||
using System;
|
||||
|
||||
Loaded 100 of 1444 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user