Ladder Profles - synth ladders convert all non-synth default_algos to 'Spreader'

This commit is contained in:
John Colvin committed 2019-06-19 15:37:46 -05:00
1 parent 4cebe8b6be
commit b945f9f090
3 files changed
+4 -4

No files matched your search

@@ -270,7 +270,7 @@ namespace bts.shell {
if (s == null) return null;
var algo_key = AlgoID.to_algo_key(s.default_algo, _orders_model.dynamic_helper.dynamic_type_index);
if (algo_key.mode == AlgoKey.Mode.Factory) {
var fitted_algo = OrderDataHelper.fit_to_type(algo_key.factory.structure.build_algo(_orders_model.dynamic_helper), sec_type);
var fitted_algo = OrderDataHelper.fit_to_type(algo_key.factory.structure.build_algo(_orders_model.dynamic_helper), sec_type, true);
if (fitted_algo.HasValue) {
// be sure to clone ('s' may be shared)
s = SparkUtils.clone_proto(s);
+2 -2
View File
@@ -516,7 +516,7 @@ namespace mbts.spark.utilities {
}
}
public static CustomOrderDefinitionImmutable? fit_to_type(CustomOrderDefinitionImmutable defi, Security.ContractOneofCase security_type) {
public static CustomOrderDefinitionImmutable? fit_to_type(CustomOrderDefinitionImmutable defi, Security.ContractOneofCase security_type, bool fit_all_to_spreader = false) {
var mdef = defi.CloneToMutable();
switch (security_type) {
case Security.ContractOneofCase.Synthetic:
@@ -542,7 +542,7 @@ namespace mbts.spark.utilities {
case CustomOrderDefinition.CustomOneofCase.Stop:
case CustomOrderDefinition.CustomOneofCase.StopLimit:
case CustomOrderDefinition.CustomOneofCase.Market:
def = null;
def = fit_all_to_spreader ? new CustomOrderDefinition { Spreader = new SpreaderOrderDefinition() } : null;
break;
default:
var desc_data = _algo_type_case_descriptor_data[def.CustomCase];
@@ -171,7 +171,7 @@ namespace mbts.spark {
foreach (var ns in table.changed) {
int i = CollectionHelper.binary_search(skip_local_wrapper, ns, _key_comp);
if (i >= 0)
skip_local[i].commit(ns);
skip_local[i].commit(ns.with(value: normalize(ns.value)));
}
foreach (var ns in table.added) {
int i = CollectionHelper.binary_search(skip_local_wrapper, ns, _key_comp);