diff --git a/src/client/sparkcmd/Cmd/Historical/Analyzers/AlgoAnalyzer.cs b/src/client/sparkcmd/Cmd/Historical/Analyzers/AlgoAnalyzer.cs index ef831697e..f0254b2ff 100644 --- a/src/client/sparkcmd/Cmd/Historical/Analyzers/AlgoAnalyzer.cs +++ b/src/client/sparkcmd/Cmd/Historical/Analyzers/AlgoAnalyzer.cs @@ -18,6 +18,7 @@ namespace bts.history string[] _security_list; public AlgoAnalyzer(HistoricalDataOptions options, System.Type algotype, string algo_params) { + Log.assert(!string.IsNullOrEmpty(options.algo_security)); _security_list = new string[] { options.algo_security }; if (options.algo_security.Contains(';')) _security_list = options.algo_security.Split(';'); diff --git a/src/client/sparkcmd/Cmd/Historical/HistoricalDataReplayer.cs b/src/client/sparkcmd/Cmd/Historical/HistoricalDataReplayer.cs index 0169245ba..6ddb444cd 100644 --- a/src/client/sparkcmd/Cmd/Historical/HistoricalDataReplayer.cs +++ b/src/client/sparkcmd/Cmd/Historical/HistoricalDataReplayer.cs @@ -39,17 +39,20 @@ namespace bts.history query.Skip = null; List anal = new List(); - string algo_security = o.algo_security; - if (!string.IsNullOrEmpty(algo_security)) + string algo_security = o.algo_security ?? string.Empty; + var t = System.Type.GetType(o.algo_type); + if (t == null) + t = System.Type.GetType("bts.history." + o.algo_type); + if (t != null) { - var t = System.Type.GetType(o.algo_type); - if (t == null) - t = System.Type.GetType("bts.history." + o.algo_type); - if (t != null) + if(typeof(AlgoBase).IsAssignableFrom(t)) anal.Add(new AlgoAnalyzer(o, t, o.algo_params)); - else - anal.Add(new BookAnalyzer(algo_security)); + else + anal.Add((IAnalyzer)Activator.CreateInstance(t, new[] { algo_security })); } + else + anal.Add(new BookAnalyzer(algo_security)); + api.Product prod = new Product() { Exchange = query.Exchange, Type = query.SecurityType, Symbol = query.Symbol }; List arb = new List(); int count = 0;