Lean  $LEAN_TAG$
QuantConnect.Data.LeanDataWriter Class Reference

Data writer for saving an IEnumerable of BaseData into the LEAN data directory. More...

Public Member Functions

 LeanDataWriter (Resolution resolution, Symbol symbol, string dataDirectory, TickType tickType=TickType.Trade, IDataCacheProvider dataCacheProvider=null, WritePolicy? writePolicy=null, bool mapSymbol=false)
 Create a new lean data writer to this base data directory. More...
 
 LeanDataWriter (string dataDirectory, Resolution resolution, SecurityType securityType, TickType tickType, IDataCacheProvider dataCacheProvider=null, WritePolicy? writePolicy=null)
 Create a new lean data writer to this base data directory. More...
 
void Write (IEnumerable< BaseData > source)
 Given the constructor parameters, write out the data in LEAN format. More...
 
void DownloadAndSave (IBrokerage brokerage, List< Symbol > symbols, DateTime startTimeUtc, DateTime endTimeUtc)
 Downloads historical data from the brokerage and saves it in LEAN format. More...
 

Properties

static Lazy< IMapFileProviderMapFileProvider [get, set]
 The map file provider instance to use More...
 

Detailed Description

Data writer for saving an IEnumerable of BaseData into the LEAN data directory.

Definition at line 35 of file LeanDataWriter.cs.

Constructor & Destructor Documentation

◆ LeanDataWriter() [1/2]

QuantConnect.Data.LeanDataWriter.LeanDataWriter ( Resolution  resolution,
Symbol  symbol,
string  dataDirectory,
TickType  tickType = TickType.Trade,
IDataCacheProvider  dataCacheProvider = null,
WritePolicy writePolicy = null,
bool  mapSymbol = false 
)

Create a new lean data writer to this base data directory.

Parameters
symbolSymbol string
dataDirectoryBase data directory
resolutionResolution of the desired output data
tickTypeThe tick type
dataCacheProviderThe data cache provider to use
writePolicyThe file write policy to use
mapSymbolTrue if the symbol should be mapped while writting the data

Definition at line 66 of file LeanDataWriter.cs.

Here is the caller graph for this function:

◆ LeanDataWriter() [2/2]

QuantConnect.Data.LeanDataWriter.LeanDataWriter ( string  dataDirectory,
Resolution  resolution,
SecurityType  securityType,
TickType  tickType,
IDataCacheProvider  dataCacheProvider = null,
WritePolicy writePolicy = null 
)

Create a new lean data writer to this base data directory.

Parameters
dataDirectoryBase data directory
resolutionResolution of the desired output data
securityTypeThe security type
tickTypeThe tick type
dataCacheProviderThe data cache provider to use
writePolicyThe file write policy to use

Definition at line 101 of file LeanDataWriter.cs.

Member Function Documentation

◆ Write()

void QuantConnect.Data.LeanDataWriter.Write ( IEnumerable< BaseData source)

Given the constructor parameters, write out the data in LEAN format.

Parameters
sourceIEnumerable source of the data: sorted from oldest to newest.

Definition at line 123 of file LeanDataWriter.cs.

Here is the call graph for this function:

◆ DownloadAndSave()

void QuantConnect.Data.LeanDataWriter.DownloadAndSave ( IBrokerage  brokerage,
List< Symbol symbols,
DateTime  startTimeUtc,
DateTime  endTimeUtc 
)

Downloads historical data from the brokerage and saves it in LEAN format.

Parameters
brokerageThe brokerage from where to fetch the data
symbolsThe list of symbols
startTimeUtcThe starting date/time (UTC)
endTimeUtcThe ending date/time (UTC)

Definition at line 195 of file LeanDataWriter.cs.

Here is the call graph for this function:

Property Documentation

◆ MapFileProvider

Lazy<IMapFileProvider> QuantConnect.Data.LeanDataWriter.MapFileProvider
staticgetset
Initial value:
= new(
Composer.Instance.GetExportedValueByTypeName<IMapFileProvider>(Config.Get("map-file-provider", "LocalDiskMapFileProvider"), forceTypeNameOnExisting: false)
)

The map file provider instance to use

Public for testing

Definition at line 43 of file LeanDataWriter.cs.


The documentation for this class was generated from the following file: