Esempio n. 1
0
 public StrategyDataFrame(string strategyIdentityCode, int frameSize, PricebarCache pricebarCache)
 {
     this.pricebarCache = pricebarCache;
     this.frameSize     = frameSize;
     this.barType       = pricebarCache.BarType;
     this.cacheId       = pricebarCache.CacheId;
     this.strategyCache = new StrategyCache(strategyIdentityCode, this.barType, this.cacheId);
 }
Esempio n. 2
0
        public StrategyCacheProfile(string strategyIdentity, BarItemType barType, Guid cacheId)
        {
            this.strategyCache = new StrategyCache(strategyIdentity, barType, cacheId);

            CacheHeaderInfo headerInfo = this.strategyCache.Header;

            foreach (KeyValuePair <string, string> extendedProperty in headerInfo.ExtendedProperties)
            {
                switch (extendedProperty.Key)
                {
                case "Indicators":
                    indicators = CacheHelper.LoadIndicatorCacheList(extendedProperty.Value, barType, cacheId);
                    break;

                case "Alerts":
                    break;

                case "Signals":
                    foreach (KeyValuePair <string, string> keyValuePair in strategyCache.Header.ExtendedProperties)
                    {
                        switch (keyValuePair.Key)
                        {
                        case "Indicators":
                            indicators = CacheHelper.LoadIndicatorCacheList(keyValuePair.Value, barType, cacheId);
                            break;

                        case "Alerts":
                            break;

                        case "Signals":
                            string[] signalValues = keyValuePair.Value.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
                            signalCacheProfiles = new Dictionary <string, SignalCacheProfile>();
                            foreach (string signalIdentity in signalValues)
                            {
                                signalCacheProfiles.Add(signalIdentity, new SignalCacheProfile(signalIdentity, barType, cacheId));
                            }
                            break;
                        }
                    }
                    break;
                }
            }
        }
Esempio n. 3
0
        internal StrategyFrameReader(DateTime startDate, DateTime endDate, int frameSize, BarItem[] priceBars, StrategyCache cache, BarItemType barType, Guid cacheId)
        {
            this.startDate = startDate;
            this.endDate   = endDate;
            this.frameSize = frameSize;
            this.priceBars = priceBars;
            dataFrameItems = cache.SelectStrategies(startDate, endDate, frameSize);

            if (dataFrameItems != null)
            {
                strategyIndex = new Dictionary <DateTime, int>();
                int      index = 0;
                DateTime lastClosingBarDate = DateTime.MinValue;
                foreach (StrategyDataItem item in dataFrameItems)
                {
                    if (lastClosingBarDate != item.ClosingBarTime)
                    {
                        strategyIndex.Add(item.ClosingBarTime, index);
                        lastClosingBarDate = item.ClosingBarTime;
                    }

                    index++;
                }
            }

            CacheHeaderInfo headerInfo = cache.Header;

            foreach (KeyValuePair <string, string> extendedProperty in headerInfo.ExtendedProperties)
            {
                switch (extendedProperty.Key)
                {
                case "Indicators":
                    indicatorCacheList = CacheHelper.LoadIndicatorCacheList(extendedProperty.Value, barType, cacheId);
                    break;
                }
            }
        }