Exemple #1
0
 private static void AddPairsToMonitor(PatternConfig p)
 {
     if (!PairsToMonitor.ContainsKey(p.Symbol))
     {
         PairsToMonitor.Add(p.Symbol, p.Interval);
     }
 }
Exemple #2
0
        private static void LoadPatternsConfiguration(JObject json, ILogger _logger)
        {
            PatternsConfig = new Dictionary <string, PatternConfig>();

            var patterns  = json["PatternsConfiguration"];
            var pairs     = json["PairsToMonitor"]["Pairs"];
            var intervals = json["PairsToMonitor"]["Intervals"];

            foreach (var token in patterns)
            {
                var isActive = token["IsActive"].ToString();
                if (isActive.ToLower() == "true")
                {
                    foreach (var pair in pairs)
                    {
                        foreach (var interval in intervals)
                        {
                            var p = new PatternConfig();
                            p          = token.ToObject <PatternConfig>();
                            p.Symbol   = pair.ToString();
                            p.Interval = interval.ToString();
                            var hash = p.Name + "_" + p.Symbol + "_" + p.Interval;
                            PatternsConfig.Add(hash, p);
                            AddPairsToMonitor(p);
                        }
                    }
                }
            }
        }