public int InitDataCache_Data <T>(IData_Factors infoFactors, IData_Factor infoFactor, string tagName, typeTimeFrequency typeTimeFrequency, Dictionary <DateTime, T> datas, bool useEvent = false) { if (_isInited == false) { return(-1); } DataCaches dataCaches = (DataCaches)this.GetDataCaches(infoFactors, infoFactor); if (dataCaches == null) { return(-1); } if (dataCaches.GetDataCache <T>(tagName, typeTimeFrequency) == null) { DataCache <T> dataCache = (DataCache <T>)dataCaches.GetDataCache <T>(tagName, typeTimeFrequency, true, 0); //注册事件 if (useEvent) { dataCache.DataCache_Load += new DataCacheLoad_EventHandler(EventHandler_DataCacheLoad); dataCache.DataChecks_Initial += new DataCacheChecksInitial_EventHandler(EventHandler_DataCacheChecksInitial); dataCache.DataCache_Change += new DataCacheChange_EventHandler(EventHandler_DataCacheChange); dataCache.Event_DataCache_Load(); dataCache.Event_DataChecks_Initial(); } return(dataCache.InitDatas(datas)); } return(-1); }
/// <summary>按因子对象初始因子数据缓存对象 /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="infoFactors">因子对象集</param> /// <param name="infoFactor">因子对象</param> /// <param name="tagName">标识</param> /// <param name="typeTimeFrequency">数据频率</param> /// <param name="cacheNums">缓存数据数量</param> /// <returns></returns> public bool InitDataCache <T>(IData_Factors infoFactors, IData_Factor infoFactor, string tagName, typeTimeFrequency typeTimeFrequency, int cacheNums, bool useEvent = false) { if (_isInited == false) { return(false); } DataCaches dataCaches = (DataCaches)this.GetDataCaches(infoFactors, infoFactor); if (dataCaches == null) { return(false); } if (dataCaches.GetDataCache <T>(tagName, typeTimeFrequency) == null) { DataCache <T> dataCache = (DataCache <T>)dataCaches.GetDataCache <T>(tagName, typeTimeFrequency, true, cacheNums); //注册事件 if (useEvent) { dataCache.DataCache_Load += new DataCacheLoad_EventHandler(EventHandler_DataCacheLoad); dataCache.DataChecks_Initial += new DataCacheChecksInitial_EventHandler(EventHandler_DataCacheChecksInitial); dataCache.DataCache_Change += new DataCacheChange_EventHandler(EventHandler_DataCacheChange); dataCache.Event_DataCache_Load(); dataCache.Event_DataChecks_Initial(); } return(this._IndexFactors(infoFactors, infoFactor)); } return(true); }
// 按因子对象初始因子数据缓存集 public bool InitDataCaches(IData_Factors infoFactors, IData_Factor infoFactor, bool useEvent = false) { if (_isInited == false) { return(false); } IDataCaches_Manage dataManage = this.GetDataCaches_Manage(infoFactors); if (dataManage == null) { return(false); } if (dataManage.GetDataCaches(infoFactor, false) == null) { DataCaches dataCaches = (DataCaches)dataManage.GetDataCaches(infoFactor, true); //注册检查集初始事件 if (useEvent) { dataCaches.DataChecks_Initial += new DataCachesChecksInitial_EventHandler(EventHandler_DataCachesChecksInitial); dataCaches.Event_DataChecks_Initial(); } return(this._IndexFactors(infoFactors, infoFactor)); } return(true); }
// 初始单个 public bool InitDataCaches(IData_Factor infoFactor) { if (this.GetDataCaches(infoFactor) == null) { DataCaches data = new DataCaches(infoFactor, _DataCache_Set); _DataCaches[data.ID] = data; return(true); } return(true); }
public DataCaches_Event(DataCaches dataCaches) { _dataCaches = dataCaches; }