18 using System.Collections.Generic;
28 private DateTime _date;
29 private readonly Dictionary<SecurityIdentifier, CoarseFundamental> _coarseFundamental =
new();
41 var enumName = Enum.GetName(name);
42 lock (_coarseFundamental)
46 return GetProperty<T>(securityIdentifier, enumName);
50 var path = Path.Combine(
Globals.
DataFolder,
"equity",
"usa",
"fundamental",
"coarse", $
"{time:yyyyMMdd}.csv");
52 if (fileStream ==
null)
57 _coarseFundamental.Clear();
58 using (var reader =
new StreamReader(fileStream))
60 while (!reader.EndOfStream)
62 var line = reader.ReadLine();
63 var coarse =
Read(line, time);
66 _coarseFundamental[coarse.Symbol.ID] = coarse;
71 return GetProperty<T>(securityIdentifier, enumName);
82 var csv = line.Split(
',');
87 Value = csv[2].ToDecimal(),
88 VolumeSetter = csv[3].ToInt64(),
89 DollarVolumeSetter = (double)csv[4].ToDecimal()
94 coarse.HasFundamentalDataSetter = csv[5].ConvertInvariant<
bool>();
99 coarse.PriceFactorSetter = csv[6].ToDecimal();
100 coarse.SplitFactorSetter = csv[7].ToDecimal();
112 private dynamic GetProperty<T>(
SecurityIdentifier securityIdentifier,
string property)
114 if (!_coarseFundamental.TryGetValue(securityIdentifier, out var coarse))
121 case nameof(CoarseFundamental.Price):
123 case nameof(CoarseFundamental.Value):
125 case nameof(CoarseFundamental.Market):
127 case nameof(CoarseFundamental.Volume):
128 return coarse.Volume;
129 case nameof(CoarseFundamental.PriceFactor):
130 return coarse.PriceFactor;
131 case nameof(CoarseFundamental.SplitFactor):
132 return coarse.SplitFactor;
133 case nameof(CoarseFundamental.DollarVolume):
134 return coarse.DollarVolume;
135 case nameof(CoarseFundamental.HasFundamentalData):