Exemple #1
0
        void LoadSymbols()
        {
            try
            {
                string symbolsFile = _filesFolder + "//" + YahooStockSymbolsFileName;
                System.Xml.XmlDocument document = new System.Xml.XmlDocument();
                document.Load(symbolsFile);

                XmlNode       batsNode     = document.ChildNodes[1];
                XmlNode       symbolsNode  = batsNode.ChildNodes[0];
                List <string> symbolsNames = new List <string>();

                foreach (XmlNode node in symbolsNode)
                {
                    string symbolName = (string)node.Attributes["name"].Value;

                    // BATS and Yahoo symbols vary, so compensate.
                    symbolName = symbolName.Replace("-", "-P").Replace(".", "-").Replace("~", "-TEST").Replace("+", "-WT");

                    symbolsNames.Add(symbolName);
                }

                foreach (string symbolName in symbolsNames)
                {// For each new file name create a corresponding sessionInformation.
                    Symbol symbol = new Symbol("Stock", symbolName);
                    _dataSourceStub.AddSuggestedSymbol(symbol);
                }
            }
            catch (Exception ex)
            {
                SystemMonitor.OperationError("Failed to load symbols [" + ex.Message + "].");
            }

            ChangeOperationalState(OperationalStateEnum.Operational);
        }
Exemple #2
0
        protected void Construct()
        {
            _dataStub.Initialize(this);
            _dataStub.AddSuggestedSymbol(_sessionInformation.Info.Symbol);
            _dataStub.AddSession(_sessionInformation);

            _dateTime = DateTime.Now;

            _liveDataTimer           = new Timer(750);
            _liveDataTimer.Elapsed  += new System.Timers.ElapsedEventHandler(TimerTimeout);
            _liveDataTimer.AutoReset = false;

            _liveDataTimer.Start();

            for (int i = 0; i < 100; i++)
            {
                GenerateNextRandomBar();
            }
        }