Ejemplo n.º 1
0
        private void OnReceiveRealData(object sender, _DKHOpenAPIEvents_OnReceiveRealDataEvent e)
        {
            sb = new StringBuilder(512);

            foreach (int fid in Array.Find(catalog, o => o.ToString().Contains(e.sRealType)))
            {
                sb.Append(axAPI.GetCommRealData(e.sRealKey, fid)).Append(',');
            }

            if (e.sRealType.Equals(sRealType[0]))
            {
                SendTick?.Invoke(this, new TickEvent(sb));
                SendDay?.Invoke(this, new DayEvent(sb));

                return;
            }
            if (e.sRealType.Equals(sRealType[1]) && int.Parse(sb.ToString().Substring(0, 6)) > 153459)
            {
                string[] fg = sb.ToString().Split(',');

                if (fg[52].Contains("-"))
                {
                    fg[52] = fg[52].Substring(1);
                }

                double price = double.Parse(fg[52]);

                SendTick?.Invoke(this, new TickEvent(false, fg[0], price, 0));
                SendDay?.Invoke(this, new DayEvent(false, price));

                return;
            }
            if (e.sRealType.Equals(sRealType[2]))
            {
                string[] tg = sb.ToString().Split(',');

                if (tg[0].Equals("e") && Deadline == false)
                {
                    Deadline = true;

                    Request();

                    SendExit?.Invoke(this, new ForceQuit(0));
                }
                return;
            }
            sb = null;
        }
Ejemplo n.º 2
0
        public void StartProgress(int param)
        {
            ie = new EnumerateDay();

            foreach (string val in ie)
            {
                string[] arr = val.Split(',');

                if (arr[1].Contains("-"))
                {
                    arr[1] = arr[1].Substring(1);
                }

                double price = double.Parse(arr[1]);

                s = new MakeDay(arr[0].Substring(6, 2));

                SendDay?.Invoke(this, new DayEvent(s.Check, price));
            }
            ie  = new EnumerateTick();
            act = new Action(() => Log(param));

            foreach (string val in ie)
            {
                string[] arr = val.Split(',');

                s = new TimeCheck();

                if (arr[1].Contains("-"))
                {
                    arr[1] = arr[1].Substring(1);
                }

                double price = double.Parse(arr[1]);

                SendTick?.Invoke(this, new TickEvent(s.Make(arr[0].Substring(9, 1)), arr[0], price, int.Parse(arr[2]), param));

                s = new MakeDay(arr[0].Substring(4, 2));

                SendDay?.Invoke(this, new DayEvent(s.Check, price));
            }
            act.BeginInvoke(act.EndInvoke, null);
        }