Merging the proj files changes

This commit is contained in:
Taha Afzal committed 2017-09-18 12:49:07 -04:00
commit a5b10cec12
32 files changed
+2067 -2032

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
# generated by make process
set(sources api/apicore.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/services/ApiUnitTestService.proto;api/services/HelloService.proto;api/services/MarketDataRelay.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/UserService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/Account.proto;config/protos/Executor.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Securities.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/User.proto;config/protos/environment.proto;config/protos/expiration_display_offset.proto;config/protos/jetfix.proto;config/protos/logging.proto;config/protos/quickbus_cfg.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.proto;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPriceLantencyTester.cpp;md/Diag/ShmDumper.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MDRecoverableConsumer.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/SecurityIDRecorder.cpp;md/SettlementRecorder.cpp;md/Structure/FixedSecurity.cpp;md/Structure/PriceSize.cpp;md/common.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/test/Co2TestInstrument.cpp;md/test/md2_tests.cpp;order_man/protos/OrderMan.proto;os/Win32Exception.cpp;os/os.cpp;os/tests/os_tests.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;security_model/SecurityHelper.cpp;security_model/old_security.proto;sparkproto/SparkProtos.proto;testing/windows_test_driver.cpp;utils/Dispatcher.cpp;utils/HTTPStream.cpp;utils/PBUtils.cpp;utils/Puid.cpp;utils/SharedMemory.cpp;utils/Sqlite_utils.cpp;utils/Uuid.cpp;utils/datetime.cpp;utils/file_utils.cpp;utils/init_spark_lib.cpp;utils/is_unittest_environment.cpp)
+34 -169
View File
@@ -1,160 +1,32 @@
cmake_minimum_required(VERSION 3.5)
project(spark_lib)
# config protos
set (Config_Protos
config/protos/system.proto
config/protos/testkeys.proto
config/protos/logging.proto
config/protos/quickbus_cfg.proto
config/protos/jetfix.proto
config/protos/MarketData.proto
config/protos/Symbols.proto
config/protos/Ports.proto
config/protos/Executor.proto
config/protos/User.proto
config/protos/UI.proto
config/protos/toggles.proto
config/protos/environment.proto
)
# non config/non service protos
set (NonConfig_Protos
config/invalid/invalid.proto
config/extensions/extensions.proto
quickbus/network/quickbus_msgs.proto
security_model/old_security.proto
domain_model/Security.proto
api/apicore.proto
api/apioptions.proto
sparkproto/SparkProtos.proto
md/protos/co2.proto
)
# service protos
set (Service_Protos
api/services/ApiUnitTestService.proto
api/services/HelloService.proto
api/services/PersistenceService.proto
api/services/UserService.proto
api/services/MarketDataRelay.proto
api/services/OrderService.proto
)
include(${CMAKE_SOURCE_DIR}/tools/safe_dep_glob.cmake)
include(${CMAKE_SOURCE_DIR}/tools/Protobuf.cmake)
# DEPENDENCIES
# config protos
file(GLOB_RECURSE Config_Protos RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} config/protos/*.proto)
# service protos
file (GLOB_RECURSE Service_Protos RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} api/services/*.proto)
# non config/non service protos
file(GLOB_RECURSE NonConfig_Protos RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.proto)
list(REMOVE_ITEM NonConfig_Protos ${Service_Protos} ${Config_Protos})
# normal cpps
file(GLOB_RECURSE SparkLib_Sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
# this is used to communicate to other repositories that the build
# needs to happen again (because a file was added)
update_deps_file("${SparkLib_Sources};${Config_Protos};${Service_Protos};${NonConfig_Protos}")
# END DEPENDENCIES
protobuf_generate_cpp( PROTO_SRCS PROTO_HDRS ${NonConfig_Protos} ${Config_Protos})
service_compiler_generate_cpp(SERVICE_COMPILER_SRCS SERVICE_COMPILER_HDRS ${Service_Protos})
# srcs for sparkd
set (SparkLib_Sources
# api
api/core/ApiClientInterop.cpp
api/core/ApiServerInterop.cpp
api/public/ApiServer.cpp
api/public/ClientChannel.cpp
api/public/QuickbusClientChannel.cpp
api/public/ServerChannel.cpp
api/public/ServiceContext.cpp
api/test/ApiTests.cpp
api/test/HelloServiceServer.cpp
# expression
expression/BooleanGrammar.cpp
expression/ExpressionEvaluator.cpp
expression/ParserExceptions.cpp
expression/Value.cpp
# config
config/config.cpp
config/ConfigDownloader.cpp
config/ConfigErrorCollector.cpp
config/ConfigLog.cpp
config/ConfigPropertyEvaluator.cpp
config/ConfigurationException.cpp
config/ConfigurationState.cpp
config/ConfigValueQueue.cpp
config/PreprocessInputStream.cpp
config/ConfigCheck.cpp
config/text_format/text_format.cpp
config/tests/config_ref_tests.cpp
config/tests/HTTPServer.cpp
config/tests/config_tests.cpp
# quickbus
quickbus/core/LocalNode.cpp
quickbus/core/Quickbus.cpp
quickbus/core/SubscriptionID.cpp
quickbus/core/TableID.cpp
quickbus/message_model/Update.cpp
quickbus/message_model/merge_updates.cpp
quickbus/network/QBConnection.cpp
quickbus/network/QBConnectionManager.cpp
quickbus/network/endpoint_description.cpp
quickbus/pubsub/TablePublisher.cpp
quickbus/pubsub/TableSubscriber.cpp
quickbus/pubsub/tests/qb_pubsub_tests.cpp
quickbus/routing/INode.cpp
quickbus/routing/NodeID.cpp
quickbus/routing/Router.cpp
quickbus/rpc/RPCClient.cpp
quickbus/rpc/RPCServer.cpp
quickbus/rpc/RPCSessionID.cpp
quickbus/rpc/rpc_utils.cpp
quickbus/rpc/tests/qb_rpc_tests.cpp
quickbus/tests/quickbus_tests.cpp
# md
md/MDConsumer.cpp
md/MDConsumerHandle.cpp
md/MDConsumerInterop.cpp
md/MDProducer.cpp
md/MDProducerHandle.cpp
md/MDRecoverableConsumer.cpp
md/MemorySegmentUtils.cpp
md/PlatformLoader.cpp
md/SecurityIDRecorder.cpp
md/SettlementRecorder.cpp
md/common.cpp
md/relay/QueryServer.cpp
md/relay/RelayClient.cpp
md/relay/RelayRecorder.cpp
md/Structure/FixedSecurity.cpp
md/Structure/PriceSize.cpp
md/Diag/MDPriceLantencyTester.cpp
md/Diag/ShmDumper.cpp
md/test/Co2TestInstrument.cpp
md/test/md2_tests.cpp
# OS
os/os.cpp
#logging
logging/logging.cpp
logging/tests/logging_tests.cpp
logging/LoggerHub.cpp
logging/Sink.cpp
# misc utils
utils/is_unittest_environment.cpp
utils/datetime.cpp
utils/PBUtils.cpp
utils/Uuid.cpp
utils/file_utils.cpp
utils/HTTPStream.cpp
utils/SharedMemory.cpp
utils/Dispatcher.cpp
utils/Sqlite_utils.cpp
utils/init_spark_lib.cpp
utils/Puid.cpp
# security model
security_model/SecurityHelper.cpp
# testing
testing/windows_test_driver.cpp
)
# generate list of config protos
set(config_proto_file ${CMAKE_CURRENT_BINARY_DIR}/config_proto_files.h)
file(REMOVE ${config_proto_file})
@@ -166,28 +38,23 @@ foreach(protopath ${Config_Protos})
endforeach(protopath)
file(APPEND ${config_proto_file} "};\n")
# spark_lib
if (WIN32)
add_library(spark_lib SHARED
${SparkLib_Sources}
${PROTO_SRCS}
${SERVICE_COMPILER_SRCS}
)
add_library(spark_lib SHARED
${SparkLib_Sources}
${PROTO_SRCS}
${SERVICE_COMPILER_SRCS}
)
else ()
add_library(spark_lib STATIC
${SparkLib_Sources}
${PROTO_SRCS}
${SERVICE_COMPILER_SRCS}
)
add_library(spark_lib STATIC
${SparkLib_Sources}
${PROTO_SRCS}
${SERVICE_COMPILER_SRCS}
)
endif()
#include paths
target_include_directories( spark_lib PUBLIC
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src
)
target_include_directories( spark_lib PUBLIC ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src)
if (WIN32)
target_link_libraries( spark_lib
@@ -224,9 +91,7 @@ else ()
-static-libstdc++
-pthread)
endif()
if (WIN32)
include(${CMAKE_SOURCE_DIR}/tools/vs_filters.cmake)
endif()
+42
View File
@@ -0,0 +1,42 @@
AccountCfg
{
value
{
accounts
{
account
{
account_id: 'TAG1'
can_trade: true
cash_position: 1000000.0
leverage_factor: 1.0
allowed_operators
{
id: 'TAG50'
}
}
limits
{
key: 'ES'
value
{
max_order_size: 100
max_position_long: 1000
max_position_short: 1000
max_position_net: 1000
}
}
limits
{
key: 'GC'
value
{
max_order_size: 100
max_position_long: 1000
max_position_short: 1000
max_position_net: 1000
}
}
}
}
}
+21 -2
View File
@@ -1,6 +1,25 @@
UserCfg {
value {
UserCfg
{
value
{
user { login: "bts" password: "" }
user { login: "bts2" password: "bts2" }
user
{
login: 'bts3'
password: ''
is_admin: true
operators
{
operator_id { id: 'TAG50' }
can_trade: true
}
operators
{
operator_id { id: 'TAG50_' }
can_trade: true
}
}
}
}
+35
View File
@@ -0,0 +1,35 @@
syntax='proto2';
package bts.config;
import "lib/config/protos/User.proto";
message RiskLimit
{
optional uint32 max_order_size = 10;
optional uint32 max_position_long = 20;
optional uint32 max_position_short = 30;
optional uint32 max_position_net = 40;
optional double max_order_price = 50;
}
message Account
{
optional string account_id = 10; //tag 1
optional bool can_trade = 15;
optional double cash_position = 20;
optional double leverage_factor = 30;
repeated OperatorID allowed_operators = 100;
}
message AccountWithLimits
{
optional Account account = 10;
//Per SYMBOL risk limits. They want to set how many Corn Futures and Spreads, not how many December Corn futures and
map<string, RiskLimit> limits = 20;
}
message AccountCfg
{
repeated AccountWithLimits accounts = 10;
}
+21 -5
View File
@@ -1,11 +1,27 @@
syntax='proto2';
package bts.config;
message User {
required string login = 1;
optional string password = 2;
message OperatorID
{
optional string id = 10; //tag 50, 18 bytes limit
}
message UserCfg {
repeated User user = 1;
message Operator
{
optional OperatorID operator_id = 10;
optional bool can_trade = 20;
}
message User
{
required string login = 1;
optional string password = 2;
optional bool is_admin = 10;
repeated Operator operators = 100;
}
message UserCfg
{
repeated User user = 1;
}
@@ -1,179 +1,179 @@
#include "core/bts_core/utest/utest.h"
// #include "core/bts_core/utest/utest.h"
#include "../IPropertyEvaluator.h"
#include "../ExpressionEvaluator.h"
#include "../ParserExceptions.h"
// #include "../IPropertyEvaluator.h"
// #include "../ExpressionEvaluator.h"
// #include "../ParserExceptions.h"
#include "core/bts_core/utils/BTS_SharedPtr.h"
#include <utility>
// #include "core/bts_core/utils/BTS_SharedPtr.h"
// #include <utility>
using namespace bts::expression;
// using namespace bts::expression;
namespace bts {
// namespace bts {
// Simple property evaluator for testing
class EvaluatesToFoo : public IPropertyEvaluator
{
public:
EvaluatesToFoo()
{ }
~EvaluatesToFoo()
{ }
BTS_NO_COPY(EvaluatesToFoo);
// // Simple property evaluator for testing
// class EvaluatesToFoo : public IPropertyEvaluator
// {
// public:
// EvaluatesToFoo()
// { }
// ~EvaluatesToFoo()
// { }
// BTS_NO_COPY(EvaluatesToFoo);
bool get_value(const std::string& prop, Value* out_value) OVERRIDE
{
bool valid = prop.substr(0,3) == "Foo";
if (valid && out_value != nullptr)
{
if (prop == "Foo.number")
{
*out_value = Value(42.0);
}
else if (prop == "Foo.list")
{
std::vector<Value> values;
values.push_back(Value(std::string("foo")));
values.push_back(Value(std::string("bar")));
values.push_back(Value(std::string("baz")));
*out_value = Value(values);
}
else if (prop == "Foo.bool")
{
*out_value = Value(true);
}
else
{
// Foo.*
*out_value = Value(std::string("Foo"));
}
}
// bool get_value(const std::string& prop, Value* out_value) OVERRIDE
// {
// bool valid = prop.substr(0,3) == "Foo";
// if (valid && out_value != nullptr)
// {
// if (prop == "Foo.number")
// {
// *out_value = Value(42.0);
// }
// else if (prop == "Foo.list")
// {
// std::vector<Value> values;
// values.push_back(Value(std::string("foo")));
// values.push_back(Value(std::string("bar")));
// values.push_back(Value(std::string("baz")));
// *out_value = Value(values);
// }
// else if (prop == "Foo.bool")
// {
// *out_value = Value(true);
// }
// else
// {
// // Foo.*
// *out_value = Value(std::string("Foo"));
// }
// }
return valid;
}
};
// return valid;
// }
// };
class EvaluatesRecursively : public IPropertyEvaluator
{
public:
EvaluatesRecursively()
: _e(nullptr)
{ }
~EvaluatesRecursively()
{ }
BTS_NO_COPY(EvaluatesRecursively);
// class EvaluatesRecursively : public IPropertyEvaluator
// {
// public:
// EvaluatesRecursively()
// : _e(nullptr)
// { }
// ~EvaluatesRecursively()
// { }
// BTS_NO_COPY(EvaluatesRecursively);
void set_evaluator(ExpressionEvaluator* e)
{
_e = e;
}
// void set_evaluator(ExpressionEvaluator* e)
// {
// _e = e;
// }
bool get_value(const std::string& prop, Value* out_value) OVERRIDE
{
std::string recur = "42 == " + prop;
if (out_value)
{
*out_value = Value(_e->eval(recur));
}
return true;
}
// bool get_value(const std::string& prop, Value* out_value) OVERRIDE
// {
// std::string recur = "42 == " + prop;
// if (out_value)
// {
// *out_value = Value(_e->eval(recur));
// }
// return true;
// }
ExpressionEvaluator* _e;
};
// ExpressionEvaluator* _e;
// };
struct expression_tests : public TestSuite
{
expression_tests() { }
~expression_tests() { }
BTS_NO_COPY(expression_tests);
// struct expression_tests : public TestSuite
// {
// expression_tests() { }
// ~expression_tests() { }
// BTS_NO_COPY(expression_tests);
void setup()
{
}
// void setup()
// {
// }
void teardown()
{
}
// void teardown()
// {
// }
void simple_operator_test()
{
ExpressionEvaluator e(BTS_SharedPtr<IPropertyEvaluator> (new EvaluatesToFoo()));
test_assert(e.eval("!!true"));
test_assert(e.eval("3 == 3"));
test_assert(e.eval("4 > 3"));
test_assert(e.eval("3 < 6"));
test_assert(e.eval("3 <= 3.5"));
test_assert(e.eval("3 in [1,2,3]"));
test_assert(!e.eval("3 in [1,2,4]"));
test_assert(e.eval("'oo' in Foo.foo"));
test_assert(e.eval("'oo' == 'oo'"));
test_assert(e.eval("'afoobar' ~= 'foo.*'"));
test_assert(!e.eval("'afoobar' ~= '^foo.*'"));
}
// void simple_operator_test()
// {
// ExpressionEvaluator e(BTS_SharedPtr<IPropertyEvaluator> (new EvaluatesToFoo()));
// test_assert(e.eval("!!true"));
// test_assert(e.eval("3 == 3"));
// test_assert(e.eval("4 > 3"));
// test_assert(e.eval("3 < 6"));
// test_assert(e.eval("3 <= 3.5"));
// test_assert(e.eval("3 in [1,2,3]"));
// test_assert(!e.eval("3 in [1,2,4]"));
// test_assert(e.eval("'oo' in Foo.foo"));
// test_assert(e.eval("'oo' == 'oo'"));
// test_assert(e.eval("'afoobar' ~= 'foo.*'"));
// test_assert(!e.eval("'afoobar' ~= '^foo.*'"));
// }
void test_bool_conversion()
{
ExpressionEvaluator e(BTS_SharedPtr<IPropertyEvaluator> (new EvaluatesToFoo()));
test_assert(e.eval("true"));
test_assert(e.eval("1"));
test_assert(e.eval("1.5"));
test_assert(e.eval("'true string'"));
//test_assert(e.eval("[1,2,3]")); // list not valid here - only after "in"
test_assert(e.eval("Foo.x"));
test_assert(e.eval("Foo.list"));
test_assert(!e.eval("''"));
}
// void test_bool_conversion()
// {
// ExpressionEvaluator e(BTS_SharedPtr<IPropertyEvaluator> (new EvaluatesToFoo()));
// test_assert(e.eval("true"));
// test_assert(e.eval("1"));
// test_assert(e.eval("1.5"));
// test_assert(e.eval("'true string'"));
// //test_assert(e.eval("[1,2,3]")); // list not valid here - only after "in"
// test_assert(e.eval("Foo.x"));
// test_assert(e.eval("Foo.list"));
// test_assert(!e.eval("''"));
// }
void property_validator_test()
{
ExpressionEvaluator e(BTS_SharedPtr<IPropertyEvaluator> (new EvaluatesToFoo()));
test_assert(e.check_valid("Foo.bar == 'Foo' or 'x' in [Foo.x, Foo.y, 'z']", nullptr));
std::string bad_property;
test_assert(!e.check_valid("Foo.bar == 'Foo' or 'x' in [Fuu.x, Foo.y, 'z']", &bad_property));
test_assert(bad_property == "Fuu.x");
}
// void property_validator_test()
// {
// ExpressionEvaluator e(BTS_SharedPtr<IPropertyEvaluator> (new EvaluatesToFoo()));
// test_assert(e.check_valid("Foo.bar == 'Foo' or 'x' in [Foo.x, Foo.y, 'z']", nullptr));
// std::string bad_property;
// test_assert(!e.check_valid("Foo.bar == 'Foo' or 'x' in [Fuu.x, Foo.y, 'z']", &bad_property));
// test_assert(bad_property == "Fuu.x");
// }
void more_complex_test()
{
ExpressionEvaluator e(BTS_SharedPtr<IPropertyEvaluator> (new EvaluatesToFoo()));
// void more_complex_test()
// {
// ExpressionEvaluator e(BTS_SharedPtr<IPropertyEvaluator> (new EvaluatesToFoo()));
test_assert(e.eval("Foo.bar == 'Foo' and 'b' in ['a', 'b', 'c', Foo.bar]"));
test_assert(e.eval("Foo.number > 2 or (3.5 <= 7 and Foo.number == 3) or 'x' in ['a', 'b', 'c']"));
test_assert(!e.eval("(3.5 <= 7 and Foo.number == 3) or 'x' in ['a', 'b', 'c']"));
test_assert(e.eval("'foo' in Foo.list and Foo.number == 42.0"));
test_assert(e.eval("!!('oo' in Foo.foo)"));
test_assert(e.eval("!('ooo' in Foo.foo)"));
test_assert(e.eval("!false in [false, false, false, false, true, Foo.bool]"));
}
// test_assert(e.eval("Foo.bar == 'Foo' and 'b' in ['a', 'b', 'c', Foo.bar]"));
// test_assert(e.eval("Foo.number > 2 or (3.5 <= 7 and Foo.number == 3) or 'x' in ['a', 'b', 'c']"));
// test_assert(!e.eval("(3.5 <= 7 and Foo.number == 3) or 'x' in ['a', 'b', 'c']"));
// test_assert(e.eval("'foo' in Foo.list and Foo.number == 42.0"));
// test_assert(e.eval("!!('oo' in Foo.foo)"));
// test_assert(e.eval("!('ooo' in Foo.foo)"));
// test_assert(e.eval("!false in [false, false, false, false, true, Foo.bool]"));
// }
void recursive_test()
{
BTS_SharedPtr<EvaluatesRecursively> badprops (new EvaluatesRecursively());
ExpressionEvaluator e(badprops);
badprops->set_evaluator(&e);
// void recursive_test()
// {
// BTS_SharedPtr<EvaluatesRecursively> badprops (new EvaluatesRecursively());
// ExpressionEvaluator e(badprops);
// badprops->set_evaluator(&e);
// Try to get the 'fuzzy'property recursively
bool success = false;
try
{
test_assert(e.eval("fuzzy == 42"));
}
catch(RecursivePropertyGetException)
{
success = true;
}
test_assert(success);
}
// // Try to get the 'fuzzy'property recursively
// bool success = false;
// try
// {
// test_assert(e.eval("fuzzy == 42"));
// }
// catch(RecursivePropertyGetException)
// {
// success = true;
// }
// test_assert(success);
// }
};
// };
BEGIN_TEST_SUITE(expression_tests)
ADD_TEST(simple_operator_test);
ADD_TEST(test_bool_conversion);
ADD_TEST(property_validator_test);
ADD_TEST(more_complex_test);
ADD_TEST(recursive_test);
END_TEST_SUITE
// BEGIN_TEST_SUITE(expression_tests)
// ADD_TEST(simple_operator_test);
// ADD_TEST(test_bool_conversion);
// ADD_TEST(property_validator_test);
// ADD_TEST(more_complex_test);
// ADD_TEST(recursive_test);
// END_TEST_SUITE
}
// }
-334
View File
@@ -1,334 +0,0 @@
syntax='proto2';
package bts.md;
// option cc_enable_arenas = true;
//
// Notes
//
// When you update this file you also need to update the coconut system to handle the new message type.
//
// Use this handy checklist
//
// [ ] SubscriptionBuilder
// [ ] SubscriptionEx
// [ ] // Remember to increase the size of PublishOptions._flags
// [ ] MDRecorder
// [ ] ReplaySubscription
// [ ] Any market data provider which should produce the message (duh)
import "lib/security_model/security.proto";
//
// Enums
//
message Platform
{
enum type
{
UNSET = 0;
SIM = 1;
SRLABS = 2;
SPRYWARE = 3;
CSM = 4;
CME = 5;
STREAM = 6;
ICE = 7;
REPLAY = 8;
ACTIV = 9;
MDP3ONIXS = 10;
CSM_ONIXS = 11;
BLUE = 12;
}
}
message BidOrAsk
{
enum type
{
BID = 1;
ASK = 2;
}
}
message CBOEVolumeType
{
enum type
{
TOTAL = 1;
CUSTOMER = 2;
ALL_OR_NONE = 3;
CUSTOMER_ALL_OR_NONE = 4;
}
}
message TradingStatus
{
enum type
{
UNKNOWN = 1;
NORMAL = 2;
CLOSED = 3;
PRE_OPEN = 4;
OPENING_ROTATION = 5;
FAST_MARKET = 6; // CBOE
SUSPENDED = 7;
HALTED = 8;
PRICE_INDICATION = 9; // CME
PRE_CROSS = 10; // CME
CROSS = 11; // CME
NO_CANCEL = 12; // CME
}
}
message CoconutSecurityStatus
{
enum type
{
OK = 0;
PACKET_LOSS = 2;
}
}
// Instrument definition (Security) from exchange_messages.proto
message BookMessage
{
optional int64 time = 1;
required BidOrAsk.type side = 2;
optional double price = 3;
optional uint32 size = 4;
// No longer needed since 1.111 as customer bbo has a dedicated channel
//optional CBOEVolumeType.type volume_type = 5 [default = TOTAL];
// Performance
optional uint64 server_arrival_time = 6;
optional uint64 client_arrival_time = 7;
// Price now integer 3.0
// optional int64 mantissa = 8;
// optional int32 exponent = 9;
}
message TradeMessage
{
optional int64 time = 1;
optional double price = 2;
optional uint32 size = 3;
optional uint32 total_volume = 4;
//optional string trade_condition = 5;
// Added for Co2 to avoid heap
optional uint32 security_key = 6;
}
message MiscMessage {
optional double settlement_price = 1;
optional uint64 settlement_timestamp = 2;
optional double opening_price = 3;
optional uint32 opening_size = 4;
optional double closing_price = 5;
//optional uint32 closing_size = 6;
optional double session_high = 7;
optional double session_low = 8;
optional double open_interest = 9;
optional double prior = 10;
optional double session_high_bid = 11;
optional double session_low_offer = 12;
optional double fixing_price = 13;
//optional double reference_price = 14;
//optional int64 reference_date = 15;
}
message QuoteRequestMessage {
optional int64 time = 1;
optional string request_id = 2;
optional double price = 10;
optional int32 size = 11;
enum Side {
UNDEFINED = 0;
// match o2 Side
BUY = 49;
SELL = 50;
CROSS = 99;
}
optional Side side = 12 [default = UNDEFINED];
optional int64 transact_time = 13;
optional uint32 quote_type = 14;
// Co2
optional uint32 security_key = 15;
optional uint32 sequence = 16;
}
//
// Wire messages (Coconut 1)
//
message SecurityRow
{
optional uint64 security_id = 1;
required bts.security_model.Security security = 2;
}
message ExchangeStatusRow
{
optional uint64 security_id = 1;
required TradingStatus.type status = 2;
}
message CoconutStatusRow
{
optional uint64 security_id = 1;
required CoconutSecurityStatus.type status = 2;
}
message BBORow
{
optional uint64 security_id = 1;
optional BookMessage bid = 2;
optional BookMessage ask = 3;
}
message CustomerBBORow
{
optional uint64 security_id = 1;
optional BookMessage bid = 2;
optional BookMessage ask = 3;
}
message BookRow
{
optional uint64 security_id = 1;
optional uint32 depth = 2;
required BookMessage book = 3;
}
message TradeRow
{
optional uint64 security_id = 1;
optional TradeMessage trade = 2;
}
message MiscRow {
optional uint64 security_id = 1;
optional MiscMessage misc = 2;
optional bts.security_model.Security security = 3;
}
message QuoteRequestRow {
// Optional for backwards compat with the replayer
optional uint64 security_id = 1;
required QuoteRequestMessage request = 2;
}
//
// Status / Metadata messages
//
message CoconutStatus
{
optional string symbol = 1;
optional bts.security_model.SecurityType.type type = 2 [default = UNSET];
optional bts.security_model.Exchange.type exchange = 3 [default = TESTEXCHANGE];
//optional string status = 4;
optional uint32 security_count = 10;
optional uint32 bbo_count = 11;
optional uint32 trade_count = 12;
optional uint32 estatus_count = 13;
optional uint32 rfq_count = 14;
optional uint32 depth_count = 15;
optional uint32 cstatus_count = 16;
optional uint32 custbbo_count = 17;
//optional string last_error = 20;
//optional string last_warning = 21;
optional uint32 bbo1 = 30;
optional uint32 bbo5 = 31;
optional uint32 bbo15 = 32;
optional uint32 bbo_burst = 33;
optional string bbo_burst_when = 34;
optional uint32 trade1 = 35;
optional uint32 trade5 = 36;
optional uint32 trade15 = 37;
optional uint32 trade_burst = 38;
optional string trade_burst_when = 39;
optional uint32 depth1 = 40;
optional uint32 depth5 = 41;
optional uint32 depth15 = 42;
optional uint32 depth_burst = 43;
optional string depth_burst_when = 44;
optional uint32 custbbo1 = 45;
optional uint32 custbbo5 = 46;
optional uint32 custbbo15 = 47;
}
message Co2Status {
optional string symbol = 1;
optional bts.security_model.SecurityType.type type = 2 [default = UNSET];
optional bts.security_model.Exchange.type exchange = 3 [default = TESTEXCHANGE];
optional Platform.type platform = 4 [default = UNSET];
optional uint32 security_count_in = 10;
optional uint32 security_count_out = 11;
optional uint32 bbo_count_in = 20;
optional uint32 bbo_count_out = 21;
optional uint32 trade_count_in = 30;
optional uint32 trade_count_out = 31;
optional uint32 rfq_count_in = 40;
optional uint32 rfq_count_out = 41;
optional uint32 depth_count_in = 50;
optional uint32 depth_count_out = 51;
optional uint32 custbbo_count_in = 60;
optional uint32 custbbo_count_out = 61;
}
//
// Replayer messages
//
// Replay file format
// [uin16_t length] [byte HEADER] [uint16_t unused] CoconutReplayHeader - [uint16_t length] [byte CoconutRowType] [uint16_t delta seconds] [Row type]
message CoconutRowType {
enum type {
HEADER = 1;
SECURITY = 2;
EXCHANGE_STATUS = 3;
BBO = 4;
BOOK = 5;
TRADE = 6;
MISC = 7;
RFQ = 8;
CUSTOMER_BBO = 9;
}
}
message CoconutReplayHeader {
required string magic = 1;
required uint32 version = 2;
required int64 timestamp = 3;
optional string host = 4;
optional int32 naggle_ms = 5;
}
-1
View File
@@ -1,4 +1,3 @@
syntax='proto3' ;
package bts.orderman ;
import "lib/domain_model/Security.proto";
+28 -28
View File
@@ -1,37 +1,37 @@
#include "core/bts_core/utest/utest.h"
#include "core/bts_core/utest/TempFile.h"
// #include "core/bts_core/utest/utest.h"
// #include "core/bts_core/utest/TempFile.h"
#include "../os.h"
// #include "../os.h"
namespace bts {
namespace os {
// namespace bts {
// namespace os {
class FileNameSanitization : public TestSuite
{
public:
void empty_file_name_works ()
{
test_equal (sanitize_file_name (""),"");
}
// class FileNameSanitization : public TestSuite
// {
// public:
// void empty_file_name_works ()
// {
// test_equal (sanitize_file_name (""),"");
// }
void legal_file_name_passes_through ()
{
test_equal (sanitize_file_name ("bts_shell"),"bts_shell");
}
// void legal_file_name_passes_through ()
// {
// test_equal (sanitize_file_name ("bts_shell"),"bts_shell");
// }
void bad_file_name_is_fixed ()
{
test_equal (sanitize_file_name ("bts_shell -configserver http://edge-qa/config/"),
"bts_shell -configserver http___edge-qa_config_");
}
};
// void bad_file_name_is_fixed ()
// {
// test_equal (sanitize_file_name ("bts_shell -configserver http://edge-qa/config/"),
// "bts_shell -configserver http___edge-qa_config_");
// }
// };
BEGIN_TEST_SUITE(FileNameSanitization)
ADD_TEST (bad_file_name_is_fixed)
ADD_TEST (legal_file_name_passes_through)
ADD_TEST (bad_file_name_is_fixed)
END_TEST_SUITE
}}
// BEGIN_TEST_SUITE(FileNameSanitization)
// ADD_TEST (bad_file_name_is_fixed)
// ADD_TEST (legal_file_name_passes_through)
// ADD_TEST (bad_file_name_is_fixed)
// END_TEST_SUITE
// }}
-52
View File
@@ -898,55 +898,3 @@ message SyntheticExecutionStrategy {
bts.api.Security security = 10;
ExecutionStrategy execution_strategy = 20;
}
message RiskLimit
{
uint32 max_order_size = 10;
uint32 max_position_long = 20;
uint32 max_position_short = 30;
uint32 max_position_net = 40;
double max_order_price = 50;
}
message ClearingAccount
{
string account_id = 10; //tag 1
//The net liquidation value of the account
double net_liq = 20;
//The amount of leverage over net liq to set the margin limit
double leverage_factor = 30;
//Per SYMBOL risk limits. They want to set how many Corn Futures and Spread
map<string, RiskLimit> symbol_to_limits = 100;
}
//https://www.cmegroup.com/confluence/display/EPICSANDBOX/Standard+Header+-++Client+System+to+CME+Globex
//https://www.cmegroup.com/confluence/display/EPICSANDBOX/iLink+Architecture#iLinkArchitecture-iLinkSessionModel
message ExchangeSession
{
string session_id = 10; //bts id for this session
bts.api.Venue exchange = 20;
string sender_comp_id = 30; //tag 49, 7 bytes CME
string user_name = 40; //tag 553
string password = 50; //tag 96 (raw_data)
string ip = 100;
string port = 110;
}
message OperatorProfile
{
string operator_id = 10; //tag 50, 18 bytes limit
bts.api.Venue exchange = 20;
}
message SparkUser
{
string login_name = 10;
repeated OperatorProfile profiles = 100;
repeated ExchangeSession sessions = 110;
repeated ClearingAccount accounts = 500;
}
+2
View File
@@ -0,0 +1,2 @@
# generated by make process
set(sources ;fabric/Actor.cpp;fabric/Domain.cpp;fabric/Executor.cpp;fabric/IActor.cpp;fabric/IDomain.cpp;fabric/TopicDirectory.cpp;fabric/tests/baseline_perf_fabric_test.cpp;fabric/tests/fabric_test.cpp;jetfix/codec/FIXArray.cpp;jetfix/common/OutFIX.cpp;jetfix/connection/AsyncReader.cpp;jetfix/connection/IConnection.cpp;jetfix/connection/SocketConnection.cpp;jetfix/gateway/CoreGateway.cpp;jetfix/gateway/JetFIXGateway.cpp;jetfix/gateway/Session.cpp;jetfix/store/FIXFileStore.cpp;jetfix/store/session_name.cpp;jetfix/tests/async_reader_tests.cpp;jetfix/tests/decoding_tests.cpp;jetfix/tests/fix_encoding_stream_tests.cpp;jetfix/tests/fix_fragment_tests.cpp;jetfix/tests/jetfix_performance_tests.cpp;jetfix/tests/store_tests.cpp;main.cpp;md/platforms/mdp3_onixs/MDP3Listener.cpp;md/platforms/mdp3_onixs/MDP3Main.cpp;md/platforms/mdp3_onixs/MDP3Utils.cpp;md/platforms/mdp3_onixs/tests/mdp3_tests.cpp;md/run_md.cpp;order_man/IFIXGateway.cpp;order_man/IOrderObserver.cpp;order_man/OldOrderMan.cpp;order_man/OrderMan.cpp;order_man/OrderState.cpp;order_man/OrderStore.cpp;order_man/WorkingOrder.cpp;order_man/fix_order_codec.cpp;order_man/order_man_common.cpp;order_man/order_man_utils.cpp;persistence/IStore.cpp;persistence/PersistenceServiceServer.cpp;persistence/SqliteStore.cpp;persistence/tests/PersistenceServiceTests.cpp;risk_limits/IRiskLimitObserver.cpp;risk_limits/RiskLimitManager.cpp;risk_limits/RiskLimiter.cpp;setup/BootstrapActor.cpp;setup/ServiceHostActor.cpp;spreader/SpreaderBase.cpp;testing/catch_test_runner.cpp;user/UserServiceServer.cpp)
+16 -75
View File
@@ -2,82 +2,24 @@ cmake_minimum_required(VERSION 3.5)
project(sparkd)
# proto sources
set (Protos
)
set (Protos)
include(${CMAKE_SOURCE_DIR}/tools/safe_dep_glob.cmake)
include(${CMAKE_SOURCE_DIR}/tools/Protobuf.cmake)
# DEPENDENCIES
# protos
file(GLOB_RECURSE Proto_Srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.proto)
# normal cpps
file(GLOB_RECURSE Sparkd_Sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
# this is used to communicate to other repositories that the build
# needs to happen again (because a file was added)
update_deps_file("${Proto_Srcs};${Sparkd_Sources}")
# END DEPENDENCIES
protobuf_generate_cpp( Proto_Srcs PROTO_HDRS ${Protos} )
# cpp sources
set (Sparkd_Sources
main.cpp
# fabric
fabric/Actor.cpp
fabric/Executor.cpp
fabric/Domain.cpp
fabric/IActor.cpp
fabric/IDomain.cpp
fabric/TopicDirectory.cpp
fabric/tests/fabric_test.cpp
fabric/tests/baseline_perf_fabric_test.cpp
# jetfix
jetfix/codec/FIXArray.cpp
jetfix/common/OutFIX.cpp
jetfix/connection/AsyncReader.cpp
jetfix/connection/IConnection.cpp
jetfix/connection/SocketConnection.cpp
jetfix/gateway/CoreGateway.cpp
jetfix/gateway/JetFIXGateway.cpp
jetfix/gateway/Session.cpp
jetfix/store/FIXFileStore.cpp
jetfix/store/session_name.cpp
jetfix/tests/async_reader_tests.cpp
jetfix/tests/decoding_tests.cpp
jetfix/tests/fix_encoding_stream_tests.cpp
jetfix/tests/fix_fragment_tests.cpp
jetfix/tests/jetfix_performance_tests.cpp
jetfix/tests/store_tests.cpp
# persistence
persistence/PersistenceServiceServer.cpp
persistence/tests/PersistenceServiceTests.cpp
persistence/IStore.cpp
persistence/SqliteStore.cpp
# testing utilities
testing/catch_test_runner.cpp
# setup
setup/BootstrapActor.cpp
setup/ServiceHostActor.cpp
# user
user/UserServiceServer.cpp
# orderman
order_man/OldOrderMan.cpp
order_man/OrderMan.cpp
order_man/IOrderObserver.cpp
order_man/WorkingOrder.cpp
order_man/IFIXGateway.cpp
order_man/OrderStore.cpp
order_man/OrderState.cpp
order_man/order_man_common.cpp
order_man/fix_order_codec.cpp
# spreader
spreader/SpreaderBase.cpp
# md, mdp3 onixs platform
# md/platforms/mdp3_onixs/MDP3Listener.cpp
# md/platforms/mdp3_onixs/MDP3Main.cpp
# md/platforms/mdp3_onixs/MDP3Utils.cpp
# md/platforms/mdp3_onixs/tests/mdp3_tests.cpp
md/run_md.cpp
)
# sparkd
add_executable(sparkd ${Sparkd_Sources} ${Proto_Srcs})
#include paths
@@ -89,7 +31,6 @@ target_link_libraries( sparkd
tbb
double-conversion
pugixml
# -lOnixS.CmeMdp3HandlerCpp
-static-libgcc
-static-libstdc++
-pthread)
File diff suppressed because it is too large. Load diff
@@ -1,318 +1,318 @@
#ifndef NO_CPP0X
#include "MDP3Main.h"
// #ifndef NO_CPP0X
// #include "MDP3Main.h"
#include "MDP3Utils.h"
#include "lib/config/config.h"
#include "lib/md/coconut2.h"
#include "lib/os/os.h"
#include "lib/utils/Dispatcher.h"
#include "lib/utils/proto_helper.h"
// #include "MDP3Utils.h"
// #include "lib/config/config.h"
// #include "lib/md/coconut2.h"
// #include "lib/os/os.h"
// #include "lib/utils/Dispatcher.h"
// #include "lib/utils/proto_helper.h"
#include "lib/config/protos/MarketData.pb.h"
#include "lib/config/protos/system.pb.h"
// #include "lib/config/protos/MarketData.pb.h"
// #include "lib/config/protos/system.pb.h"
#include <memory>
#include <set>
// #include <memory>
// #include <set>
using namespace std;
using namespace bts::md2;
// using namespace OnixS::CME::MDP3;
// using namespace std;
// using namespace bts::md2;
// // using namespace OnixS::CME::MDP3;
namespace bts {
namespace md {
// namespace bts {
// namespace md {
void run_onixs_mdp3_server(UserSymbol* psyms, size_t symcount) {
MDP3Main main;
vector<UserSymbol> symbols;
for (size_t x = 0; x < symcount; ++x) {
symbols.push_back(psyms[x]);
}
main.run(symbols);
}
// void run_onixs_mdp3_server(UserSymbol* psyms, size_t symcount) {
// MDP3Main main;
// vector<UserSymbol> symbols;
// for (size_t x = 0; x < symcount; ++x) {
// symbols.push_back(psyms[x]);
// }
// main.run(symbols);
// }
MDP3Main::MDP3Main() :
_producer(Platform::MDP3ONIXS),
_security_recorder(),
_settlement_recorder(Platform::MDP3ONIXS),
_engines(),
_handlers(),
_listeners()
{
}
// MDP3Main::MDP3Main() :
// _producer(Platform::MDP3ONIXS),
// _security_recorder(),
// _settlement_recorder(Platform::MDP3ONIXS),
// _engines(),
// _handlers(),
// _listeners()
// {
// }
MDP3Main::~MDP3Main() {}
// MDP3Main::~MDP3Main() {}
const CMEOptions::CMEChannel channel_settings_for(const string& id) {
const auto& config = config::get<CMEOptions>();
for (const auto& ch : config.channel()) {
bool found = std::find_if(ch.id().begin(), ch.id().end(), [&](const string& chan_id) { return chan_id == id || chan_id == "*"; }) != ch.id().end();
if (found) {
return ch;
}
}
return CMEOptions::CMEChannel();
}
bool feed_engine_exists(const string& name) {
const auto& config = config::get<CMEOptions>();
for (const auto& feed : config.feed_engine()) {
if (feed.name() == name) return true;
}
return false;
}
// const CMEOptions::CMEChannel channel_settings_for(const string& id) {
// const auto& config = config::get<CMEOptions>();
// for (const auto& ch : config.channel()) {
// bool found = std::find_if(ch.id().begin(), ch.id().end(), [&](const string& chan_id) { return chan_id == id || chan_id == "*"; }) != ch.id().end();
// if (found) {
// return ch;
// }
// }
// return CMEOptions::CMEChannel();
// }
// bool feed_engine_exists(const string& name) {
// const auto& config = config::get<CMEOptions>();
// for (const auto& feed : config.feed_engine()) {
// if (feed.name() == name) return true;
// }
// return false;
// }
const onixs::FeedEngineSettings feed_engine_settings_from_config(const CMEOptions::FeedEngineSettings& settings, int feed_count) {
onixs::FeedEngineSettings result;
if (settings.has_data_wait()) result.dataWaitTime(settings.data_wait());
if (settings.has_spin_time()) result.redundancySpinTime(settings.spin_time());
for (auto& core : settings.affinity()) {
result.threadsAffinity().insert(core);
}
// const onixs::FeedEngineSettings feed_engine_settings_from_config(const CMEOptions::FeedEngineSettings& settings, int feed_count) {
// onixs::FeedEngineSettings result;
// if (settings.has_data_wait()) result.dataWaitTime(settings.data_wait());
// if (settings.has_spin_time()) result.redundancySpinTime(settings.spin_time());
// for (auto& core : settings.affinity()) {
// result.threadsAffinity().insert(core);
// }
// num_threads() overrides anything else
if (settings.has_num_threads()) {
result.threadsCount(settings.num_threads());
}
else {
// If num_threads is absent determine thread count based on #channels
result.threadsCount((feed_count / settings.channels_per_thread()) + 1);
}
return result;
}
// // num_threads() overrides anything else
// if (settings.has_num_threads()) {
// result.threadsCount(settings.num_threads());
// }
// else {
// // If num_threads is absent determine thread count based on #channels
// result.threadsCount((feed_count / settings.channels_per_thread()) + 1);
// }
// return result;
// }
size_t count_engine_uses(const vector<CMEChannel>& channels, const string& feed_name) {
return count_if(channels.begin(), channels.end(), [&](const CMEChannel& ch) {
const auto& settings = channel_settings_for(ch.id);
return settings.has_feed_engine() && settings.feed_engine() == feed_name;
});
}
// size_t count_engine_uses(const vector<CMEChannel>& channels, const string& feed_name) {
// return count_if(channels.begin(), channels.end(), [&](const CMEChannel& ch) {
// const auto& settings = channel_settings_for(ch.id);
// return settings.has_feed_engine() && settings.feed_engine() == feed_name;
// });
// }
map<string,onixs::FeedEngineSettings> create_feed_engine_settings(const std::vector<CMEChannel>& channels) {
map<string, onixs::FeedEngineSettings> settings;
const auto& config = config::get<CMEOptions>();
// map<string,onixs::FeedEngineSettings> create_feed_engine_settings(const std::vector<CMEChannel>& channels) {
// map<string, onixs::FeedEngineSettings> settings;
// const auto& config = config::get<CMEOptions>();
// For each feed engine in feed_engine
for (const auto& feed : config.feed_engine()) {
// - see if it is in use
size_t use_count = count_engine_uses(channels, feed.name());
// - Only create if this feed engine is in use
if (use_count > 0) {
settings[feed.name()] = feed_engine_settings_from_config(feed, use_count);
}
}
// // For each feed engine in feed_engine
// for (const auto& feed : config.feed_engine()) {
// // - see if it is in use
// size_t use_count = count_engine_uses(channels, feed.name());
// // - Only create if this feed engine is in use
// if (use_count > 0) {
// settings[feed.name()] = feed_engine_settings_from_config(feed, use_count);
// }
// }
// If a channel asks for defaults ensure it exists.
if (settings.count("default") == 0) {
size_t channels_using_default = count_engine_uses(channels, "default");
if (channels_using_default > 0) {
settings["default"] = feed_engine_settings_from_config(CMEOptions::FeedEngineSettings(), channels_using_default);
}
}
// // If a channel asks for defaults ensure it exists.
// if (settings.count("default") == 0) {
// size_t channels_using_default = count_engine_uses(channels, "default");
// if (channels_using_default > 0) {
// settings["default"] = feed_engine_settings_from_config(CMEOptions::FeedEngineSettings(), channels_using_default);
// }
// }
return settings;
}
// return settings;
// }
map<string, unique_ptr<onixs::FeedEngine>> create_feed_engines(const vector<CMEChannel>& channels) {
map<string, unique_ptr<onixs::FeedEngine>> result;
auto settings = create_feed_engine_settings(channels);
// Loop through settings and instantiate feed engines
for (const auto& s : settings) {
unique_ptr<onixs::FeedEngine> temp(new onixs::FeedEngine(s.second));
result.insert(make_pair(s.first, move(temp)));
}
// map<string, unique_ptr<onixs::FeedEngine>> create_feed_engines(const vector<CMEChannel>& channels) {
// map<string, unique_ptr<onixs::FeedEngine>> result;
// auto settings = create_feed_engine_settings(channels);
// // Loop through settings and instantiate feed engines
// for (const auto& s : settings) {
// unique_ptr<onixs::FeedEngine> temp(new onixs::FeedEngine(s.second));
// result.insert(make_pair(s.first, move(temp)));
// }
return result;
}
// return result;
// }
void MDP3Main::run(std::vector<UserSymbol>& symbols) {
await_cme_config();
initialize();
const auto& channels = parse_channels(symbols);
_engines = create_feed_engines(channels);
for (const auto& channel : channels) {
_handlers.push_back(prepare_handler(channel.id));
_listeners.push_back(prepare_listener(*_handlers.back(), channel));
std::stringstream symstr;
for (const auto& sym : channel.symbols) { symstr << sym.symbol() << "-" << SecurityType::type_Name(sym.type()) << " "; }
LOG(MarketData,Info, "CME: Initialized channel {} ({})",channel.id,symstr.str());
}
for (auto& p_handler : _handlers) {
p_handler->start();
}
// void MDP3Main::run(std::vector<UserSymbol>& symbols) {
// await_cme_config();
// initialize();
// const auto& channels = parse_channels(symbols);
// _engines = create_feed_engines(channels);
// for (const auto& channel : channels) {
// _handlers.push_back(prepare_handler(channel.id));
// _listeners.push_back(prepare_listener(*_handlers.back(), channel));
// std::stringstream symstr;
// for (const auto& sym : channel.symbols) { symstr << sym.symbol() << "-" << SecurityType::type_Name(sym.type()) << " "; }
// LOG(MarketData,Info, "CME: Initialized channel {} ({})",channel.id,symstr.str());
// }
// for (auto& p_handler : _handlers) {
// p_handler->start();
// }
//
// Work timer
auto& disp = utils::Dispatcher::current();
utils::DispatcherTimer security_timer(disp, 500, [&]() {
_security_recorder.do_work();
});
security_timer.start();
// //
// // Work timer
// auto& disp = utils::Dispatcher::current();
// utils::DispatcherTimer security_timer(disp, 500, [&]() {
// _security_recorder.do_work();
// });
// security_timer.start();
utils::DispatcherTimer spread_resolve_timer(disp, 1000, [&]() {
_index.resolve_spreads();
});
spread_resolve_timer.start();
// utils::DispatcherTimer spread_resolve_timer(disp, 1000, [&]() {
// _index.resolve_spreads();
// });
// spread_resolve_timer.start();
utils::DispatcherTimer settlement_timer(disp, 100, [&]() {
_settlement_recorder.do_work();
});
settlement_timer.start();
// utils::DispatcherTimer settlement_timer(disp, 100, [&]() {
// _settlement_recorder.do_work();
// });
// settlement_timer.start();
utils::DispatcherTimer heartbeat_timer(disp, 250, [&]() {
for (const auto& listener: _listeners) {
listener->heartbeat();
}
});
heartbeat_timer.start();
// utils::DispatcherTimer heartbeat_timer(disp, 250, [&]() {
// for (const auto& listener: _listeners) {
// listener->heartbeat();
// }
// });
// heartbeat_timer.start();
LOG(MarketData,Info, "** CME MDP3 Publisher started **");
// LOG(MarketData,Info, "** CME MDP3 Publisher started **");
disp.run();
}
// disp.run();
// }
void MDP3Main::initialize() {
const auto& options = config::get<CMEOptions>();
// void MDP3Main::initialize() {
// const auto& options = config::get<CMEOptions>();
//
// License path
onixs::InitializationSettings init_settings;
auto license = options.onixs_license();
init_settings.licenseStore(license);
if (license == "{default}") {
init_settings.licenseStore(os::get_cwd() + "/licenses/");
}
LOG(MarketData,Info,"Loading onixs license from {}", init_settings.licenseStore());
onixs::initialize(init_settings);
}
// //
// // License path
// onixs::InitializationSettings init_settings;
// auto license = options.onixs_license();
// init_settings.licenseStore(license);
// if (license == "{default}") {
// init_settings.licenseStore(os::get_cwd() + "/licenses/");
// }
// LOG(MarketData,Info,"Loading onixs license from {}", init_settings.licenseStore());
// onixs::initialize(init_settings);
// }
//
// Initialize HandlerSettings and allocate the channel Handler
unique_ptr<onixs::Handler> MDP3Main::prepare_handler(const string& channel_id) {
const auto& pub_options = config::get<PublisherOptions>();
const auto& options = channel_settings_for(channel_id);
LOG(MarketData,Info,"Loaded channel options for channel {}:\n{}",channel_id ,options.DebugString());
onixs::HandlerSettings settings;
settings.channelId(channel_id);
settings.channelsConfigurationFile(config_path());
settings.codingTemplatesFile(template_path());
// //
// // Initialize HandlerSettings and allocate the channel Handler
// unique_ptr<onixs::Handler> MDP3Main::prepare_handler(const string& channel_id) {
// const auto& pub_options = config::get<PublisherOptions>();
// const auto& options = channel_settings_for(channel_id);
// LOG(MarketData,Info,"Loaded channel options for channel {}:\n{}",channel_id ,options.DebugString());
// onixs::HandlerSettings settings;
// settings.channelId(channel_id);
// settings.channelsConfigurationFile(config_path());
// settings.codingTemplatesFile(template_path());
//
// Tcp Replay options
// //
// // Tcp Replay options
if (options.use_tcp_replay()) LOG(MarketData,Info,"CME: Enabled TCP replay");
if (options.use_tcp_replay()) {
settings.tcpRecoveryUsername(options.tcp_replay_username());
settings.tcpRecoveryPassword(options.tcp_replay_password());
settings.tcpRecoveryReconnectAttempts(options.tcp_replay_connect_attempts());
settings.tcpRecoveryReconnectInterval(options.tcp_replay_reconnect_interval_ms());
}
// if (options.use_tcp_replay()) LOG(MarketData,Info,"CME: Enabled TCP replay");
// if (options.use_tcp_replay()) {
// settings.tcpRecoveryUsername(options.tcp_replay_username());
// settings.tcpRecoveryPassword(options.tcp_replay_password());
// settings.tcpRecoveryReconnectAttempts(options.tcp_replay_connect_attempts());
// settings.tcpRecoveryReconnectInterval(options.tcp_replay_reconnect_interval_ms());
// }
//
// Network settings
// //
// // Network settings
settings.udpSocketBufferSize(options.udp_socket_buffer_size());
if (options.has_lost_packet_wait_timeout_ms()) {
settings.lostPacketWaitTime((size_t)options.lost_packet_wait_timeout_ms() * 1000);
}
if (pub_options.has_network_interface()) {
settings.networkInterface(pub_options.network_interface());
}
else {
if (pub_options.has_network_interface_a()) {
settings.networkInterfaceA(pub_options.network_interface_a());
}
if (pub_options.has_network_interface_b()) {
settings.networkInterfaceB(pub_options.network_interface_b());
}
}
// settings.udpSocketBufferSize(options.udp_socket_buffer_size());
// if (options.has_lost_packet_wait_timeout_ms()) {
// settings.lostPacketWaitTime((size_t)options.lost_packet_wait_timeout_ms() * 1000);
// }
// if (pub_options.has_network_interface()) {
// settings.networkInterface(pub_options.network_interface());
// }
// else {
// if (pub_options.has_network_interface_a()) {
// settings.networkInterfaceA(pub_options.network_interface_a());
// }
// if (pub_options.has_network_interface_b()) {
// settings.networkInterfaceB(pub_options.network_interface_b());
// }
// }
if (pub_options.has_network_interface() ||
(pub_options.has_network_interface_a() &&
pub_options.has_network_interface_b()) ) {
if (options.prefer_backup_feeds()) {
settings.instrumentFeedLayout(onixs::RecoveryFeedLayout::FeedBWithFailoverToFeedA);
settings.snapshotFeedLayout(onixs::RecoveryFeedLayout::FeedBWithFailoverToFeedA);
}
else {
settings.instrumentFeedLayout(onixs::RecoveryFeedLayout::FeedAWithFailoverToFeedB);
settings.snapshotFeedLayout(onixs::RecoveryFeedLayout::FeedAWithFailoverToFeedB);
}
}
else if (pub_options.has_network_interface_a()) {
settings.instrumentFeedLayout(onixs::RecoveryFeedLayout::FeedAOnly);
settings.snapshotFeedLayout(onixs::RecoveryFeedLayout::FeedAOnly);
}
else if (pub_options.has_network_interface_b()) {
settings.instrumentFeedLayout(onixs::RecoveryFeedLayout::FeedBOnly);
settings.snapshotFeedLayout(onixs::RecoveryFeedLayout::FeedBOnly);
}
// if (pub_options.has_network_interface() ||
// (pub_options.has_network_interface_a() &&
// pub_options.has_network_interface_b()) ) {
// if (options.prefer_backup_feeds()) {
// settings.instrumentFeedLayout(onixs::RecoveryFeedLayout::FeedBWithFailoverToFeedA);
// settings.snapshotFeedLayout(onixs::RecoveryFeedLayout::FeedBWithFailoverToFeedA);
// }
// else {
// settings.instrumentFeedLayout(onixs::RecoveryFeedLayout::FeedAWithFailoverToFeedB);
// settings.snapshotFeedLayout(onixs::RecoveryFeedLayout::FeedAWithFailoverToFeedB);
// }
// }
// else if (pub_options.has_network_interface_a()) {
// settings.instrumentFeedLayout(onixs::RecoveryFeedLayout::FeedAOnly);
// settings.snapshotFeedLayout(onixs::RecoveryFeedLayout::FeedAOnly);
// }
// else if (pub_options.has_network_interface_b()) {
// settings.instrumentFeedLayout(onixs::RecoveryFeedLayout::FeedBOnly);
// settings.snapshotFeedLayout(onixs::RecoveryFeedLayout::FeedBOnly);
// }
//
// Misc settings
// //
// // Misc settings
settings.recoverSecurityDefinitionsOnGap(false);
settings.bookUpdateNotificationStrategy(onixs::BookUpdateNotificationStrategies::OnEndOfEvent);
// settings.recoverSecurityDefinitionsOnGap(false);
// settings.bookUpdateNotificationStrategy(onixs::BookUpdateNotificationStrategies::OnEndOfEvent);
//
// Logging
// //
// // Logging
settings.logDirectory(config::get<CMEOptions>().onixs_log_path());
settings.logMode((onixs::LogModes::Enum)options.onixs_log_mode());
settings.advancedLogOptions((onixs::AdvancedLogOptions::Enum)options.onixs_log_advanced());
settings.logFileNamePrefix(channel_id + "_");
// settings.logDirectory(config::get<CMEOptions>().onixs_log_path());
// settings.logMode((onixs::LogModes::Enum)options.onixs_log_mode());
// settings.advancedLogOptions((onixs::AdvancedLogOptions::Enum)options.onixs_log_advanced());
// settings.logFileNamePrefix(channel_id + "_");
//
// Associate with feed handler
// //
// // Associate with feed handler
try {
auto temp = unique_ptr<onixs::Handler>(new onixs::Handler(settings));
if (options.has_feed_engine()) {
temp->bindToFeedEngine(_engines[options.feed_engine()].get());
}
return temp;
}
catch (std::exception& e) {
LOG(MarketData,Error,"{}", e.what());
throw;
}
}
// try {
// auto temp = unique_ptr<onixs::Handler>(new onixs::Handler(settings));
// if (options.has_feed_engine()) {
// temp->bindToFeedEngine(_engines[options.feed_engine()].get());
// }
// return temp;
// }
// catch (std::exception& e) {
// LOG(MarketData,Error,"{}", e.what());
// throw;
// }
// }
//
// Create a listener for this channel and register callbacks
unique_ptr<MDP3Listener> MDP3Main::prepare_listener(onixs::Handler& handler, const CMEChannel& channel) {
// We need to get a handler to the producer channels so we can produce heartbeats
vector<MDProducerChannel> producer_channels;
for (auto& symbol : channel.symbols) {
producer_channels.push_back(_producer.get_channel(symbol.symbol().c_str(), symbol.type(), symbol.exchange()));
//handler.addSecurityAssetFilter(symbol.symbol());
}
// //
// // Create a listener for this channel and register callbacks
// unique_ptr<MDP3Listener> MDP3Main::prepare_listener(onixs::Handler& handler, const CMEChannel& channel) {
// // We need to get a handler to the producer channels so we can produce heartbeats
// vector<MDProducerChannel> producer_channels;
// for (auto& symbol : channel.symbols) {
// producer_channels.push_back(_producer.get_channel(symbol.symbol().c_str(), symbol.type(), symbol.exchange()));
// //handler.addSecurityAssetFilter(symbol.symbol());
// }
unique_ptr<MDP3Listener> listener(new MDP3Listener(_index, _producer, _security_recorder, _settlement_recorder, producer_channels, utils::Dispatcher::current()));
for (auto& symbol : channel.symbols) {
listener->add_filter_symbol(symbol.symbol());
}
// unique_ptr<MDP3Listener> listener(new MDP3Listener(_index, _producer, _security_recorder, _settlement_recorder, producer_channels, utils::Dispatcher::current()));
// for (auto& symbol : channel.symbols) {
// listener->add_filter_symbol(symbol.symbol());
// }
handler.registerMessageProcessingListener(listener.get());
handler.registerSecurityDefinitionListener(listener.get());
handler.registerSecurityStatusListener(listener.get());
handler.registerConsolidatedBookUpdateListener(listener.get());
handler.registerStateChangeListener(listener.get());
// handler.registerMessageProcessingListener(listener.get());
// handler.registerSecurityDefinitionListener(listener.get());
// handler.registerSecurityStatusListener(listener.get());
// handler.registerConsolidatedBookUpdateListener(listener.get());
// handler.registerStateChangeListener(listener.get());
if (!config::get<CMEOptions>().quoter_mode()) {
handler.registerTradeListener(listener.get());
handler.registerElectronicVolumeListener(listener.get());
handler.registerRequestForQuoteListener(listener.get());
handler.registerStatisticsListener(listener.get());
}
// if (!config::get<CMEOptions>().quoter_mode()) {
// handler.registerTradeListener(listener.get());
// handler.registerElectronicVolumeListener(listener.get());
// handler.registerRequestForQuoteListener(listener.get());
// handler.registerStatisticsListener(listener.get());
// }
handler.registerWarningListener(listener.get());
handler.registerErrorListener(listener.get());
// handler.registerWarningListener(listener.get());
// handler.registerErrorListener(listener.get());
return listener;
}
// return listener;
// }
}}//namespace
#endif
// }}//namespace
// #endif
@@ -1,128 +1,128 @@
#ifndef NO_CPP0X
#include "MDP3Utils.h"
#include "onixs.h"
// #ifndef NO_CPP0X
// #include "MDP3Utils.h"
// #include "onixs.h"
#include "lib/config/config.h"
#include "lib/utils/datetime.h"
#include "lib/utils/bts_chrono.h"
// #include "lib/config/config.h"
// #include "lib/utils/datetime.h"
// #include "lib/utils/bts_chrono.h"
#include "lib/config/protos/MarketData.pb.h"
#include "lib/config/protos/system.pb.h"
// #include "lib/config/protos/MarketData.pb.h"
// #include "lib/config/protos/system.pb.h"
#include <boost/filesystem.hpp>
#include <pugixml/pugixml.hpp>
// #include <boost/filesystem.hpp>
// #include <pugixml/pugixml.hpp>
using namespace std;
using namespace bts::md2;
// using namespace std;
// using namespace bts::md2;
namespace bts {
namespace md {
// namespace bts {
// namespace md {
string data_path() {
auto p = config::get<config::System>().data_path() + "cme_mdp3/";
#ifdef _WIN32
// OnixS requires win32 paths to look like Win32 paths - everyone else in the world is ok with '/'
os::normalize_path(p, '\\');
#else
os::normalize_path(p);
#endif
return p;
}
const string config_path() { return data_path() + "config.xml"; }
const string template_path() { return data_path() + "templates.xml"; }
// string data_path() {
// auto p = config::get<config::System>().data_path() + "cme_mdp3/";
// #ifdef _WIN32
// // OnixS requires win32 paths to look like Win32 paths - everyone else in the world is ok with '/'
// os::normalize_path(p, '\\');
// #else
// os::normalize_path(p);
// #endif
// return p;
// }
// const string config_path() { return data_path() + "config.xml"; }
// const string template_path() { return data_path() + "templates.xml"; }
bool check_file_exists_with_instructions(const string& filename, const string& url, bool log) {
if (!boost::filesystem::exists(filename)) {
if (log) {
LOG(MarketData,Error,
"File {} is not present on this system. "
"Please download it from the CME ftp site. "
"I will wait until the file is present.\n$ curl {} > {} ",
filename, url, filename);
}
return false;
}
return true;
}
// bool check_file_exists_with_instructions(const string& filename, const string& url, bool log) {
// if (!boost::filesystem::exists(filename)) {
// if (log) {
// LOG(MarketData,Error,
// "File {} is not present on this system. "
// "Please download it from the CME ftp site. "
// "I will wait until the file is present.\n$ curl {} > {} ",
// filename, url, filename);
// }
// return false;
// }
// return true;
// }
// For exponential backoff on logging this return true if x is a power of 2 or 0
bool is_pow_two_or_0(uint32_t x) { return (x & (~x + 1)) == x; }
// // For exponential backoff on logging this return true if x is a power of 2 or 0
// bool is_pow_two_or_0(uint32_t x) { return (x & (~x + 1)) == x; }
void await_cme_config() {
const auto config_url = "ftp://ftp.cmegroup.com/SBEFix/Production/Configuration/config.xml";
const auto templates_url = "ftp://ftp.cmegroup.com/SBEFix/Production/Templates/templates_FixBinary.xml";
// void await_cme_config() {
// const auto config_url = "ftp://ftp.cmegroup.com/SBEFix/Production/Configuration/config.xml";
// const auto templates_url = "ftp://ftp.cmegroup.com/SBEFix/Production/Templates/templates_FixBinary.xml";
boost::filesystem::create_directories(data_path());
// boost::filesystem::create_directories(data_path());
// Check config is present and give instructions for downloading it if not
// If the file is not present log an error and wait a second. Continue to log the error ever power of 2 seconds until the file appears or the process is killed.
uint32_t count = 0;
while(!check_file_exists_with_instructions(config_path(), config_url, is_pow_two_or_0(count))) {
++count;
std::this_thread::sleep_for(1s);
}
count = 0;
while(!check_file_exists_with_instructions(template_path(), templates_url, is_pow_two_or_0(count))) {
++count;
std::this_thread::sleep_for(1s);
}
// // Check config is present and give instructions for downloading it if not
// // If the file is not present log an error and wait a second. Continue to log the error ever power of 2 seconds until the file appears or the process is killed.
// uint32_t count = 0;
// while(!check_file_exists_with_instructions(config_path(), config_url, is_pow_two_or_0(count))) {
// ++count;
// std::this_thread::sleep_for(1s);
// }
// count = 0;
// while(!check_file_exists_with_instructions(template_path(), templates_url, is_pow_two_or_0(count))) {
// ++count;
// std::this_thread::sleep_for(1s);
// }
// If we waited for someone to download the file give it a second to be finished downloading
if (count > 0) {
std::this_thread::sleep_for(1s);
}
}
// // If we waited for someone to download the file give it a second to be finished downloading
// if (count > 0) {
// std::this_thread::sleep_for(1s);
// }
// }
SecurityType::type infer_security_type(const string& label) {
if (label.find("Option") != std::string::npos) {
return SecurityType::OPTION;
}
// SecurityType::type infer_security_type(const string& label) {
// if (label.find("Option") != std::string::npos) {
// return SecurityType::OPTION;
// }
if (label.find("Future") != std::string::npos) {
return SecurityType::FUTURE;
}
// if (label.find("Future") != std::string::npos) {
// return SecurityType::FUTURE;
// }
// TODO: Allow configuration to override this?
LOG(MarketData,Warn,"Unable to guess security type from label: '{}"
"' Treating as OPTION.",label);
return SecurityType::OPTION;
}
// // TODO: Allow configuration to override this?
// LOG(MarketData,Warn,"Unable to guess security type from label: '{}"
// "' Treating as OPTION.",label);
// return SecurityType::OPTION;
// }
const vector<CMEChannel> parse_channels(const vector<UserSymbol>& symbols) {
vector<CMEChannel> result;
// const vector<CMEChannel> parse_channels(const vector<UserSymbol>& symbols) {
// vector<CMEChannel> result;
pugi::xml_document doc;
bts_assert_msg(doc.load_file(config_path().c_str()), "Error parsing config.xml as xml");
// pugi::xml_document doc;
// bts_assert_msg(doc.load_file(config_path().c_str()), "Error parsing config.xml as xml");
auto configuration = doc.root().child("configuration");
bts_assert(configuration);
// auto configuration = doc.root().child("configuration");
// bts_assert(configuration);
LOG(MarketData,Info,"CME: Loaded '{}' config. Last updated: {}" ,
configuration.attribute("environment").as_string(),
configuration.attribute("updated").as_string());
auto channels = configuration.children("channel");
for (const auto& chan : channels) {
CMEChannel channel;
channel.id = chan.attribute("id").as_string();
auto type = infer_security_type(chan.attribute("label").as_string());
if (!(channel.id.empty())) {
auto product_list = chan.child("products").children("product");
for (const auto& product : product_list) {
auto symbol = product.attribute("code").as_string();
for (auto s : symbols) {
if ((s.type() == type || s.type() == SecurityType::SPREAD) && s.symbol() == symbol) {
channel.symbols.insert(s);
}
}
}
if (!channel.symbols.empty()) {
result.push_back(channel);
}
}
}
// LOG(MarketData,Info,"CME: Loaded '{}' config. Last updated: {}" ,
// configuration.attribute("environment").as_string(),
// configuration.attribute("updated").as_string());
// auto channels = configuration.children("channel");
// for (const auto& chan : channels) {
// CMEChannel channel;
// channel.id = chan.attribute("id").as_string();
// auto type = infer_security_type(chan.attribute("label").as_string());
// if (!(channel.id.empty())) {
// auto product_list = chan.child("products").children("product");
// for (const auto& product : product_list) {
// auto symbol = product.attribute("code").as_string();
// for (auto s : symbols) {
// if ((s.type() == type || s.type() == SecurityType::SPREAD) && s.symbol() == symbol) {
// channel.symbols.insert(s);
// }
// }
// }
// if (!channel.symbols.empty()) {
// result.push_back(channel);
// }
// }
// }
return result;
}
// return result;
// }
}}//namespace
#endif
// }}//namespace
// #endif
@@ -1,210 +1,210 @@
#include "catch/catch.hpp"
// #include "catch/catch.hpp"
#include "lib/config/config.h"
#include "lib/config/protos/MarketData.pb.h"
// #include "lib/config/config.h"
// #include "lib/config/protos/MarketData.pb.h"
#include <vector>
#include <string>
#include <functional>
#include <stdarg.h>
// #include <vector>
// #include <string>
// #include <functional>
// #include <stdarg.h>
#include "../MDP3Utils.h"
#include "../onixs.h"
// #include "../MDP3Utils.h"
// #include "../onixs.h"
using namespace bts::md;
using namespace std;
// using namespace bts::md;
// using namespace std;
namespace bts {
namespace md {
// namespace bts {
// namespace md {
map<string, onixs::FeedEngineSettings> create_feed_engine_settings(const std::vector<CMEChannel>& channels);
const CMEOptions::CMEChannel channel_settings_for(const string& id);
// map<string, onixs::FeedEngineSettings> create_feed_engine_settings(const std::vector<CMEChannel>& channels);
// const CMEOptions::CMEChannel channel_settings_for(const string& id);
namespace test {
// namespace test {
vector<CMEChannel> test_channels(int count, ...) {
// Doing this the C way because I still haven't updated VS
vector<CMEChannel> result;
va_list ap;
va_start(ap, count);
for (int x = 0; x < count; ++x) {
const char* val = va_arg(ap, char*);
CMEChannel temp;
temp.id = val;
result.push_back(temp);
}
va_end(ap);
return result;
}
// vector<CMEChannel> test_channels(int count, ...) {
// // Doing this the C way because I still haven't updated VS
// vector<CMEChannel> result;
// va_list ap;
// va_start(ap, count);
// for (int x = 0; x < count; ++x) {
// const char* val = va_arg(ap, char*);
// CMEChannel temp;
// temp.id = val;
// result.push_back(temp);
// }
// va_end(ap);
// return result;
// }
TEST_CASE("mdp3_tests","[md]") {
SECTION("test_defaults") {
config::internal::initialize_for_test("CMEOptions {}");
// TEST_CASE("mdp3_tests","[md]") {
// SECTION("test_defaults") {
// config::internal::initialize_for_test("CMEOptions {}");
vector<CMEChannel> channels = test_channels(1, "310");
auto result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 0);
// vector<CMEChannel> channels = test_channels(1, "310");
// auto result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 0);
channels = test_channels(2, "310", "311");
result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 0);
// channels = test_channels(2, "310", "311");
// result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 0);
channels = test_channels(4, "310", "311", "400", "412");
result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 0);
// channels = test_channels(4, "310", "311", "400", "412");
// result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 0);
REQUIRE(!channel_settings_for("310").has_feed_engine());
REQUIRE(!channel_settings_for("311").has_feed_engine());
REQUIRE(!channel_settings_for("315").has_feed_engine());
}
// REQUIRE(!channel_settings_for("310").has_feed_engine());
// REQUIRE(!channel_settings_for("311").has_feed_engine());
// REQUIRE(!channel_settings_for("315").has_feed_engine());
// }
SECTION("test_segregate_futures") {
config::internal::initialize_for_test(
"CMEOptions {\n"
" value {\n"
" feed_engine {\n"
" name: 'default'\n"
" }\n"
" feed_engine {\n"
" name: 'futures'\n"
" num_threads: 4\n"
" }\n"
" # Futures\n"
" channel {\n"
" id: '310'\n"
" id: '312'\n"
" feed_engine: 'futures'\n"
" }\n"
" # Options\n"
" channel {\n"
" id: '311'\n"
" id: '313'\n"
" id: '315'\n"
" feed_engine: 'default'\n"
" }\n"
" }\n"
"}");
// SECTION("test_segregate_futures") {
// config::internal::initialize_for_test(
// "CMEOptions {\n"
// " value {\n"
// " feed_engine {\n"
// " name: 'default'\n"
// " }\n"
// " feed_engine {\n"
// " name: 'futures'\n"
// " num_threads: 4\n"
// " }\n"
// " # Futures\n"
// " channel {\n"
// " id: '310'\n"
// " id: '312'\n"
// " feed_engine: 'futures'\n"
// " }\n"
// " # Options\n"
// " channel {\n"
// " id: '311'\n"
// " id: '313'\n"
// " id: '315'\n"
// " feed_engine: 'default'\n"
// " }\n"
// " }\n"
// "}");
vector<CMEChannel> channels = test_channels(1, "310");
auto result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 1);
REQUIRE(result.begin()->first == "futures");
REQUIRE(result.begin()->second.threadsCount() == 4);
// vector<CMEChannel> channels = test_channels(1, "310");
// auto result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 1);
// REQUIRE(result.begin()->first == "futures");
// REQUIRE(result.begin()->second.threadsCount() == 4);
channels = test_channels(1, "311");
result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 1);
REQUIRE(result.begin()->first == "default");
REQUIRE(result.begin()->second.threadsCount() == 1);
// channels = test_channels(1, "311");
// result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 1);
// REQUIRE(result.begin()->first == "default");
// REQUIRE(result.begin()->second.threadsCount() == 1);
channels = test_channels(2, "311", "310");
result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 2);
REQUIRE(result["default"].threadsCount() == 1);
REQUIRE(result["futures"].threadsCount() == 4);
// channels = test_channels(2, "311", "310");
// result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 2);
// REQUIRE(result["default"].threadsCount() == 1);
// REQUIRE(result["futures"].threadsCount() == 4);
// Test channels not listed in config
channels = test_channels(2, "317", "318");
result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 0);
}
// // Test channels not listed in config
// channels = test_channels(2, "317", "318");
// result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 0);
// }
SECTION("test_no_default") {
config::internal::initialize_for_test(
"CMEOptions {\n"
" value {\n"
" feed_engine {\n"
" name: 'futures'\n"
" num_threads: 4\n"
" }\n"
" # any channel not listed will use the default feed engine\n"
" # Futures\n"
" channel {\n"
" id: '310'\n"
" id: '312'\n"
" feed_engine: 'futures'\n"
" }\n"
" # Options\n"
" channel {\n"
" id: '311'\n"
" id: '313'\n"
" id: '315'\n"
" use_tcp_replay: false\n"
" }\n"
" }\n"
"}");
// SECTION("test_no_default") {
// config::internal::initialize_for_test(
// "CMEOptions {\n"
// " value {\n"
// " feed_engine {\n"
// " name: 'futures'\n"
// " num_threads: 4\n"
// " }\n"
// " # any channel not listed will use the default feed engine\n"
// " # Futures\n"
// " channel {\n"
// " id: '310'\n"
// " id: '312'\n"
// " feed_engine: 'futures'\n"
// " }\n"
// " # Options\n"
// " channel {\n"
// " id: '311'\n"
// " id: '313'\n"
// " id: '315'\n"
// " use_tcp_replay: false\n"
// " }\n"
// " }\n"
// "}");
vector<CMEChannel> channels = test_channels(1, "310");
auto result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 1);
REQUIRE(result.begin()->first == "futures");
REQUIRE(result.begin()->second.threadsCount() == 4);
// vector<CMEChannel> channels = test_channels(1, "310");
// auto result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 1);
// REQUIRE(result.begin()->first == "futures");
// REQUIRE(result.begin()->second.threadsCount() == 4);
channels = test_channels(1, "311");
result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 0);
// channels = test_channels(1, "311");
// result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 0);
channels = test_channels(2, "311", "310");
result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 1);
REQUIRE(result["futures"].threadsCount() == 4);
// channels = test_channels(2, "311", "310");
// result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 1);
// REQUIRE(result["futures"].threadsCount() == 4);
REQUIRE(channel_settings_for("310").use_tcp_replay() == true);
REQUIRE(channel_settings_for("311").use_tcp_replay() == false);
REQUIRE(channel_settings_for("315").use_tcp_replay() == false);
}
// REQUIRE(channel_settings_for("310").use_tcp_replay() == true);
// REQUIRE(channel_settings_for("311").use_tcp_replay() == false);
// REQUIRE(channel_settings_for("315").use_tcp_replay() == false);
// }
SECTION("test_one_thread_each") {
config::internal::initialize_for_test(
"CMEOptions {\n"
" value {\n"
" channel {\n"
" id: '*'\n"
" }\n"
" }\n"
"}\n");
// SECTION("test_one_thread_each") {
// config::internal::initialize_for_test(
// "CMEOptions {\n"
// " value {\n"
// " channel {\n"
// " id: '*'\n"
// " }\n"
// " }\n"
// "}\n");
vector<CMEChannel> channels = test_channels(1, "310", "311");
auto result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 0);
// vector<CMEChannel> channels = test_channels(1, "310", "311");
// auto result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 0);
const auto& settings = channel_settings_for("311");
REQUIRE(!settings.has_feed_engine());
}
// const auto& settings = channel_settings_for("311");
// REQUIRE(!settings.has_feed_engine());
// }
SECTION("test_common_futures_thread") {
config::internal::initialize_for_test(
"CMEOptions {\n"
" value {\n"
" feed_engine {\n"
" name: 'futures'\n"
" num_threads: 4\n"
" }\n"
" channel {\n"
" id: '310'\n"
" feed_engine: 'futures'\n"
" udp_socket_buffer_size: 1234\n"
" }\n"
" channel {\n"
" id: '*'\n"
" }\n"
" }\n"
"}\n");
// SECTION("test_common_futures_thread") {
// config::internal::initialize_for_test(
// "CMEOptions {\n"
// " value {\n"
// " feed_engine {\n"
// " name: 'futures'\n"
// " num_threads: 4\n"
// " }\n"
// " channel {\n"
// " id: '310'\n"
// " feed_engine: 'futures'\n"
// " udp_socket_buffer_size: 1234\n"
// " }\n"
// " channel {\n"
// " id: '*'\n"
// " }\n"
// " }\n"
// "}\n");
vector<CMEChannel> channels = test_channels(6, "310", "311", "315", "100", "10", "42");
auto result = create_feed_engine_settings(channels);
REQUIRE(result.size() == 1);
result = create_feed_engine_settings(test_channels(1, "315"));
REQUIRE(result.size() == 0);
// vector<CMEChannel> channels = test_channels(6, "310", "311", "315", "100", "10", "42");
// auto result = create_feed_engine_settings(channels);
// REQUIRE(result.size() == 1);
// result = create_feed_engine_settings(test_channels(1, "315"));
// REQUIRE(result.size() == 0);
REQUIRE(!channel_settings_for("311").has_feed_engine());
REQUIRE(channel_settings_for("310").has_feed_engine());
REQUIRE(channel_settings_for("310").udp_socket_buffer_size() == 1234);
REQUIRE(channel_settings_for("311").has_udp_socket_buffer_size() == false);
}
}
// REQUIRE(!channel_settings_for("311").has_feed_engine());
// REQUIRE(channel_settings_for("310").has_feed_engine());
// REQUIRE(channel_settings_for("310").udp_socket_buffer_size() == 1234);
// REQUIRE(channel_settings_for("311").has_udp_socket_buffer_size() == false);
// }
// }
}}}//namespace
// }}}//namespace
@@ -2,6 +2,7 @@
#include <cstdint>
#include <string>
#include <array>
#include "lib/utils/ValueWrapper.h"
#include "lib/domain_model/common.h"
@@ -13,6 +14,7 @@ using FIXSessionName = utils::ValueWrapper<struct FIXSessionNameTag,std::string>
using OperatorID = utils::ValueWrapper<struct OperatorIDTag,std::string>;
using ExchangeOrderID = utils::ValueWrapper<struct ExchangeOrderIDTag,std::string>;
using OrderTimeStamp = std::array<char, sizeof("20121204-14:44:02.000")-1> ;
using SymbolName = utils::ValueWrapper<struct SymbolNameTag, std::string>;
}}
@@ -0,0 +1,9 @@
#include "IRiskLimitObserver.h"
namespace bts
{
namespace risklimits
{
IRiskLimitObserver::~IRiskLimitObserver() {}
}
}
@@ -0,0 +1,18 @@
#pragma once
#include "server/sparkd/order_man/order_man_utils.h"
namespace bts
{
namespace risklimits
{
class RiskLimitState;
class IRiskLimitObserver
{
public:
virtual ~IRiskLimitObserver();
virtual void on_account_limit_breach(AccountName) = 0;
virtual void on_operator_limit_breach(orderman::OperatorID) = 0;
};
}
}
@@ -0,0 +1,123 @@
#include "RiskLimitManager.h"
#include "server/sparkd/risk_limits/RiskLimiter.h"
#include "server/sparkd/order_man/OrderCreate.h"
#include "server/sparkd/order_man/OrderUpdate.h"
#include "server/sparkd/order_man/OrderState.h"
#include "lib/config/config.h"
#include "lib/config/protos/Account.pb.h"
#include "lib/config/protos/User.pb.h"
#include "lib/utils/bts_assert.h"
#include "lib/logging/logging.h"
#include <boost/container/flat_map.hpp>
#include <tuple>
using namespace bts::orderman;
namespace bts {
namespace risklimits {
using OperatorMap = boost::container::flat_map<std::string, config::Operator>;
using KeyType = std::tuple<AccountName, orderman::OperatorID, orderman::SymbolName>;
using LimiterMap = boost::container::flat_map<KeyType, std::shared_ptr<RiskLimiter>>;
struct RiskLimitManager::PImpl
{
OperatorMap operator_map;
LimiterMap limiter_map;
PImpl() :
operator_map(), limiter_map()
{
auto users = config::get<config::UserCfg>();
for(int i = 0; i < users.user_size(); i++)
{
auto user = users.user(i);
for(int j = 0; i < user.operators_size(); j++)
operator_map[user.operators(j).operator_id().id()] = user.operators(j);
}
auto accts = config::get<config::AccountCfg>();
for(int i = 0; i < accts.accounts_size(); i++)
{
const auto& acct = accts.accounts(i).account();
const auto& limit = accts.accounts(i).limits();
for(auto j = limit.begin(); j != limit.end(); j++)
{
for(int k = 0; k < acct.allowed_operators_size(); k++)
{
auto allowed = operator_map.find(acct.allowed_operators(k).id());
if(allowed != operator_map.end())
{
orderman::OperatorID opid(allowed->second.operator_id().id());
KeyType key(to_accountname(acct), opid, to_symbolname(j->first));
RiskLimiter* lim = new RiskLimiter(std::get<0>(key), std::get<1>(key), std::get<2>(key));
limiter_map[key] = std::shared_ptr<RiskLimiter>(lim);
lim->on_account_update(acct);
lim->on_operator_update(allowed->second);
lim->on_risk_limit_update(j->second);
}
}
}
}
}
orderman::SymbolName to_symbolname(SecurityKey)
{
return to_symbolname("ES");
}
orderman::SymbolName to_symbolname(const std::string& key)
{
return orderman::SymbolName(key);
}
AccountName to_accountname(const config::Account& key)
{
return AccountName(key.account_id());
}
RiskLimiter& find_limiter(AccountName acctname, orderman::OperatorID opid, orderman::SymbolName symbolname)
{
KeyType key(acctname, opid, symbolname);
auto lim = limiter_map.find(key);
if(lim != limiter_map.end())
return *lim->second;
else
{
RiskLimiter* lim = new RiskLimiter(std::get<0>(key), std::get<1>(key), std::get<2>(key));
auto ptr = std::shared_ptr<RiskLimiter>(lim);
limiter_map[key] = ptr;
return *ptr;
}
}
};
RiskLimitManager::RiskLimitManager() : me(new PImpl())
{
}
RiskLimitManager::~RiskLimitManager()
{
}
const RiskLimiter& RiskLimitManager::find_limiter(AccountName acctname, orderman::OperatorID opid, orderman::SymbolName symbolname)
{
return me->find_limiter(acctname, opid, symbolname);
}
void RiskLimitManager::on_orderman_ready() { }
void RiskLimitManager::on_orderman_disconnected() { }
void RiskLimitManager::on_order_create(const orderman::OrderState &) { }
void RiskLimitManager::on_order_change(const orderman::OrderState& state)
{
RiskLimiter& lim = me->find_limiter(state.account_name, state.operator_id, me->to_symbolname(state.security_key));
lim.on_order_change(state);
}
}
}
@@ -0,0 +1,33 @@
#pragma once
#include <memory>
#include <functional>
#include "server/sparkd/order_man/order_man_utils.h"
#include "server/sparkd/order_man/IOrderObserver.h"
namespace bts
{
namespace risklimits
{
class RiskLimiter;
class RiskLimitManager : public orderman::IOrderObserver
{
public:
RiskLimitManager();
~RiskLimitManager();
const RiskLimiter& find_limiter(AccountName, orderman::OperatorID, orderman::SymbolName);
protected:
virtual void on_orderman_ready();
virtual void on_orderman_disconnected();
virtual void on_order_create(const orderman::OrderState&);
virtual void on_order_change(const orderman::OrderState&);
private:
struct PImpl;
std::unique_ptr<PImpl> me;
};
}
}
@@ -0,0 +1,203 @@
#include "RiskLimiter.h"
#include "server/sparkd/risk_limits/IRiskLimitObserver.h"
#include "server/sparkd/order_man/OrderState.h"
#include "lib/config/config.h"
#include "lib/config/protos/Account.pb.h"
#include "lib/config/protos/User.pb.h"
#include "lib/utils/bts_assert.h"
#include "lib/logging/logging.h"
#include <boost/container/flat_map.hpp>
#include <sstream>
#include <vector>
using namespace bts::orderman;
namespace bts {
namespace risklimits {
struct RiskLimiter::PImpl
{
struct AccountInfo { AccountName account;
int cash_position; bool can_trade; } account_info;
struct OperatorInfo { orderman::OperatorID opid;
bool can_trade; } operator_info;
struct SymbolInfo { orderman::SymbolName symbol;
uint32_t long_position; uint32_t short_position;
uint32_t long_working; uint32_t short_working; } symbol_info;
config::RiskLimit risk_limit;
std::vector<IRiskLimitObserver*> observers;
std::string message_suffix;
PImpl(AccountName acct, orderman::OperatorID oid, orderman::SymbolName sym) :
account_info({ acct, 0, false }),
operator_info({ oid, false }),
symbol_info({ sym, 0u, 0u, 0u, 0u }),
risk_limit(),
observers(),
message_suffix()
{
message_suffix = " Additional Information: AccountName: " + account_info.account.value()
+ " OperatorID: " + operator_info.opid.value()
+ " Symbol: " + symbol_info.symbol.value();
}
bool check_can_trade(std::string& message)
{
if(!account_info.can_trade)
{
std::ostringstream oss; oss << "Account " << account_info.account.value()
<< " does not have permission to trade." << message_suffix;
message = oss.str();
return false;
}
if(!operator_info.can_trade)
{
std::ostringstream oss; oss << "Operator " << operator_info.opid.value()
<< " does not have permission to trade." << message_suffix;
message = oss.str();
return false;
}
return true;
}
bool check_clip_size(Quantity qty, std::string& message)
{
if(qty.value() > risk_limit.max_order_size())
{
std::ostringstream oss; oss << "Max Clip Size Violation: quantity " << qty.value()
<< " violates limit " << risk_limit.max_order_size() << message_suffix;
message = oss.str();
return false;
}
return true;
}
bool check_position_limit(const api::Security*, Quantity qty, api::BuySell side, std::string& message)
{
if(side == api::BUY && symbol_info.long_position + symbol_info.long_working + qty.value() > risk_limit.max_position_long())
{
std::ostringstream oss; oss << "Max Position Long Violation: quantity " << qty.value()
<< " violates limit " << risk_limit.max_position_long() << message_suffix;
message = oss.str();
return false;
}
if(side == api::SELL && symbol_info.short_position + symbol_info.short_working + qty.value() > risk_limit.max_position_short())
{
std::ostringstream oss; oss << "Max Position Short Violation: quantity " << qty.value()
<< " violates limit " << risk_limit.max_position_short() << message_suffix;
message = oss.str();
return false;
}
//TODO spreads
int position_change = (side == api::SELL ? -1 : 1) * qty.value();
int net_pos = (int)symbol_info.long_position - (int)symbol_info.short_position;
if(abs(net_pos + position_change) > (int)risk_limit.max_position_net())
{
std::ostringstream oss; oss << "Max Position Net Violation: quantity " << qty.value()
<< " violates limit " << risk_limit.max_position_net() << message_suffix;
message = oss.str();
return false;
}
return true;
}
void notify_account_breach()
{
for(auto& i : observers)
i->on_account_limit_breach(account_info.account);
}
void notify_operator_breach()
{
for(auto& i : observers)
i->on_operator_limit_breach(operator_info.opid);
}
};
RiskLimiter::RiskLimiter(AccountName acct, orderman::OperatorID opid, orderman::SymbolName symbol)
: me(new PImpl(acct, opid, symbol))
{
}
RiskLimiter::~RiskLimiter()
{
}
RiskLimiter::RiskLimitResult RiskLimiter::pretrade_risk_check(const api::Security* sec, Quantity qty, api::BuySell side) const
{
RiskLimiter::RiskLimitResult res;
res.success = me->check_can_trade(res.message);
if(!res.success)
return res;
res.success = me->check_clip_size(qty, res.message);
if(!res.success)
return res;
res.success = me->check_position_limit(sec, qty, side, res.message);
return res;
}
void RiskLimiter::subscribe(IRiskLimitObserver& obs) const
{
me->observers.push_back(&obs);
}
void RiskLimiter::on_account_update(const config::Account& acct)
{
bts_assert(acct.account_id() == me->account_info.account.value());
bool prev = me->account_info.can_trade;
me->account_info.can_trade = acct.can_trade();
if(prev && prev != me->account_info.can_trade)
me->notify_account_breach();
me->account_info.cash_position = acct.cash_position();
//TODO SPAN
}
void RiskLimiter::on_operator_update(const config::Operator& oper)
{
bts_assert(oper.operator_id().id() == me->operator_info.opid.value());
bool prev = me->operator_info.can_trade;
me->operator_info.can_trade = oper.can_trade();
if(prev && prev != me->operator_info.can_trade)
me->notify_operator_breach();
}
void RiskLimiter::on_risk_limit_update(const config::RiskLimit& risk)
{
me->risk_limit = risk;
}
void RiskLimiter::on_order_change(const orderman::OrderState&)
{
//auto& sec_map = me->position[state.account_name];
//auto sec_entry = sec_map.find(state.security_key);
//int current_qty = 0;
//if(sec_entry == sec_map.end())
// sec_map[state.security_key] = current_qty;
//else
// current_qty = sec_entry->second;
//if(state.side == api::BUY)
//{
// me->symbol_info.long_position uint32_t filled = state.filled_quantity.value();
// uint32_t working = state.remaining_quantity.value();
//}
//else
//{
//}
//uint32_t filled = state.filled_quantity.value();
//uint32_t working = state.remaining_quantity.value();
//int total = (state.side == api::BuySell::SELL ? -1 : 1) * (filled + working);
//sec_map[state.security_key] = total + current_qty;
}
}
}
@@ -0,0 +1,46 @@
#pragma once
#include "lib/domain_model/Security.pb.h"
#include "server/sparkd/order_man/order_man_utils.h"
#include <memory>
#include <functional>
namespace bts {
namespace api { class Security; }
namespace orderman {
class OrderState;
}
namespace config{
class Account;
class Operator;
class RiskLimit;
}
namespace risklimits
{
class RiskLimitManager;
class IRiskLimitObserver;
class RiskLimiter
{
public:
struct RiskLimitResult { bool success; std::string message; };
RiskLimiter(AccountName, orderman::OperatorID, orderman::SymbolName);
~RiskLimiter();
RiskLimitResult pretrade_risk_check(const api::Security*, Quantity, api::BuySell) const;
void subscribe(IRiskLimitObserver&) const;
protected:
friend class RiskLimitManager;
void on_account_update(const config::Account&);
void on_operator_update(const config::Operator&);
void on_risk_limit_update(const config::RiskLimit&);
void on_order_change(const orderman::OrderState&);
private:
struct PImpl;
std::unique_ptr<PImpl> me;
};
}
}
+16 -5
View File
@@ -41,13 +41,19 @@
<ClCompile Include="order_man\IOrderObserver.cpp" />
<ClCompile Include="order_man\Order.cpp" />
<ClCompile Include="order_man\OrderMan.cpp" />
<ClCompile Include="order_man\OrderState.cpp" />
<ClCompile Include="order_man\OrderStore.cpp" />
<ClCompile Include="order_man\WorkingOrder.cpp" />
<ClCompile Include="persistence\IStore.cpp" />
<ClCompile Include="persistence\PersistenceServiceServer.cpp" />
<ClCompile Include="persistence\SqliteStore.cpp" />
<ClCompile Include="persistence\tests\PersistenceServiceTests.cpp" />
<ClCompile Include="risk_limits\IRiskLimitObserver.cpp" />
<ClCompile Include="risk_limits\RiskLimitManager.cpp" />
<ClCompile Include="risk_limits\RiskLimiter.cpp" />
<ClCompile Include="setup\BootstrapActor.cpp" />
<ClCompile Include="setup\ServiceHostActor.cpp" />
<ClCompile Include="spreader\SpreaderBase.cpp" />
<ClCompile Include="testing\catch_test_runner.cpp" />
<ClCompile Include="user\UserServiceServer.cpp" />
</ItemGroup>
@@ -115,8 +121,13 @@
<ClInclude Include="persistence\IStore.h" />
<ClInclude Include="persistence\PersistenceServiceServer.h" />
<ClInclude Include="persistence\SqliteStore.h" />
<ClInclude Include="risk_limits\IRiskLimitObserver.h" />
<ClInclude Include="risk_limits\RiskLimitManager.h" />
<ClInclude Include="risk_limits\RiskLimiter.h" />
<ClInclude Include="setup\BootstrapActor.h" />
<ClInclude Include="setup\ServiceHostActor.h" />
<ClInclude Include="spreader\Spreader.h" />
<ClInclude Include="spreader\SpreaderBase.h" />
<ClInclude Include="testing\catch_test_runner.h" />
<ClInclude Include="user\UserServiceServer.h" />
</ItemGroup>
@@ -146,7 +157,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<ConfigurationType>Makefile</ConfigurationType>
<RemoteRootDir>/bts/spark/</RemoteRootDir>
<RemoteRootDir>/bts/</RemoteRootDir>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
@@ -159,8 +170,8 @@
<RemoteProjectDir>$(RemoteRootDir)/src/server/$(ProjectName)</RemoteProjectDir>
<LocalRemoteCopySources>false</LocalRemoteCopySources>
<NMakeIncludeSearchPath>.;$(ProjectDir)..\..\..\build\gcc_debug\src;$(ProjectDir)..\..\..\src;$(ProjectDir)..\..\..\externals\linux\include</NMakeIncludeSearchPath>
<RemoteBuildCommandLine>cd $(RemoteRootDir)/build/gcc_debug; make -j$(NUMBER_OF_PROCESSORS)</RemoteBuildCommandLine>
<RemoteReBuildCommandLine>cd $(RemoteRootDir)/build/gcc_debug; make -j$(NUMBER_OF_PROCESSORS) --always-make</RemoteReBuildCommandLine>
<RemoteBuildCommandLine>cd $(RemoteRootDir)/build/gcc_debug; make -j4</RemoteBuildCommandLine>
<RemoteReBuildCommandLine>cd $(RemoteRootDir)/build/gcc_debug; make -j4 --always-make</RemoteReBuildCommandLine>
<RemoteCleanCommandLine>rm -rf $(RemoteRootDir)/build/windows; cd $(RemoteRootDir)/tools; ./setup_builds.sh</RemoteCleanCommandLine>
<RemoteBuildOutputs>$(RemoteRootDir)/build/gcc_debug/src/server/sparkd/sparkd</RemoteBuildOutputs>
</PropertyGroup>
@@ -170,8 +181,8 @@
<RemoteProjectDir>$(RemoteRootDir)/src/server/$(ProjectName)</RemoteProjectDir>
<LocalRemoteCopySources>false</LocalRemoteCopySources>
<NMakeIncludeSearchPath>.;$(ProjectDir)..\..\..\build\gcc_release\src;$(ProjectDir)..\..\..\src;$(ProjectDir)..\..\..\externals\linux\include</NMakeIncludeSearchPath>
<RemoteBuildCommandLine>cd $(RemoteRootDir)/build/gcc_release; make -j$(NUMBER_OF_PROCESSORS)</RemoteBuildCommandLine>
<RemoteReBuildCommandLine>cd $(RemoteRootDir)/build/gcc_release; make -j$(NUMBER_OF_PROCESSORS) --always-make</RemoteReBuildCommandLine>
<RemoteBuildCommandLine>cd $(RemoteRootDir)/build/gcc_release; make -j4</RemoteBuildCommandLine>
<RemoteReBuildCommandLine>cd $(RemoteRootDir)/build/gcc_release; make -j4 --always-make</RemoteReBuildCommandLine>
<RemoteCleanCommandLine>rm -rf $(RemoteRootDir)/build/windows; cd $(RemoteRootDir)/tools; ./setup_builds.sh</RemoteCleanCommandLine>
<RemoteBuildOutputs>$(RemoteRootDir)/build/gcc_release/src/server/sparkd/sparkd</RemoteBuildOutputs>
</PropertyGroup>
+139 -100
View File
@@ -2,67 +2,67 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="algo_man">
<UniqueIdentifier>{dae3f3ba-2866-40ce-9406-c7dde4775f64}</UniqueIdentifier>
<UniqueIdentifier>{8aa8d139-e5a9-4405-9b7c-8779ad948326}</UniqueIdentifier>
</Filter>
<Filter Include="fabric">
<UniqueIdentifier>{6cd6e5f8-469d-469e-a6a0-0cb9cd4d0bc8}</UniqueIdentifier>
<UniqueIdentifier>{ac47930d-db8a-41ce-9e9e-9411f965b857}</UniqueIdentifier>
</Filter>
<Filter Include="fabric\tests">
<UniqueIdentifier>{06b7ab31-524f-4031-82aa-96f92cff60c3}</UniqueIdentifier>
<UniqueIdentifier>{074d7ffe-f5d3-4419-9ec4-b00340066884}</UniqueIdentifier>
</Filter>
<Filter Include="order_man">
<UniqueIdentifier>{e847882f-a755-4ffc-ac7e-b9a5a878b91e}</UniqueIdentifier>
</Filter>
<Filter Include="order_man\doc">
<UniqueIdentifier>{54e812d7-6d50-4049-a6e3-5c3cf42a4fbb}</UniqueIdentifier>
<UniqueIdentifier>{5d8325d0-a5b1-45f8-a573-f2fe02e29586}</UniqueIdentifier>
</Filter>
<Filter Include="persistence">
<UniqueIdentifier>{2491c471-f614-4fe5-8cb5-94fa44019527}</UniqueIdentifier>
<UniqueIdentifier>{8d56323c-cf5a-46b2-b2c6-1a2f2b526f67}</UniqueIdentifier>
</Filter>
<Filter Include="persistence\tests">
<UniqueIdentifier>{d926dd23-6d44-41b8-b9c8-cfa20f06ff0e}</UniqueIdentifier>
<UniqueIdentifier>{11203fdd-0089-4076-850e-f58a6a4e939a}</UniqueIdentifier>
</Filter>
<Filter Include="setup">
<UniqueIdentifier>{19c65da0-0717-4a8c-a910-3ef63a4a63a4}</UniqueIdentifier>
<UniqueIdentifier>{5d7f204e-e56d-4ef9-98d0-f29612559cf7}</UniqueIdentifier>
</Filter>
<Filter Include="testing">
<UniqueIdentifier>{2e5896c9-fd71-4b2f-b715-fb1dc6a89e0e}</UniqueIdentifier>
<UniqueIdentifier>{71108ec9-94e6-42f6-a221-54dda45eedda}</UniqueIdentifier>
</Filter>
<Filter Include="user">
<UniqueIdentifier>{dd1ff471-aa46-413b-97c3-90f82bac704c}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix">
<UniqueIdentifier>{b04bea55-1b62-403a-b5bb-97dc3601a4ec}</UniqueIdentifier>
<UniqueIdentifier>{9fbc24fc-eec9-44a9-a941-08ea8a1eb69d}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\codec">
<UniqueIdentifier>{cc93ee44-64af-4e4f-a714-7180f22370ba}</UniqueIdentifier>
<UniqueIdentifier>{bc18f0cc-0687-4c04-90d6-b39f7356aee9}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix">
<UniqueIdentifier>{62955ada-d637-4507-b48f-6bd14b1303a9}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\common">
<UniqueIdentifier>{ee8fff97-22a1-4b4b-9e69-88a7fa8c42ed}</UniqueIdentifier>
<UniqueIdentifier>{d3ced241-d6f5-4879-916a-972d4afdbab5}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\connection">
<UniqueIdentifier>{d4060e3f-e348-444c-992a-f626a4d36efc}</UniqueIdentifier>
<UniqueIdentifier>{fa84ea1e-66f6-4233-81c6-e931c5a281ab}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\gateway">
<UniqueIdentifier>{a2f7393f-fb54-4047-bada-35de3723bcc3}</UniqueIdentifier>
<UniqueIdentifier>{ef257633-7d10-4eb6-997c-d0630cc7504b}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\store">
<UniqueIdentifier>{880f5550-886e-4b25-8b4f-dba4720c2e5e}</UniqueIdentifier>
<UniqueIdentifier>{c84d748c-21be-4dc9-97fa-0e32845425c0}</UniqueIdentifier>
</Filter>
<Filter Include="jetfix\tests">
<UniqueIdentifier>{b75d6a62-3456-44bc-861b-bdbd0055a611}</UniqueIdentifier>
<UniqueIdentifier>{5805e68c-5ac2-4a7c-beb7-5e5384bf63a8}</UniqueIdentifier>
</Filter>
<Filter Include="risk_limits">
<UniqueIdentifier>{b72e6380-b7f6-4f9c-91b5-641ea80b16e7}</UniqueIdentifier>
</Filter>
<Filter Include="order_man\doc">
<UniqueIdentifier>{09fdc676-83bf-4f62-9121-dcbd4bc7bb66}</UniqueIdentifier>
</Filter>
<Filter Include="spreader">
<UniqueIdentifier>{3ac2bf85-92ae-450e-8b7d-87515fa93fcd}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="algo_man\AlgoManServiceServer.cpp">
<Filter>algo_man</Filter>
</ClCompile>
<ClCompile Include="fabric\tests\baseline_perf_fabric_test.cpp">
<Filter>fabric\tests</Filter>
</ClCompile>
<ClCompile Include="fabric\tests\fabric_test.cpp">
<Filter>fabric\tests</Filter>
</ClCompile>
<ClCompile Include="fabric\Actor.cpp">
<Filter>fabric</Filter>
</ClCompile>
@@ -81,6 +81,12 @@
<ClCompile Include="fabric\TopicDirectory.cpp">
<Filter>fabric</Filter>
</ClCompile>
<ClCompile Include="fabric\tests\baseline_perf_fabric_test.cpp">
<Filter>fabric\tests</Filter>
</ClCompile>
<ClCompile Include="fabric\tests\fabric_test.cpp">
<Filter>fabric\tests</Filter>
</ClCompile>
<ClCompile Include="order_man\IFIXGateway.cpp">
<Filter>order_man</Filter>
</ClCompile>
@@ -120,7 +126,12 @@
<ClCompile Include="user\UserServiceServer.cpp">
<Filter>user</Filter>
</ClCompile>
<ClCompile Include="main.cpp" />
<ClCompile Include="jetfix\codec\FIXArray.cpp">
<Filter>jetfix\codec</Filter>
</ClCompile>
<ClCompile Include="jetfix\common\OutFIX.cpp">
<Filter>jetfix\common</Filter>
</ClCompile>
<ClCompile Include="jetfix\connection\AsyncReader.cpp">
<Filter>jetfix\connection</Filter>
</ClCompile>
@@ -130,6 +141,21 @@
<ClCompile Include="jetfix\connection\SocketConnection.cpp">
<Filter>jetfix\connection</Filter>
</ClCompile>
<ClCompile Include="jetfix\gateway\CoreGateway.cpp">
<Filter>jetfix\gateway</Filter>
</ClCompile>
<ClCompile Include="jetfix\gateway\JetFIXGateway.cpp">
<Filter>jetfix\gateway</Filter>
</ClCompile>
<ClCompile Include="jetfix\gateway\Session.cpp">
<Filter>jetfix\gateway</Filter>
</ClCompile>
<ClCompile Include="jetfix\store\FIXFileStore.cpp">
<Filter>jetfix\store</Filter>
</ClCompile>
<ClCompile Include="jetfix\store\session_name.cpp">
<Filter>jetfix\store</Filter>
</ClCompile>
<ClCompile Include="jetfix\tests\async_reader_tests.cpp">
<Filter>jetfix\tests</Filter>
</ClCompile>
@@ -148,26 +174,24 @@
<ClCompile Include="jetfix\tests\store_tests.cpp">
<Filter>jetfix\tests</Filter>
</ClCompile>
<ClCompile Include="jetfix\store\FIXFileStore.cpp">
<Filter>jetfix\store</Filter>
<ClCompile Include="risk_limits\RiskLimiter.cpp">
<Filter>risk_limits</Filter>
</ClCompile>
<ClCompile Include="jetfix\store\session_name.cpp">
<Filter>jetfix\store</Filter>
<ClCompile Include="main.cpp" />
<ClCompile Include="order_man\OrderState.cpp">
<Filter>order_man</Filter>
</ClCompile>
<ClCompile Include="jetfix\gateway\CoreGateway.cpp">
<Filter>jetfix\gateway</Filter>
<ClCompile Include="order_man\OrderStore.cpp">
<Filter>order_man</Filter>
</ClCompile>
<ClCompile Include="jetfix\gateway\JetFIXGateway.cpp">
<Filter>jetfix\gateway</Filter>
<ClCompile Include="risk_limits\IRiskLimitObserver.cpp">
<Filter>risk_limits</Filter>
</ClCompile>
<ClCompile Include="jetfix\gateway\Session.cpp">
<Filter>jetfix\gateway</Filter>
<ClCompile Include="risk_limits\RiskLimitManager.cpp">
<Filter>risk_limits</Filter>
</ClCompile>
<ClCompile Include="jetfix\common\OutFIX.cpp">
<Filter>jetfix\common</Filter>
</ClCompile>
<ClCompile Include="jetfix\codec\FIXArray.cpp">
<Filter>jetfix\codec</Filter>
<ClCompile Include="spreader\SpreaderBase.cpp">
<Filter>spreader</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
@@ -216,9 +240,6 @@
<ClInclude Include="order_man\Order.h">
<Filter>order_man</Filter>
</ClInclude>
<ClInclude Include="order_man\order_man_utils.h">
<Filter>order_man</Filter>
</ClInclude>
<ClInclude Include="order_man\OrderCancel.h">
<Filter>order_man</Filter>
</ClInclude>
@@ -234,6 +255,9 @@
<ClInclude Include="order_man\OrderUpdate.h">
<Filter>order_man</Filter>
</ClInclude>
<ClInclude Include="order_man\order_man_utils.h">
<Filter>order_man</Filter>
</ClInclude>
<ClInclude Include="order_man\WorkingOrder.h">
<Filter>order_man</Filter>
</ClInclude>
@@ -261,60 +285,6 @@
<ClInclude Include="jetfix\jetfix.h">
<Filter>jetfix</Filter>
</ClInclude>
<ClInclude Include="jetfix\connection\AsyncReader.h">
<Filter>jetfix\connection</Filter>
</ClInclude>
<ClInclude Include="jetfix\connection\IConnection.h">
<Filter>jetfix\connection</Filter>
</ClInclude>
<ClInclude Include="jetfix\connection\IConnectionObserver.h">
<Filter>jetfix\connection</Filter>
</ClInclude>
<ClInclude Include="jetfix\connection\SocketConnection.h">
<Filter>jetfix\connection</Filter>
</ClInclude>
<ClInclude Include="jetfix\store\FIXFileStore.h">
<Filter>jetfix\store</Filter>
</ClInclude>
<ClInclude Include="jetfix\store\IFIXStore.h">
<Filter>jetfix\store</Filter>
</ClInclude>
<ClInclude Include="jetfix\store\session_name.h">
<Filter>jetfix\store</Filter>
</ClInclude>
<ClInclude Include="jetfix\gateway\CoreGateway.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\gateway\ICoreGatewayEventSink.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\gateway\ICoreGatewayObserver.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\gateway\JetFIXGateway.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\gateway\Session.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\common\InMsgBuffer.h">
<Filter>jetfix\common</Filter>
</ClInclude>
<ClInclude Include="jetfix\common\JetFIXError.h">
<Filter>jetfix\common</Filter>
</ClInclude>
<ClInclude Include="jetfix\common\OutFIX.h">
<Filter>jetfix\common</Filter>
</ClInclude>
<ClInclude Include="jetfix\common\OutFIXPtr.h">
<Filter>jetfix\common</Filter>
</ClInclude>
<ClInclude Include="jetfix\common\OutMsgVecPtr.h">
<Filter>jetfix\common</Filter>
</ClInclude>
<ClInclude Include="jetfix\codec\f_toa.h">
<Filter>jetfix\codec</Filter>
</ClInclude>
<ClInclude Include="jetfix\codec\FieldDefinitions.h">
<Filter>jetfix\codec</Filter>
</ClInclude>
@@ -342,6 +312,9 @@
<ClInclude Include="jetfix\codec\FIXWriter.h">
<Filter>jetfix\codec</Filter>
</ClInclude>
<ClInclude Include="jetfix\codec\f_toa.h">
<Filter>jetfix\codec</Filter>
</ClInclude>
<ClInclude Include="jetfix\codec\Group.h">
<Filter>jetfix\codec</Filter>
</ClInclude>
@@ -372,6 +345,72 @@
<ClInclude Include="jetfix\codec\WriterCursor.h">
<Filter>jetfix\codec</Filter>
</ClInclude>
<ClInclude Include="jetfix\common\InMsgBuffer.h">
<Filter>jetfix\common</Filter>
</ClInclude>
<ClInclude Include="jetfix\common\JetFIXError.h">
<Filter>jetfix\common</Filter>
</ClInclude>
<ClInclude Include="jetfix\common\OutFIX.h">
<Filter>jetfix\common</Filter>
</ClInclude>
<ClInclude Include="jetfix\common\OutFIXPtr.h">
<Filter>jetfix\common</Filter>
</ClInclude>
<ClInclude Include="jetfix\common\OutMsgVecPtr.h">
<Filter>jetfix\common</Filter>
</ClInclude>
<ClInclude Include="jetfix\connection\AsyncReader.h">
<Filter>jetfix\connection</Filter>
</ClInclude>
<ClInclude Include="jetfix\connection\IConnection.h">
<Filter>jetfix\connection</Filter>
</ClInclude>
<ClInclude Include="jetfix\connection\IConnectionObserver.h">
<Filter>jetfix\connection</Filter>
</ClInclude>
<ClInclude Include="jetfix\connection\SocketConnection.h">
<Filter>jetfix\connection</Filter>
</ClInclude>
<ClInclude Include="jetfix\gateway\CoreGateway.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\gateway\ICoreGatewayEventSink.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\gateway\ICoreGatewayObserver.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\gateway\JetFIXGateway.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\gateway\Session.h">
<Filter>jetfix\gateway</Filter>
</ClInclude>
<ClInclude Include="jetfix\store\FIXFileStore.h">
<Filter>jetfix\store</Filter>
</ClInclude>
<ClInclude Include="jetfix\store\IFIXStore.h">
<Filter>jetfix\store</Filter>
</ClInclude>
<ClInclude Include="jetfix\store\session_name.h">
<Filter>jetfix\store</Filter>
</ClInclude>
<ClInclude Include="risk_limits\RiskLimiter.h">
<Filter>risk_limits</Filter>
</ClInclude>
<ClInclude Include="risk_limits\IRiskLimitObserver.h">
<Filter>risk_limits</Filter>
</ClInclude>
<ClInclude Include="risk_limits\RiskLimitManager.h">
<Filter>risk_limits</Filter>
</ClInclude>
<ClInclude Include="spreader\Spreader.h">
<Filter>spreader</Filter>
</ClInclude>
<ClInclude Include="spreader\SpreaderBase.h">
<Filter>spreader</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="order_man\doc\order_man_notes.org">
-36
View File
@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<RemoteDebuggingMode>gdb</RemoteDebuggingMode>
<DebuggerFlavor>LinuxDebugger</DebuggerFlavor>
<RemoteDebuggerWorkingDirectory>
</RemoteDebuggerWorkingDirectory>
<RemoteTarget>-1467508073;localhost (username=, port=2000, authentication=Password)</RemoteTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<RemoteDebuggingMode>gdb</RemoteDebuggingMode>
<DebuggerFlavor>LinuxDebugger</DebuggerFlavor>
<RemoteDebuggerWorkingDirectory>
</RemoteDebuggerWorkingDirectory>
<RemoteTarget>-1467508073;localhost (username=, port=2000, authentication=Password)</RemoteTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<RemoteDebuggingMode>gdb</RemoteDebuggingMode>
<DebuggerFlavor>LinuxDebugger</DebuggerFlavor>
<RemoteDebuggerWorkingDirectory>
</RemoteDebuggerWorkingDirectory>
<RemoteTarget>-1467508073;localhost (username=, port=2000, authentication=Password)</RemoteTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<RemoteTarget>1134075360;localhost (username=, port=22, authentication=Password)</RemoteTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<RemoteTarget>1134075360;localhost (username=, port=22, authentication=Password)</RemoteTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<RemoteTarget>1134075360;localhost (username=, port=22, authentication=Password)</RemoteTarget>
</PropertyGroup>
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
</Project>
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/..
(cd externals/linux/include/ && find -name "*.h" -or -name "*.hpp")
(cd src ; find -name "*.h")
find -name "*.proto" -not -path "./lib/api/services/*" | sed s/\.proto/\.pb\.h/
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT=$DIR/..
cd $ROOT
# src includes
find src -name "*.h" -or -name "*.hpp" | sed s/src\\///
# non service protos
find src -name "*.proto" -not -path "./lib/api/services/*" | sed s/src\\/// | sed 's/\.proto$/\.pb\.h/'
# service protos
find src/lib/api/services -name "*.proto" | sed s/src\\/// | sed 's/\.proto$/\.client.pb\.h/'
find src/lib/api/services -name "*.proto" | sed s/src\\/// | sed 's/\.proto$/\.server.pb\.h/'
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT=$DIR/..
cd $ROOT
# external includes
find externals/linux/include/ -name "*.h" -or -name "*.hpp" | sed s/externals\\/linux\\/include\\///
+29
View File
@@ -0,0 +1,29 @@
# inspired by https://stackoverflow.com/questions/1027247/specify-source-files-globally-with-glob
# Compare the new contents with the existing file, if it exists and is the
# same we don't want to trigger a make by changing its timestamp.
function(update_file path content)
set(old_content "")
if(EXISTS "${path}")
file(READ "${path}" old_content)
endif()
if(NOT old_content STREQUAL content)
file(WRITE "${path}" "${content}")
endif()
endfunction(update_file)
# Creates a file called CMakeDeps.cmake next to your CMakeLists.txt with
# the list of dependencies in it - this file should be treated as part of
# CMakeLists.txt (source controlled, etc.).
function(update_deps_file deps)
set(deps_file "CMakeDeps.cmake")
# Normalize the list so it's the same on every machine
list(REMOVE_DUPLICATES deps)
list(SORT deps)
# Update the deps file
set(content "# generated by make process\nset(sources ${deps})\n")
update_file(${deps_file} "${content}")
# Include the file so it's tracked as a generation dependency we don't
# need the content.
include(${deps_file})
endfunction(update_deps_file)
+7 -1
View File
@@ -3,6 +3,12 @@
cd %~dp0\..
mkdir build 2> nul
cd build
cmake.exe -G "Visual Studio 15 2017 Win64" ..
rmdir /s /q Debug
rmdir /s /q Release
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" (
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -G "Visual Studio 15 2017 Win64" ..
) else (
cmake.exe -G "Visual Studio 15 2017 Win64" ..
)
copy /y ..\tools\cpp.build.props Directory.Build.Props
del spark.sln