Commit Graph

126 Commits

Author SHA1 Message Date
Martin Molinero 1d3d4b9bc8 Improvements - self review 2019-07-26 11:43:45 -03:00
Martin Molinero b6e9498b9e Improve FineFundamental backtesting performance
- Reduce the amount of `Path.Combine()` usages -> it has a peformance
overhead
- Improving `FineFundamentalSubscriptionFactory` GetSource algorithm,
now it will not check if each file exists while finding the appropriate,
since we already iterated the directory before
- `DefaultDataProvider` will not check if file exists since `new
FileStream` performance the same operation internally
2019-07-25 22:35:28 -03:00
Stefano Raggi e9739064e6 Fix LiveEquityDataSynchronizingEnumerator for input data after the current time
Previously the enumerator would get stuck and stop emitting data if one of the underlying enumerators returned a data point with the time greater than the current time. The existing unit test would only emit the first data point for the two underlying streams.

The enumerator has been updated to support data points in the future and the unit test has been extended to assert both data point counts and values.
2019-07-09 16:49:50 +02:00
Jared ac0de6b466 Merge pull request #3303 from Martin-Molinero/performance-3302-mapfile-factorfile-data-feed-stack-resolution
MapFile and FactorFile data feed stack resolution
2019-06-13 16:37:36 -07:00
Martin Molinero 1370ae666a Address reviews 2019-06-13 20:33:22 -03:00
Martin Molinero 19701461cc Fix live data delay
- C# `Timer` can sometimes be triggered before the expected due time.
Implementing `RealTimeScheduleEventService` that will guarantee a
scheduled event due time is respected and the event never happens before
time.
2019-06-13 17:52:29 -03:00
Martin Molinero 7aafdef827 MapFile and FactorFile data feed resolution
- Moving `MapFile` and `FactorFile` resolution to the data feed stack so
that they do not add a performance overhead to the algorithm thread.
- Create logging string messaged only if required.
- Calculate `FactorFileRow.PriceScaleFactor` the least amount of times
2019-06-12 17:48:47 -03:00
Martin Molinero d360ec36ac Address reviews 2019-05-31 18:26:18 -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
Jared bcfd0fbae6 Merge pull request #3040 from QuantConnect/bug-live-synchronizer-high-cpu-usage
Reduce CPU Usage in Live Synchronizer
2019-05-03 13:39:23 -07:00
Stefano Raggi 24165c7b29 Fix time zone bug in FillForwardEnumerator and LiveFillForwardEnumerator (#3132)
* Fix time zone bug in FillForwardEnumerator

* Fix time zone bug in LiveFillForwardEnumerator
2019-04-30 17:22:59 -07:00
Stefano Raggi 30c2b45a49 Post-review updates
- Made event invocators private
- Set timer period to Timeout.InfiniteTimeSpan
2019-04-29 15:26:50 +02:00
Stefano Raggi 7d730f8db7 Improve timing of data available events for LiveSynchronizer 2019-04-29 15:26:50 +02:00
Stefano Raggi 8d43ef5b6a Reduce CPU usage in live synchronizer 2019-04-29 15:16:21 +02:00
Juan José D'Ambrosio 9fe9c59991 Fix asset classification reading bug
Add `AssetClassification` and  `CompanyProfile` properties to  the  FineFundamental object in the `FineFundamentalSubscriptionEnumeratorFactory`
2019-04-24 03:48:55 +00:00
Stefano Raggi 875666f42d Fix date bug in BaseDataCollectionSubscriptionEnumeratorFactory
This bug was causing coarse data to be shifted ahead one day and was introduced in PR #2996
2019-04-02 20:43:23 +02:00
Stefano Raggi 08895c2c8a Reduce CPU usage in live equity enumerator stack 2019-03-26 21:10:28 +01:00
Stefano Raggi 0bd4839588 Add comments to document the coarse enumerator factory changes 2019-03-12 17:10:40 +01:00
Stefano Raggi ffde80be48 Remove potential look-ahead bias in backtesting with coarse fundamental data 2019-03-12 13:25:51 +01:00
Martin Molinero ce3f7ecd41 Replace FileSystem workers Thread for Tasks
- Deleting `ParallelRunnerController` and `ParallelRunnerWorker`.
Replacing them for `Tasks`. The consumer, `EnqueueableEnumerator` will
directly spin up a new producer Task when he is running low on items.
2019-03-04 15:12:46 -03:00
Martin Molinero ed5f7ab58c Moving price scale factoring to new enumerator
- Adding new `PriceScaleFactorEnumerator` that will scale raw prices
based on a provided `SubscriptionDataConfig` and update the
`SubscriptionDataConfig.PriceScaleFactor`. Adding unit tests.
- `BaseData` factories (`TradeBar.cs`, `QuoteBar.cs`, `Tick.cs`) will
no longer scale factor prices, they will generate data points in raw
mode.
- `SubscriptionDataReader` will no longer update the
`SuscriptionDataConfig.PriceScaleFactor`
- Fix `BrokerageTransactionHandlerTests` unit test that was having a
race condition.
2019-02-27 15:11:34 -03:00
Stefano Raggi 4e241dec52 Add missing list materialization in AuxiliaryDataEnumerator
- restored includeAuxiliaryData to false in SubscriptionDataReaderHistoryProvider
2019-01-17 20:22:49 +01:00
Martin Molinero dea0fe2674 Implementing composition over inheritance
- Mappings, splits, delisting and dividends will be
`ITradableDateEventProvider` that will be handled by
the `AuxiliaryDataEnumerator`.
2018-11-20 16:17:44 -03:00
Martin Molinero 6db7f13dca Addressing reviews
- Will now use the `SynchronizingEnumerator` and avoid the duplicated
synchronization logic.
- Slightly modified the `SynchronizingEnumerator` implementation to
avoid removing enumerators with current `null` returning `true`. Adding unit tests
- Adding unit tests for `DelistingEnumerator`
- Fixing issue where price was not correctly set. Adding new check for
`HourSplitRegressionAlgorithm`
2018-11-20 15:50:19 -03:00
Martin Molinero a746dd0137 Move corporate events to enumerators
- Moving `Splits`, `Dividends`, `Mappings`, `Delistings`, from the
`SubscriptionDataReader` into there own enumerator, inheriting from
new `CorporateEventBaseEnumerator`
- Adding new helper `static class CorporateEventEnumeratorFactory` to
create the new enumerators
- Adding unit tests for new `CorporateEventBaseEnumerator`
- Adding some extra checks to `HourSplitRegressionAlgorithm` and
`DelistingEventsAlgorithm`
2018-11-20 15:50:19 -03:00
Stefano Raggi dbacd57880 Update live option universe enumerator stack to refresh every day
The DataQueueOptionChainUniverseDataCollectionEnumerator now reloads the option chain from the IDataQueueUniverseProvider when the date changes.
2018-11-13 11:38:47 +01:00
Stefano Raggi 203a317940 Remove unnecessary null check in DataQueueFuturesChainUniverseDataCollectionEnumerator.MoveNext 2018-11-08 20:41:51 +01:00
Stefano Raggi de32c3aefd Update future universe enumerator stack to refresh every day
- The DataQueueFuturesChainUniverseDataCollectionEnumerator now reloads the future chain from the IDataQueueUniverseProvider when the date changes.
2018-11-08 15:00:43 +01:00
Stefano Raggi dbaf109c78 Post-review updates
- Renamed events in SubscriptionDataReader and IHistoryProvider
- Added HistoryProvider base class with events and event invocators
2018-10-14 22:29:06 +02:00
Stefano Raggi 9fad26bc8f Add events to IHistoryProvider and SubscriptionDataReader
The SubscriptionDataReaderHistoryProvider was using StubResultHandler, so no error messages were being shown or logged. By adding events to IHistoryProvider and SubscriptionDataReader, the dependency on IResultHandler could be removed completely and error messages are now pushed up the stack.
2018-10-14 22:29:04 +02:00
Martin Molinero 4f5f7330a9 Fix for Quandl custom data race condition 2018-08-10 18:30:17 -03:00
Martin Molinero f7dada5aae Adding default return value for GetMappedSymbol() 2018-07-13 18:51:06 -03:00
Stefano Raggi 27ff429557 Fix time bug in synchronizing enumerator tests
In addition, small optimization made in MoveNext
2018-06-12 17:51:38 +02:00
Stefano Raggi e5ff575533 Update LiveTradingDataFeed to handle auxiliary data 2018-06-12 11:56:36 +02:00
Stefano Raggi 50ab5178e2 Fix threading bug in EnqueueableEnumerator.MoveNext
With the enumerator in blocking mode (backtesting), MoveNext was returning true while Current was being set to null.
This was causing a NullReferenceException in SubscriptionSynchronizer.Sync.
2018-05-25 22:04:35 +02:00
Stefano Raggi ada93e0782 Disable max age check in LiveCustomDataSubscriptionEnumeratorFactory
Quandl does not refresh data during weekends, so Friday data points will be included in the Sunday night update.

The previous data age check was preventing these data points from being emitted after a weekend.
2018-04-23 20:54:50 +02:00
Michael Handschuh cf7cd7e1fb Define ITimeTriggeredUniverse
Provides a common abstraction for UserDefinedUniverse and the
yet-to-be-impemented ScheduledUniverse. Categorized by the fact
that they don't operate on data, but instead a fixed schedule and
any data required is fetched through external means, such as a
web request.
2018-04-10 19:24:36 -04:00
Stefano Raggi 40a7a18103 Fix CreateEnumerator in subscription enumerator factories
These two classes were improperly reusing the same instance of SingleEntryDataCacheProvider in CreateEnumerator. Depending on the caller usage, they could be causing memory leaks.

Two memory usage tests were also added.
2018-02-09 21:59:57 +01:00
Stefano Raggi 8f115795c5 Fix FineFundamental universe selection resource leak
The FineFundamentalSubscriptionEnumeratorFactory used in combination with SingleEntryDataCacheProvider and DefaultDataProvider was never disposing of the underlying file stream, leaving files open.
2018-02-08 16:04:04 +01:00
Michael Handschuh ea01252cf2 Add LiveCustomDataSubscriptionEnumeratorFactory
Defines an enumerator factory for live custom data. This is a refactoring
and bugfix over the previous implementation. This implementation now checks
the transport medium of each refresh of the stack to see if it's a file or
a rest server and provides the appropriate fast forward/rate limiting behavior.
2017-10-17 12:15:58 -04:00
Michael Handschuh 98c4f06f63 Properly dispose of enumerator
The refresh enumerator wasn't properly disposing of the enumerator
created each time it refreshes the stack.
2017-10-17 12:15:58 -04:00
Michael Handschuh 8be428b662 Fix fast forward enumerator at end of enumeration
This enumerator was breaking the enumerator contract and returning
true when the underlying enumerator had finished. Some enumerators
in the live stack must always return true because they're never
really finished but the fast forward is a wrapper around another
enumerator and should respect when the underlying has completed
2017-10-17 12:15:58 -04:00
Michael Handschuh 2e9de42eeb Remove duplicate data check
This duplicate data check does NOT belong here. If we need to implement
a filter to screen out duplicate data then it should be done somewhere
more specific to live custom data instead of the generic frontier aware
enumerator.

The concern that this was attempting to address was repeating data for
remote files. This is handled by preventing duplicate time stamps from
being emitted following a refresh of the remote file
2017-10-17 12:15:58 -04:00
Michael Handschuh 7e0c73d4ad Make RateLimitEnumerator generic
This will allow reuse for types other than BaseData
2017-10-17 12:15:58 -04:00
Michael Handschuh dc58d3a387 Fixes RefreshEnumerator
The refresh enumerator is intended to refresh an enumerator stack
after the stack has been exhausted. The existing implementation
refreshed the enumerato stack on EVERY MoveNext invocation leading
to data being dropped.
2017-10-03 17:32:01 -04:00
Michael Handschuh e623e21c85 Refactor fill forward logic
This new logic harmonizes the implementation with the intent.
In short, there are 4 distinct cases that must be evaluated,
two for each interval, fill forward and data resolution.

I suspect there are some performance losses here but will save
optimization of this new algorithm as another exercise.

Fixes #1073
2017-10-02 12:16:06 -04:00
Michael Handschuh 6f1c07d488 Add dataTimeZone to FillForwardEnumerator 2017-10-02 12:16:06 -04:00
Michael Handschuh 6292f1e286 Clean white space 2017-10-02 12:16:05 -04:00
Stefano Raggi 138bf550fe Fix custom data enumerator in live mode
The live mode flag is now passed into BaseDataSubscriptionEnumeratorFactory and into the enumerator GetSource call.
2017-09-07 15:52:15 +02:00
Stefano Raggi e4509d1a5c Add QuoteBarFillForwardEnumerator 2017-08-15 12:22:41 +02:00