Exemple #1
0
        private void CEL_CELStarted()
        {
            Control ctrl = null;
            IEnumerator <String> enumList = _addSybolsList.Keys.GetEnumerator();

            while (enumList.MoveNext())
            {
                try
                {
                    ctrl = _addSybolsList[enumList.Current];
                    _cel.NewInstrument(enumList.Current);

                    CQGTicksRequest req = _cel.CreateTicksRequest();
                    req.Type           = eTicksRequestType.trtCurrentNotify;
                    req.SessionsFilter = 0;
                    req.TickFilter     = eTickFilter.tfAll;
                    req.Symbol         = enumList.Current;
                    _cel.RequestTicks(req);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    if (ctrl != null)
                    {
                        ctrl.ForeColor = Color.OrangeRed;
                        ctrl.Text      = ex.Message;
                    }
                }
            }
        }
Exemple #2
0
        private static void TickRequest(string symbolName)
        {
            try
            {
                if (!Cel.IsStarted)
                {
                    FinishCollectingSymbol(symbolName, false, 0, "CQG not started");
                    return;
                }
                if (_rangeDateStart < DateTime.Now.AddDays(-Settings.Default.MaxTickDays))
                {
                    _rangeDateStart = DateTime.Now.AddDays(-Settings.Default.MaxTickDays);
                }

                if (DateTime.Today.DayOfWeek == DayOfWeek.Monday)
                {
                    _rangeDateStart = _rangeDateStart.AddDays(-2);
                }
                _historicalPeriod = "tick";

                var tickRequest = Cel.CreateTicksRequest();
                //LineTime = CEL.Environment.LineTime;
                tickRequest.RangeStart     = _rangeDateStart;
                tickRequest.RangeEnd       = _rangeDateEnd;
                tickRequest.Type           = eTicksRequestType.trtSinceTimeNotify;
                tickRequest.Symbol         = symbolName;
                tickRequest.SessionsFilter = _sessionFilter;

                CQGTicks ticks = Cel.RequestTicks(tickRequest);
                if (ticks.Status == eRequestStatus.rsInProgress)
                {
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Exemple #3
0
        private void TickRequest(CQGCEL cel, IEnumerable<string> symbols, DateTime rangeStart, DateTime rangeEnd, string continuationType)
        {
            if (_shouldStop) return;

            if (rangeStart < DateTime.Now.AddDays(-Settings.Default.MaxTickDays))
                rangeStart = DateTime.Now.AddDays(-Settings.Default.MaxTickDays);

            _aSymbolStates.Clear();
            _aContinuationType = continuationType;
            _historicalPeriod = "tick";

            foreach (string smb in symbols)
            {
                var tickRequest = cel.CreateTicksRequest();
                //LineTime = CEL.Environment.LineTime;
                tickRequest.RangeStart = rangeStart;
                tickRequest.RangeEnd = rangeEnd;
                tickRequest.Type = eTicksRequestType.trtSinceTimeNotify;
                tickRequest.Symbol = smb;

                CQGTicks ticks = cel.RequestTicks(tickRequest);

                if (ticks.Status == eRequestStatus.rsInProgress)
                {
                    var ss = new SymbolState { IsCollected = false, IsSuccess = false };

                    _aSymbolStates.Add(smb, ss);
                }
                OnSymbolCollectStart(smb);
            }
        }