コード例 #1
0
ファイル: DomLoader.cs プロジェクト: eburtsev/traderobotics
        /// <summary>
        /// Add Dom snapshot from dde server data
        /// </summary>
        /// <param name="table"></param>
        public static void AddSnapShotFromDde(string symbol, object[][] table)
        {
            // Create level 2 shapshot from table
            Level2 snapShot = new Level2(symbol, table, DateTime.Now);

            // Get level2 history for symbol
            Level2History history;
            if (Level2Histories.ContainsKey(symbol))
            {
                // Add snapshot to existing
                history = Level2Histories[symbol];
            }
            else
            {
                history = new Level2History(symbol) { SaveOnExit = true };
                Level2Histories.Add(symbol, history);
                // Add this history to bars
                if(QuikQuotesLoader.HistoryBars.ContainsKey(symbol))
                    QuikQuotesLoader.HistoryBars[symbol].Level2History = history;
            }

            if (history.Count != 0
                && snapShot.Time.Minute % 5 == 1
                && history.Last().Time.Minute != snapShot.Time.Minute)
            {
                // Save history
                history.Save();
            }

            // Add to history
            history.Add(snapShot);
            //history.Save();
            //history.Load(snapShot.Time);
        }
コード例 #2
0
        /// <summary>
        /// Add Dom snapshot from dde server data
        /// </summary>
        /// <param name="table"></param>
        public static void AddSnapShotFromDde(string symbol, object[][] table)
        {
            // Create level 2 shapshot from table
            Level2 snapShot = new Level2(symbol, table, DateTime.Now);

            // Get level2 history for symbol
            Level2History history;

            if (Level2Histories.ContainsKey(symbol))
            {
                // Add snapshot to existing
                history = Level2Histories[symbol];
            }
            else
            {
                history = new Level2History(symbol)
                {
                    SaveOnExit = true
                };
                Level2Histories.Add(symbol, history);
                // Add this history to bars
                if (QuikQuotesLoader.HistoryBars.ContainsKey(symbol))
                {
                    QuikQuotesLoader.HistoryBars[symbol].Level2History = history;
                }
            }

            if (history.Count != 0 &&
                snapShot.Time.Minute % 5 == 1 &&
                history.Last().Time.Minute != snapShot.Time.Minute)
            {
                // Save history
                history.Save();
            }

            // Add to history
            history.Add(snapShot);
            //history.Save();
            //history.Load(snapShot.Time);
        }