42 var file = Path.Combine(directory,
"symbol-properties-database.csv");
43 var baseOutputDirectory =
Config.
Get(
"temp-output-directory",
"/temp-output-directory");
44 var tempOutputDirectory = Directory.CreateDirectory(Path.Combine(baseOutputDirectory,
"symbol-properties"));
45 var tmp = Path.Combine(tempOutputDirectory.FullName,
"symbol-properties-database.csv");
50 else if (!File.Exists(file))
52 throw new FileNotFoundException(
"Unable to locate symbol properties file: " + file);
57 var fileLines = File.ReadLines(file).ToList();
59 using (var writer =
new StreamWriter(tmp))
62 var filter = $
"{_eidl.Market},";
63 foreach (var line
in fileLines)
65 if (!line.StartsWithInvariant(filter,
true))
67 writer.WriteLine(line);
78 writer.WriteLine(Environment.NewLine);
84 private void WriteData(StreamWriter writer)
87 var entryPerSymbol = _eidl.Get().ToDictionary(newLine => {
88 var splitted = newLine.Split(
',');
92 foreach (var existingEntry
in existingSymbolPropertiesDatabase.GetSymbolPropertiesList(_eidl.Market))
94 if (!entryPerSymbol.ContainsKey(existingEntry.Key))
97 entryPerSymbol[existingEntry.Key] = $
"{existingEntry.Key.Market},{existingEntry.Key.Symbol},{existingEntry.Key.SecurityType.ToLower()},{existingEntry.Value}";
101 foreach (var upd
in entryPerSymbol.OrderBy(x => x.Key.SecurityType).ThenBy(x => x.Key.Symbol))
103 writer.WriteLine(upd.Value);