/// <summary> /// Get's the security definitions using a lazy initialization /// </summary> private IEnumerable <SecurityDefinition> GetSecurityDefinitions() { if (_securityDefinitions != null) { return(_securityDefinitions); } if (!SecurityDefinition.TryRead(_dataProvider, _securitiesDefinitionKey, out _securityDefinitions)) { _securityDefinitions = new List <SecurityDefinition>(); Log.Error($"SecurityDefinitionSymbolResolver(): No security definitions data loaded from file: {_securitiesDefinitionKey}"); } return(_securityDefinitions); }
/// <summary> /// Creates an instance of the symbol resolver /// </summary> /// <param name="dataProvider">Data provider used to obtain symbol mappings data</param> /// <param name="securitiesDefinitionKey">Location to read the securities definition data from</param> public SecurityDefinitionSymbolResolver(IDataProvider dataProvider = null, string securitiesDefinitionKey = null) { securitiesDefinitionKey ??= Path.Combine(Globals.DataFolder, "symbol-properties", "security-database.csv"); _dataProvider = dataProvider ?? Composer.Instance.GetExportedValueByTypeName <IDataProvider>( Config.Get("data-provider", "QuantConnect.Lean.Engine.DataFeeds.DefaultDataProvider")); if (!SecurityDefinition.TryRead(_dataProvider, securitiesDefinitionKey, out _securityDefinitions)) { Log.Error($"SecurityDefinitionSymbolResolver(): No security definitions data loaded from file: {securitiesDefinitionKey}"); } _mapFileProvider = Composer.Instance.GetExportedValueByTypeName <IMapFileProvider>(Config.Get("map-file-provider", "LocalDiskMapFileProvider")); _mapFileProvider.Initialize(_dataProvider); }