Exemplo n.º 1
0
        void _dataDelivery_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            if (operational.OperationalState != OperationalStateEnum.Operational)
            {
                return;
            }

            RuntimeDataSessionInformation info = _dataDelivery.GetSymbolRuntimeSessionInformation(_session.Symbol);

            if (info != null)
            {
                if (info.TickDataAvailabe)
                {
                    _dataDelivery.RequestDataHistoryUpdate(_session, new DataHistoryRequest(TimeSpan.Zero, null), false);
                }
            }
            else
            {
                SystemMonitor.OperationError("Failed to estblish runtime data session information.");
            }
        }
Exemplo n.º 2
0
        void _dataDelivery_OperationalStatusChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            if (operational.OperationalState != OperationalStateEnum.Operational)
            {
                return;
            }

            if (_sessionInfo.IsEmtpy)
            {
                SystemMonitor.OperationError("Data bar provider has no valid session assiged.");
                return;
            }

            // Re-map the session orderInfo.
            RuntimeDataSessionInformation information = _dataDelivery.GetSymbolRuntimeSessionInformation(_sessionInfo.Symbol);

            if (information == null)
            {
                SystemMonitor.OperationError("Failed to map session information for data provider.");
                _sessionInfo = DataSessionInfo.Empty;
                return;
            }
            else
            {
                _sessionInfo = information.Info;
            }

            if (_dataDelivery.SubscribeToData(_sessionInfo, true, new DataSubscriptionInfo(false, false, new TimeSpan[] { Period.Value })) == false)
            {
                SystemMonitor.OperationError("Failed to subscribe to bar data updates.");
                return;
            }

            RuntimeDataSessionInformation session = _dataDelivery.GetSymbolRuntimeSessionInformation(_sessionInfo.Symbol);

            if (session != null && session.AvailableDataBarPeriods.Contains(_period.Value))
            {
                _dataDelivery.RequestDataHistoryUpdate(_sessionInfo, new DataHistoryRequest(_period.Value, _defaultHistoryBarsCount), false);
            }
        }