CsvImporter
StockSharp.Algo.Import
Messages importer from text file in CSV format into storage.
Inherits: CsvParser
Constructors
CsvImporter
public CsvImporter(DataType dataType, IEnumerable<FieldMapping> fields, ISecurityStorage securityStorage, IExchangeInfoProvider exchangeInfoProvider, Func<SecurityId, IMarketDataStorage> getStorage)
csvImporter = CsvImporter(dataType, fields, securityStorage, exchangeInfoProvider, getStorage)
Messages importer from text file in CSV format into storage.
- dataType
- Data type info.
- fields
- Importing fields.
- securityStorage
- Securities meta info storage.
- exchangeInfoProvider
- Exchanges and trading boards provider.
- getStorage
- Function to get IMarketDataStorage by SecurityId.
Properties
UpdateDuplicateSecurities
public bool UpdateDuplicateSecurities { get; set; }
value = csvImporter.UpdateDuplicateSecurities
csvImporter.UpdateDuplicateSecurities = value
Update duplicate securities if they already exists.
Methods
Import
public ValueTask<ValueTuple<int, DateTime?>> Import(Stream stream, Action<int> updateProgress, CancellationToken cancellationToken)
result = csvImporter.Import(stream, updateProgress, cancellationToken)
Import from CSV file.
- stream
- The file stream.
- updateProgress
- Progress notification.
- cancellationToken
- CancellationToken
Returns: Count and last time.
Events
SecurityUpdated
public event Action<Security, bool> SecurityUpdated
csvImporter.SecurityUpdated += handler
Security updated event.