public void Run(List <string> symbols, bool isWS = true) { SymbolList = symbols; IsWS = isWS; foreach (var symbol in symbols) { var ticker = marketHepler.GetTicker(platform, symbol); var depth = marketHepler.GetDepth(platform, symbol); Tickerdic.Add(symbol, ticker); Depthdic.Add(symbol, depth); var KlineM1 = marketHepler.GetKline(platform, symbol, "M1"); var KlineM15 = marketHepler.GetKline(platform, symbol, "M15"); Klinedic.Add("M1." + symbol, KlineM1); Klinedic.Add("M15." + symbol, KlineM15); } if (isWS) { DepthSubscribe(symbols); TickerSubscribe(symbols); KlineSubscribe(symbols); } else { tickerTimer.Start(); depthTimer.Start(); } depthTimer.Start(); Running = true; }
private void DepthTimer_Elapsed(object sender, ElapsedEventArgs e) { Parallel.ForEach(Depthdic, (dic, lookup) => { Depth depth = marketHepler?.GetDepth(platform, dic.Key); if (depth != null && depth.result) { updateDepth(dic.Key, depth); } }); }