Commit Graph

32 Commits

Author SHA1 Message Date
Martin Molinero a8173589c7 Add StreamReader for Tick
- Add StreamReader Reader for Tick data type.
- Adding stream reader GetString extension, adding tests.
- BacktestingBrokerage will not create unnecessary order events
2020-04-28 13:32:40 -03:00
Martin Molinero 47795f1c90 Extend StreamReader for QuoteBars
- Adding performance tests for StreamReader QuoteBars
2020-04-10 15:39:51 -03:00
Martin Molinero 3a5a2c582f Lazy OnEndOfDay ScheduledEvent
- Only add OnEndOfDay ScheduledEvent if the algorithm implements the
method. Adding unit tests
- Avoid creating a new baseData instance at
`SubscriptionDataSourceReader`
- Adding static `FineFundamental` instance since creating new ones is
expensive
2019-12-19 19:07:16 -03:00
Martin Molinero 3aa745ee42 Add StreamReader BaseData.Reader
- Add `BaseData.Reader` implementation which consumes the `StreamReader`
directly, avoiding in between substrings and parsing improving
performance and reducing resource consumption
- Adding unit tests, including performance unit test showing a >50%
improvement
2019-11-18 17:03:27 -03:00
Martin Molinero c9a189ae3d Add Tiingo news data
- Add Tiingo news data
- Add `IndexSubscriptionDataSourceReader` that will handle data source
which use and index file
- Add `BaseSubscriptionDataSourceReader` to avoid code duplication
- Adjustments at `LiveCustomDataSubscriptionEnumeratorFactory` so that
custom data in a collection format does not emit old data
- Adding `TiingoNewsJsonConverter`
- Adding unit tests
2019-10-01 00:26:36 -03:00
Michael Handschuh f7034aa9d7 Add SubscriptionDataConfig GetBaseDataInstance extension method
Updates usages of GetBaseDataInstance that have a config in scope to use this
new method. This method properly assigns the symbol to the newly created base
data instance. This enables some of the new flag methods to work as expected.
Updated other poor usages where we weren't setting the symbol property.

See #3618
2019-09-27 14:27:08 -04:00
Martin Molinero c5a8174d49 Address review 2019-08-20 20:55:42 -03:00
Martin Molinero 08b72c5907 Overall performance improvements v2
- Adding `LazyToUpper()` implementation, that will avoid the call to
`ToUpper` if the string is already upper.
- Reduce the timezone conversions at `Time.EachTradeableDayInTimeZone`
- `TotalPortfolioValue` will iterate over all securities once
- Adding new `SecurityIdentifier` cache, significant impact for
algorithms using coarse/fine data
2019-06-05 17:06:59 -03:00
Martin Molinero d4a4a992a5 Address reviews 2019-05-22 16:31:17 -03:00
Martin Molinero 7becc869af Fix infinite live custom data polling
- Adding `IStreamReader.RateLimit { get; }` specifying if a stream
reader `ReadLine()` calls should be rate limited by the source readers.
- Adding two failling unit tests in `master`
2019-05-21 16:15:38 -03:00
Martin-Molinero 2a69b3279a Add IDataCacheProvider.IsDataEphemeral (#3160)
* Add IDataCacheProvider.IsDataEphemeral
2019-05-01 19:33:35 -07:00
Martin Molinero baf0f207ea Adding unit tests 2019-03-01 12:35:46 -03:00
Martin Molinero 8f6ad4e3c8 Cache raw data points
- `TextSubscriptionDataSourceReader` will now cache raw price mode data
points for each requested local source file, per data type.
Caching will be handled by the `MemoryCache` class.
- `GetLastKnownPrice()` will not `RoundDown` end time. This was causing
it to fail to fetch a data point in some cases.
2019-02-28 16:56:35 -03:00
Juan José D'Ambrosio 9eaf4cb6b0 Implementing live mode flag into RestSubscriptionStreamReader
Through `SubscriptionDataSource`.
Exceptions, cocumenting, cleaning and testing adjust


make isLiveMode mandatory in the SubscriptionDataSource constructor


Calls to SubscriptionDataSource implements new bool argument


csproj file mistake fixed 


Clean up nullable from prevoius implementation.


Revert "Exceptions, cocumenting, cleaning and testing adjust"

This reverts commit 7da7a9fca195b327a1322c0c7c4a7a088b2f1099.
SubscriptionDataSource back to default.

 Uisng LiveMode flag from  the calling contex
_delivered variabl setting.


Comments fixed


xml doc fix
2018-02-02 19:27:31 -03:00
Michael Handschuh d0e2f3d38e Filter null or uninitialized data immediately
The convention throughout the documentation and source code is to either
return null or a new, uninitialized object to indicate that the reader method
was unable to produce an instance from the previous content. It appears over
time that these filters were forgotten within the data enumerator stacks.
2017-12-04 15:45:44 +01:00
Michael Handschuh b595005df8 Support headers in SubscriptionDataSource
It is not uncommon that a web service would require some form of
authentication headers to be provided. This change aims to enable
this by adding the header information to the source. This design
allows a user's custom data type to return the source properly
hydrated with the required header values before being sent back
through the rest of the LEAN infrastructure.
2017-11-13 16:53:02 -05:00
Stefano Raggi 1ef0d0cfe0 Fix DirectoryNotFoundException when using custom data with FileFormat.Collection 2017-07-26 17:18:33 +02:00
jaredbroad 0f40b0df05 Merge remote-tracking branch 'origin/master' into pythonnet 2017-03-26 10:14:03 -04:00
Andrew 672e134939 Removed ApiDataProvider
Refactored IHistoryProvider interface order of parameters
2017-02-16 15:47:06 -05:00
Andrew b6171cc9d5 Renamed IDataFileProvider to IDataProvider using resharper
Refactored IDataProvider interface to return stream. The IDataProvider
Fetch method now only takes a key.  The IDataProvider
has been reshuffled to be at the bottom of the LeanDataStack.  It provides
data to the rest of the Lean stack. The default implementation of IDataProvider reads
data from disc.

All IDataCacheProviders now have constructors which take IDataProviders
and use them to find data on disc.

Renamed DataCacheProvider to ZipDataCacheProvider

Added comments to IDataProvider and it's implementations

Added comments to IDataCacheProvider and it's implementations
2017-02-15 12:16:50 -05:00
Andrew ed2107132e IHistoryProvider.Initialize() requires a DataCacheProvider
Fixed bug where DataCacheProvider was returning a stream without closing
the stream.  Also, ZipFiles returned from ZipFileCacheProvider are
effectively disposed.

Removed date field from IDataCacheProvider interface
2017-02-15 12:16:49 -05:00
Andrew 952e1d19e3 Added interface IDataCacheProvider that defines a mechanism for caching data
This interface was built around the existing implementation of the
DataCacheProvider.  It's purpose is to define a method for caching data
files.  Currently, most data files are either read from disc or retrieved
remotely. The IDataChceProvider returns returns a Stream and can handle
many types of data. The IDataFileCacheProvider is needed because keeping data in memory will improve performance and overcome certain File read/write limitations (such as sharing violations) currently experienced by Lean.

There are two implementations of this interface.  The first is the
SingleZipEntryDataCache.  This is the default implementation. It does not
cache and returns the first entry found within a ZipFile.  The second is
the ZipEntryCacheProvider.  This is a rework of the existing
DataCachePrivider.  It caches ZipFiles for up to 10 seconds.  It can
return specific entries for option and future ZipFiles.  Otherwise, it
returns the first entry in a ZipFile.

Added IDataFileCacheProvider as parameter to IHistoryProvider.Initialize()

The IDataFileCacheProvider is very useful for the IHistoryProvider in that it can eliminate the need for history request to touch disc.  This can greatly improve peerformance and eliminate disc bugs associated with disc read/writes. To minimize changes throughtout Lean, the default value for the IDataFileCacheProvider is null in the IHistoryProvider.Initialize method.

IDataCacheProviders are passed down the Lean stack. Each instance of a Subscription Enumerator factory decides what cache it
will use.  In other words, the IDataCacheProvider is not configurable from
config.json.  The IDataCacheProvider is passwed down the stack form the
Enumerator factory to the IStreamReader where it is used to retrieve data.

Added useful helper method to Unizp files into a Stream.
2017-02-15 12:16:49 -05:00
AlexCatarino 9774af9adc Custom Data for Python Support 2017-02-09 17:48:50 -02:00
quant1729 ddbb7c902c Added support for light data file cache 2017-01-11 14:19:15 +08:00
quant1729 48721125dc Revert "Fixed bug with static zip archive caching. Added new caching data file provider. Refactored IDataFileProvider interface."
This reverts commit c59743dc42.
2017-01-11 11:27:28 +08:00
quant1729 2a7d8d6b33 Revert "Refactored zip cache as discussed"
This reverts commit 61e92e18c0.
2017-01-11 11:27:16 +08:00
quant1729 61e92e18c0 Refactored zip cache as discussed 2017-01-10 17:02:44 +08:00
quant1729 c59743dc42 Fixed bug with static zip archive caching. Added new caching data file provider. Refactored IDataFileProvider interface. 2017-01-08 09:25:26 +08:00
Andrew 8957012a49 Added TickType to IDataFileProvider Fetch() method signature 2016-10-21 10:57:26 -04:00
Andrew fdea52a933 Renamed XxxFileProvider to XxxDataFileProvider 2016-10-20 08:36:36 -04:00
Andrew bcd3cb6b10 FileProvider can now be configured in config.json
The DefaultFileProvider is now configured as by default as the file-provider in config.json and passed in the the engine through the leanAlgorithmHandlers object.

The FileProvider is now passed into the TextSubscriptionDataSourceReader and ZipEntryNameSubscriptionDataSourceReader.  Most of the changes in this commit are just getting the FileProvider to those two methods.
2016-10-17 15:52:11 -04:00
Michael Handschuh 83337000dc File renames
Performing the file renames and the class renames in separate
changelists can make it easier for tools to track a single file's
history.
2016-06-04 18:17:32 -04:00