public Consecutive(Catalog.XingAPI.Specify specify) : base(KeyDecoder.GetKey()) { this.specify = specify; this.judge = specify.Strategy.Length == 2 && int.TryParse(specify.Strategy, out int judge) ? judge : int.MaxValue; var recent = Retrieve.Charts.Last().Value.Last().Date.ToString().Substring(0, 6); var now = DateTime.Now; Short = GetBasicChart(recent, now, specify, specify.Short, new Stack <double>(256)); Long = GetBasicChart(recent, now, specify, specify.Long, new Stack <double>(256)); if (Short == null || Short.Count == 0 || Long == null || Long.Count == 0) { Short = new Stack <double>(256); Long = new Stack <double>(256); foreach (var kv in Retrieve.Charts) { foreach (var chart in kv.Value) { Analysize(chart); } } } if (specify.Time == 1440) { RollOver = specify.RollOver == false || Array.Exists(Information.RemainingDay, o => o.Equals(now.ToString(remaining))); ran = new Random(); OnTime = true; Assets = specify.Assets; API.OnReceiveBalance = false; ((IEvents <EventHandler.XingAPI.Quotes>)API.reals[0]).Send += OnReceiveQuotes; if (now.Hour < 5 || now.Hour > 16) { this.judge /= 10; } } else { Check = string.Empty; } ((IEvents <Datum>)API.reals[1]).Send += Analysize; }
protected internal TF(Specify specify) : base(KeyDecoder.GetKey()) { this.specify = specify; if (specify.Strategy.Length > 2) { Short = GetBasicChart(new Stack <double>(512), specify, specify.Short); Long = GetBasicChart(new Stack <double>(512), specify, specify.Long); if (Short.Count == 0 || Long.Count == 0) { sCollection = true; lCollection = true; var charts = new Queue <Models.Charts>(256); if (Short.Count > 0) { Short.Clear(); sCollection = false; LongValue = new Dictionary <string, double>(); } else if (Long.Count > 0) { Long.Clear(); lCollection = false; ShortValue = new Dictionary <string, double>(); } else { ShortValue = new Dictionary <string, double>(); LongValue = new Dictionary <string, double>(); } foreach (Catalog.Chart chart in Retrieve.Chart) { Analysize(chart); } if (sCollection) { foreach (var kv in ShortValue) { charts.Enqueue(new Models.Charts { Code = specify.Code, Time = (int)specify.Time, Base = specify.Short, Date = kv.Key, Value = kv.Value }); } } if (lCollection) { foreach (var kv in LongValue) { charts.Enqueue(new Models.Charts { Code = specify.Code, Time = (int)specify.Time, Base = specify.Long, Date = kv.Key, Value = kv.Value }); } } if (charts.Count > 0 && SetBasicChart(charts)) { charts.Clear(); } } } }