public void AddSecurity(DataFactory factory)
 {
     _securitites.Add(factory);
 }
        public void AddTickData(DataFactory factory, SortedDictionary<uint, MarketState> state, DateTime stateTime)
        {
            if (AllMktsInitialized)
            {
                if (!Markets.ContainsKey(stateTime))
                {
                    Markets.Add(stateTime, new Dictionary<Security, SortedDictionary<uint, MarketState>>());
                }

                lock (Markets[stateTime])
                {
                    Dictionary<Security, SortedDictionary<uint, MarketState>> allMarketsAtTime = Markets[stateTime];

                    foreach (DataFactory f in _securitites)
                    {
                        // no market data for this security, for this time stamp exists
                        if (!allMarketsAtTime.ContainsKey(f.SecurityObj))
                        {
                            SortedDictionary<uint, MarketState> mktData = factory.Equals(f) ? state : f.GetLatestOrBefore(stateTime);
                            allMarketsAtTime.Add(f.SecurityObj, mktData);
                        }
                        else // market data for this security, for this time stamp exists already
                        {
                            if (factory.Equals(f))
                            {
                                allMarketsAtTime[f.SecurityObj] = state;
                            }
                        }
                    }

                    if (_lastState < stateTime) _lastState = stateTime;

                }
            }
        }
Пример #3
0
 public void AddSecurity(DataFactory factory)
 {
     _securitites.Add(factory);
 }