diff --git a/src/client/spark/AlgoProvider/IAlgoProvider.cs b/src/client/spark/AlgoProvider/IAlgoProvider.cs
index 4c6ff8c3a..ff2f37755 100644
--- a/src/client/spark/AlgoProvider/IAlgoProvider.cs
+++ b/src/client/spark/AlgoProvider/IAlgoProvider.cs
@@ -1,4 +1,5 @@
-using bts.api;
+using bts;
+using bts.api;
using bts.api.core;
using bts.api.orderman;
using bts.utils;
@@ -50,9 +51,7 @@ namespace mbts.spark {
/// ,
/// ,
///
- _studio_algos_source = studio_model.definitions
- .StartWith(TableUpdate.mk_empty(AlgoData.key_fn))
- .Cache();
+ _studio_algos_source = studio_model.definitions.Cache();
}
public AlgoTypeSetImmutable get_permitted_algos(SecurityImmutable security) =>
@@ -67,10 +66,11 @@ namespace mbts.spark {
public IObservable> subscribe_algos() =>
_studio_algos_source
- .AppendTable(_security_algo_types
- .Select(s => s.algo_type_set)
- .Aggregate(AlgoTypeSetImmutable.empty, (a, b) => a.union_with(b))
- .define_algos(_dynamic_helper));
+ .StartWith(TableUpdate.mk_empty(AlgoData.key_fn))
+ .AppendTable(_security_algo_types
+ .Select(s => s.algo_type_set)
+ .Aggregate(AlgoTypeSetImmutable.empty, (a, b) => a.union_with(b))
+ .define_algos(_dynamic_helper));
public IObservable> subscribe_algos(SecurityCriteriaClause security_clause) {
var system_algos = _security_algo_types.match_algos(
@@ -78,11 +78,13 @@ namespace mbts.spark {
_dynamic_helper,
def => _fit_to_type(def, security_clause, _security_algo_types));
- return _studio_algos_source.Select(
- a => (algo: a, fitted_def: _fit_to_type(a.value, security_clause, _security_algo_types)),
- tup => tup.algo.key)
- .Select(tup => AlgoData.create(tup.fitted_def, tup.algo.name, tup.algo.key), a => a.key)
- .AppendTable(system_algos.Values);
+ return _studio_algos_source
+ .Select(
+ a => (algo: a, fitted_def: _fit_to_type(a.value, security_clause, _security_algo_types)),
+ tup => tup.algo.key)
+ .Select(tup => AlgoData.create(tup.fitted_def, tup.algo.name, tup.algo.key), a => a.key)
+ .StartWith(TableUpdate.mk_empty(AlgoData.key_fn))
+ .AppendTable(system_algos.Values);
}
public IObservable> subscribe_algos(SecurityImmutable security) {
@@ -96,14 +98,18 @@ namespace mbts.spark {
def => _fit_to_type(def, security, _security_algo_types),
_security_auxiliary_model.get_display_quantity_divisor(security));
- return _studio_algos_source.Select(
- a => (algo: a, fitted_def: _fit_to_type(a.value, security, _security_algo_types)),
- tup => tup.algo.key)
- // filter out algos that use an unsupported root, because this would have the effect of duplicating the default algo
- // (e.g., GlbxIceberg orders would be converted to Limit/Spreader orders for non-Glbx securities).
- .Filter(tup => tup.fitted_def.actual().CustomCase == tup.algo.value.actual().CustomCase, tup => tup.algo.key)
- .Select(tup => AlgoData.create(tup.fitted_def, tup.algo.name, tup.algo.key), AlgoData.key_fn)
- .AppendTable(system_algos.Values);
+ var filtered_studio_algos = _studio_algos_source
+ .StartWith(TableUpdate.mk_empty(AlgoData.key_fn))
+ .Select(
+ a => (algo: a, fitted_def: _fit_to_type(a.value, security, _security_algo_types)),
+ tup => tup.algo.key)
+ // filter out algos that use an unsupported root, because this would have the effect of duplicating the default algo
+ // (e.g., GlbxIceberg orders would be converted to Limit/Spreader orders for non-Glbx securities).
+ .Filter(tup => tup.fitted_def.actual().CustomCase == tup.algo.value.actual().CustomCase, tup => tup.algo.key)
+ .Select(tup => AlgoData.create(tup.fitted_def, tup.algo.name, tup.algo.key), AlgoData.key_fn);
+ return filtered_studio_algos
+ .StartWith(TableUpdate.mk_empty(AlgoData.key_fn))
+ .AppendTable(system_algos.Values);
}
protected virtual void assign_fallback_algo(CustomOrderDefinition mdef, SecurityCriteriaClause security_clause) {