BaseDownloaderDataProvider
QuantConnect.Lean.Engine.DataFeeds.BaseDownloaderDataProvider
Bases: DefaultDataProvider
Base downloader implementation with some helper methods
new_data_request
new_data_request: _EventContainer[
Callable[
[Object, DataProviderNewDataRequestEventArgs], Any
],
Any,
]
Event raised each time data fetch is finished (successfully or not)
download_once
download_once(
key: str, download: Callable[[str], Any]
) -> Stream
Helper method which guarantees each requested key is downloaded only once concurrently if required based on need_to_download
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
A string representing where the data is stored |
required |
download
|
Callable[[str], Any]
|
The download operation we want to perform once concurrently per key |
required |
Returns:
| Type | Description |
|---|---|
Stream
|
A Stream of the data requested. |
get_stream
get_stream(key: str) -> Stream
Get's the stream for a given file path
This codeEntityType is protected.
need_to_download
need_to_download(file_path: str) -> bool
Main filter to determine if this file needs to be downloaded
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
File we are looking at |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if should download. |
fetch
fetch(key: str) -> Stream
Retrieves data from disc to be used in an algorithm
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
A string representing where the data is stored |
required |
Returns:
| Type | Description |
|---|---|
Stream
|
A Stream of the data requested. |
dispose
dispose() -> None
The stream created by this type is passed up the stack to the IStreamReader The stream is closed when the StreamReader that wraps this stream is disposed
on_new_data_request
on_new_data_request(
e: DataProviderNewDataRequestEventArgs,
) -> None
Event invocator for the new_data_request event
This codeEntityType is protected.