Beispiel #1
0
        //设置正数据对象-修正为同时间频率数据
        public virtual bool SetData(CacheInfo <Data_Quote> pCacheInfo, typeTimeFrequency timeFrequency, typeTimeFrequency timeFrequency2)
        {
            Data_Quote pData = pCacheInfo.Data;

            if (pData == null)
            {
                return(false);
            }
            StockInfo pStockInfo = pData.GetStockInfo();

            if (pStockInfo == null)
            {
                return(false);
            }

            //获取当前时间频率数据
            DateTime   dtEnd    = zxcTimeHelper.CheckTime(pData.DateTime, typeTimeFrequency.m1, true);
            Data_Quote pDataNew = QuoteQuery._Query.Query(pStockInfo, pData.DateTime, timeFrequency, null);

            if (pDataNew == null)
            {
                return(false);
            }
            bool bResult = this.SetData(pDataNew, timeFrequency);

            return(bResult);


            //非时间频率数据,重新修正
            if (pData.QuoteTimeType != timeFrequency)
            {
                string        exType   = pStockInfo.StockExchange.ToString();
                IData_Factors pFactors = _managerCaches._GetFactors(exType);
                if (pFactors != null)
                {
                    IData_Factor           pFactor    = pFactors.GetData_Factor(pStockInfo.StockID_Tag);
                    DataCache <Data_Quote> pDataCache = (DataCache <Data_Quote>)_managerCaches.GetDataCache <Data_Quote>(pFactors, pFactor, "", timeFrequency);

                    //查询最后有效步长数据总数
                    int nCount = pDataCache.DataCaches.Values.Count(e => e.Data.IsDel == true);

                    //获取最数据
                    List <Data_Quote> lstQuotes = QuoteQuery._Query.Query(pStockInfo.StockID_Tag, pDataNew.DateTime, nCount, timeFrequency, true);
                    if (lstQuotes != null)
                    {
                        foreach (var item in lstQuotes)
                        {
                            int nSum = pDataCache.DataCaches.Values.Count(e => e.DateTime == item.DateTime && e.Data.IsDel != true);
                            if (nSum == 0)
                            {
                                item.SetStockInfo(pStockInfo);
                                bResult = bResult && this.SetData(item, timeFrequency);
                            }
                        }
                    }
                }
            }
            return(bResult);
        }
Beispiel #2
0
        public IData_Factor _GetFactor(string strTagFactors, string strTag)
        {
            IData_Factors pFactors = _GetFactors(strTagFactors);

            if (pFactors == null)
            {
                return(null);
            }
            return(pFactors.GetData_Factor(strTag));
        }
Beispiel #3
0
        /// <summary>按因子对象集、因子对象等提取缓存数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="infoFactors">因子对象集标识</param>
        /// <param name="infoFactor">因子对象标识</param>
        /// <param name="strTag">自定义标识</param>
        /// <param name="dtTime">数据时间</param>
        /// <param name="typeTimeFrequency">时间频率</param>
        /// <returns></returns>
        public T GetData <T>(string tagFactors, string tagFactor, string strTag, DateTime dtTime, typeTimeFrequency typeTimeFrequency = typeTimeFrequency.none)
        {
            IData_Factors dataFactors = this._GetFactors(tagFactors);

            if (dataFactors != null)
            {
                IData_Factor dataFactor = dataFactors.GetData_Factor(tagFactor);
                return(GetData <T>(dataFactors, dataFactor, strTag, dtTime, typeTimeFrequency));
            }
            return(default(T));
        }
Beispiel #4
0
        /// <summary>按因子对象集、因子对象等设置缓存数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="infoFactors">因子对象集标识</param>
        /// <param name="infoFactor">因子对象标识</param>
        /// <param name="strTag">自定义标识</param>
        /// <param name="dtTime">数据时间</param>
        /// <param name="data">数据(int等或class对象)</param>
        /// <param name="typeTimeFrequency">时间频率</param>
        /// <returns></returns>
        public bool SetData <T>(string tagFactors, string tagFactor, string strTag, DateTime dtTime, T data, typeTimeFrequency typeTimeFrequency = typeTimeFrequency.none)
        {
            IData_Factors dataFactors = this._GetFactors(tagFactors);

            if (dataFactors != null)
            {
                IData_Factor dataFactor = dataFactors.GetData_Factor(tagFactor);
                if (dataFactor != null)
                {
                    return(SetData <T>(dataFactors, dataFactor, strTag, dtTime, data, typeTimeFrequency));
                }
            }
            return(false);
        }
Beispiel #5
0
        public bool InitDataCheck <T>(string tagFactors, string tagFactor, string strTag, typeTimeFrequency typeTimeFrequency, string tagDataCheck, IDataCheck <T> dataCheck, bool isCanCover = false)
        {
            if (tagFactors + "" == "")
            {
                return(false);
            }

            //DataCaches_Manage
            IData_Factors infoFactors = this._GetFactors(tagFactors);

            if (infoFactors == null)
            {
                return(false);
            }
            IDataCaches_Manage dataCaches_Manage = this.GetDataCaches_Manage(infoFactors);

            if (dataCaches_Manage == null)
            {
                return(false);
            }
            if (tagFactor + "" == "")
            {
                return(dataCaches_Manage.InitDataCheck <T>(tagDataCheck, dataCheck, isCanCover));
            }

            //DataCaches
            IData_Factor infoFactor = infoFactors.GetData_Factor(tagFactor);

            if (infoFactor == null)
            {
                return(false);
            }
            IDataCaches dataCaches = this.GetDataCaches(infoFactors, infoFactor);

            if (dataCaches == null)
            {
                return(false);
            }

            IDataCache dataCache = dataCaches.GetDataCache <T>(strTag, typeTimeFrequency);

            if (dataCache == null)
            {
                return(dataCaches.InitDataCheck <T>(tagDataCheck, dataCheck, isCanCover));
            }
            else
            {
                return(dataCache.InitDataCheck(tagDataCheck, dataCheck, isCanCover));
            }
        }