19 using System.Globalization;
20 using System.Collections.Generic;
42 public string CUSIP {
get;
set; }
58 public string SEDOL {
get;
set; }
64 public string ISIN {
get;
set; }
71 public int?
CIK {
get;
set; }
79 public static List<SecurityDefinition>
Read(
IDataProvider dataProvider,
string securitiesDefinitionKey)
81 using var stream = dataProvider.
Fetch(securitiesDefinitionKey);
82 using var reader =
new StreamReader(stream);
84 var securityDefinitions =
new List<SecurityDefinition>();
87 while ((line = reader.ReadLine()) !=
null)
89 if (
string.IsNullOrWhiteSpace(line) || line.StartsWith(
"#", StringComparison.InvariantCulture))
97 return securityDefinitions;
107 public static bool TryRead(
IDataProvider dataProvider,
string securitiesDatabaseKey, out List<SecurityDefinition> securityDefinitions)
111 securityDefinitions =
Read(dataProvider, securitiesDatabaseKey);
116 securityDefinitions =
null;
128 var csv = line.Split(
',');
132 CUSIP =
string.IsNullOrWhiteSpace(csv[1]) ? null : csv[1],
133 CompositeFIGI =
string.IsNullOrWhiteSpace(csv[2]) ? null : csv[2],
134 SEDOL =
string.IsNullOrWhiteSpace(csv[3]) ? null : csv[3],
135 ISIN =
string.IsNullOrWhiteSpace(csv[4]) ? null : csv[4],
136 CIK = (csv.Length <= 5 ||
string.IsNullOrWhiteSpace(csv[5])) ?
null :
int.
Parse(csv[5], CultureInfo.InvariantCulture)