Commit Graph

203 Commits

Author SHA1 Message Date
Martin Molinero d360ec36ac Address reviews 2019-05-31 18:26:18 -03: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
Jared 54fbf36be8 Merge pull request #2671 from Martin-Molinero/refactor-2429-corporate-events-own-enumerator
Move corporate events to new enumerators
2018-12-03 10:45:44 -08: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
Martin Molinero 251071ee73 Remove Security from Subscription
- Removing unneeded `CashBook` instance to create a new `TimeSlice`
- Adding new `TimeSliceFactory`, an instance base class that will
provide methods to create a new `TimeSlice`. Will own the `DateTimeZone`
property.
- Adding new `ISecurityPrice` and `IOptionPrice` that will provide a
reduced interface for accessing price properties and methods used when
creating a new `TimeSlice`
2018-11-14 18:28:18 -03:00
Martin Molinero ee2dc32710 Subscriptions will track Universe requests
- The class `Subscription` will internally track each `Universe`
`SubscriptionRequest` added or removed
- Adding regression test in which two different `Universe` request the
same `SubscriptionDataConfig` and one of them removes/adds it in a
toggle fashion (fails on current master)
- `UniverseSelection` pending removals will also be tracked by
`Universe`
- `UniverseDecorator` will overwrite the `Universe` member of
`SubscriptionsRequests` at `GetSubscriptionRequests()`. This is due to
`this != this,Universe`
- Adding `Subscription` unit tests covering expected behavior
- Extracting pending removals logic from `UniverseSelection` class into
a new helper class `PendingRemovalsManager`. This new class will keep
track of the `universes` requesting to remove a security. Adding unit tests
2018-11-08 13:02:11 -03:00
Martin Molinero af86306bbf Addressing reviews 2018-10-29 16:13:27 -03:00
Martin Molinero f1ecfd5784 Move DataManager in front of DataFeed
- Completly move `DataManager` in front of `DataFeed`. Specifically
`AddSubscription()` and `RemoveSubscription()` implementations. Also
removing IDataFeed.Subscriptions
2018-10-29 16:13:27 -03:00
Martin Molinero 9bdf702c41 Creating new Synchronizer - TimeSlice streamer
- Creating new `Synchronizer` which will consolidate and combine `TimeSlice`
streaming for both live and backtests modes. Will live in front of the
`DataManager`
- `SubscriptionSynchronizer` will be the `FrontierTimeProvider` exposed,
and owned, by the new `Synchronizer`
- Updating existing tests
2018-10-19 15:36:08 -03:00
Michael Handschuh 4525560bf2 Merge pull request #2594 from Martin-Molinero/refactor-2495-remove-df-thread-ltdf-bridge
Align live and backtesting data feeds through usage of the SubscriptionSynchronizer
2018-10-12 14:28:17 -04:00
Michael Handschuh 20133d40d1 Add ICurrencyConverter to Security constructors
Security instances will require private access to this value in order to
compute close profit.

NOTE: The extent of these changes for simply adding a constructor argument
insinuates that we're missing an abstraction to manage the construction of
these objects, such as a factor object for Security. This will need some
careful TLC in the near future.
2018-10-10 11:17:12 -04:00
Martin Molinero 2fcd366b1a Removing DF thread - LTDF bridge
- Removing LiveTradingDataFeed bridge. LTDF will yield return Slices
directly from the enumerator, as done in the FSDF. The objective is for
both to share the same logic here and for it to be extracted in a next
PR
- Removing now unnecessary DataFeed running thread
- Adding if (_isStopping) { break; } statement for BaseDataExchange.
This is to avoid the thread to continue looping over the enumerators when stopping. Impacts when there are many securities.
2018-10-09 14:04:41 -03:00
Martin Molinero 0a82d16829 DataManager wraps IDataFeed. DataManager owns UniverseSelection instance 2018-09-17 20:45:16 -03:00
Martin Molinero ff2ef7962c SubscriptionSynchronizer will depend on a Time Provider for determining next frontier.
Adding new SubscriptionFrontierTimeProvider which updates current time based on the current data emit time of all subscriptions.
2018-09-06 15:48:07 -03:00
Martin Molinero 953cc48997 Addressing reviews. Some renames and setting new interface IDataFeedSubscriptionManager for future work 2018-08-31 16:06:41 -03:00
Martin Molinero a500fe010a Create DataManager class 2018-08-31 16:06:41 -03:00
Martin Molinero a2e818b1d7 Improve subscription sorting mechanism to improve performance 2018-07-17 09:59:31 -03:00
Michael Handschuh 80e01e0d1f Add support for removing universes
Adds the concept of universe disposal which is requested by an algorithm
through invocation of UniverseManager.Remove, which is invoked via
algorithm.RemoveSecurity. This instructs the data feed that the algorithm
has requested to completely remove the universe and any child subscriptions
from the feed. Security changes are fired for all removed securities.
2018-05-30 15:55:33 -04:00
Michael Handschuh f4f54987aa Add null check for subscriptions w/out universes
Internal forex currency conversion feeds are currently added without
a corresponding universe which leads to throwing a null reference exception
when the subscription gets removed at the end of the backtest.
2018-05-27 15:22:42 -04:00
Michael Handschuh 5d69b2a5e2 Remove disposed security data from TimeSlice
If we pull data and on the same time step that security gets removed,
we can still get that data in OnData(Slice) even though it was removed.
This change filters out removed securities by tracking a reference to
the subscription's disposed flag. Another change was made to wait until
the end of the time step to dispose of subscriptions.

Add IDataFeed.GetSubscription(SubscriptionDataConfig)
2018-05-24 17:40:29 -04: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
Michael Handschuh cee7ff7766 Move clone and tz conversion operations to DF thread
A large percentage of synchronization time is spent performing time zone conversions.
Previously, it was possible that we may compute the same tz conversion multiple times
on the same piece of data until it's emitted. This change moves the time zone conversion
logic onto the data feed thread right before it puts the data into enqueueable enumerator.
In addition, we're not performing the clone operation at the same moment. This removes
unnecessary computation while moving the necessary computation to the data feed thread to
lighten the load on the synchronization/algorithm thread.
2018-02-13 15:59:56 -05:00
Michael Handschuh d3ec0facc3 Add ISubscriptionSynchronizer interface
Provides an abstraction point allowing us to easily substitute in a different
synchronization algorithm. This isn't 100% complete as I'm hopefully able to
remove the universe selection dependency from the synchronization implementation.
2018-02-06 19:52:31 -05:00
Michael Handschuh db42b8a608 Move frontier to subscription synchronizer
The concept of subscription frontier is only relevant to the subscription synchronizer.
This change removes the back and forth communication of the frontier data between the
data feed component and the synchronizer component

This caused a change in the CoarseUniverseTop5DollarVolumeAlgorithm. The changed values are
due to the subscriptions now correctly stopping before the turn of the new year. The exact
same number of data points are emitted and the same trades are made, but due to the subscription
stopping slightly sooner (correctly), we lose a benchmark sample which caused a slightly different
beta to be computed (along with dependent statistics).
2018-02-06 19:52:31 -05:00
Michael Handschuh dc1b10b24d Remove frontier class member from FileSystemDataFeed
This is in preparation for the synchronization interface. The synchronization implementation
will be in charge of managing the algorithm manager's time frontier.
2018-02-06 19:52:31 -05:00
Michael Handschuh 667fde4786 Fixes bug w/ data feed initial frontier when changing default tz
Changing the default time zone after SetStartDate is set ends up with the algorithm's
UtcTime being incorrect. This can lead to incorrect start times in the data feed as
well
2018-02-06 09:29:13 -05:00
Stefano Raggi 513c830677 Remove usage of SubscriptionLimiter from universe selection
Previously the number of symbols that could be selected was limited by estimates of RAM usage calculated using the resolution of subscription, now it will only be limited by the physical RAM available.
2017-11-16 23:52:10 +01: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 e4509d1a5c Add QuoteBarFillForwardEnumerator 2017-08-15 12:22:41 +02:00
Stefano Raggi fa2d24a309 Fix error handling in FileSystemDataFeed
Exceptions thrown in the data feed were not reported as Runtime errors
2017-06-22 22:18:48 +02:00
Stefano Raggi 42914249e8 Add missing enumerator disposal when symbol removed from universe
This was causing unnecessary data processing with algorithms using universe selection, so we should expect some improvements in speed and memory usage.

Another less common issue fixed in this PR is unexpected price spikes on symbols with splits.

This fix only affects backtesting, no change in live trading.
2017-06-02 23:18:20 +02: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
Jared 7aef92ed44 Merge pull request #715 from quant1729/master-ffresolution-race-fix
Fixing fill forward resolution race bug in backtesting and live. Test.
2017-02-02 11:08:59 -05:00
quant1729 3cd1bc5cf5 Removed second FillForward enumerator and its friends 2017-01-30 17:10:36 +08:00
quant1729 b91638bb17 Fixing fill forward resolution race bug in backtesting and live. Test. 2017-01-30 16:02:21 +08:00
quant1729 ddbb7c902c Added support for light data file cache 2017-01-11 14:19:15 +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 705024cd89 Merge branch 'futures'
Conflicts:
	Common/QuantConnect.csproj
2016-12-20 15:53:24 +01:00
Stefano Raggi de037ad4ef Universe selection with FineFundamental filtering - backtesting and live 2016-12-06 15:44:41 +01:00
quant1729 1141cd21e6 Merge branch 'futures' into master
Conflicts:
	Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj
	Algorithm/QCAlgorithm.cs
	Brokerages/InteractiveBrokers/InteractiveBrokersBrokerage.cs
	Common/QuantConnect.csproj
	Common/Securities/Option/Option.cs
	Data/equity/usa/factor_files/aapl.csv
	Data/symbol-properties/symbol-properties-database.csv
	Engine/DataFeeds/Enumerators/Factories/BaseDataSubscriptionEnumeratorFactory.cs
	Engine/DataFeeds/Enumerators/Factories/OptionChainUniverseSubscriptionEnumeratorFactory.cs
	Engine/DataFeeds/SubscriptionDataReader.cs
	ToolBox/QuantConnect.ToolBox.csproj
2016-11-07 16:18:11 +01:00
quant1729 5803115548 Option splits and renames in backtesting. Added regression tests. 2016-10-26 21:20:03 +02: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
quant1729 f89ea2183f Added real-time support for futures. Tested with IQFeed, IB. 2016-09-28 19:10:03 +02:00
Stefano Raggi 9694e2c16f Simplified assignment in CollectionChanged in data feeds 2016-08-30 12:58:43 -03:00
AlexCatarino 35c8b75d1e Extends CollectionChanged events for UserDefinedUniverse
RemoveSecurity calls from OnData now trigger universe selection immediately
2016-08-30 12:56:56 -03:00
Stefano Raggi 5c0de9a205 Prevent non-equity data feeds from looking for a map file resolver
A directory not found error was logged when adding a Forex symbol
2016-08-25 18:42:28 +02:00
Stefano Raggi f6493c123f Added missing check in CollectionChanged event
This bug was introduced in the prevous commit, causing NullReferenceException in a couple of regression tests
2016-08-24 22:52:59 +02:00