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 TickerTimer_Elapsed(object sender, ElapsedEventArgs e) { Parallel.ForEach(Tickerdic, (dic, lookup) => { Ticker ticker = marketHepler?.GetTicker(platform, dic.Key); if (ticker != null && ticker.result) { updateTicker(dic.Key, ticker); } }); }