Commit Graph

779 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 f89031d8ed Merge pull request #3366 from Martin-Molinero/bug-3363-zipdatacacheprovider-dispose-race-condition
Fix dispose race condition at ZipDataCacheProvider
2019-07-07 13:13:00 -07:00
Martin Molinero 82da3b5521 Fix dispose race condition at ZipDataCacheProvider 2019-07-04 13:30:42 -03:00
Stefano Raggi a0c433ff02 Address review
- retry only on WebException
- throw after last failed attempt
2019-07-04 01:09:58 +02:00
Stefano Raggi 43a16c3580 Add retry logic to LiveOptionChainProvider.GetOptionContractList 2019-07-03 18:31:42 +02:00
Martin Molinero e8660d9f52 Address reviews 2019-06-17 23:40:56 -03:00
Martin Molinero 760e32cf65 Add unit test for Coarse Scheduled Selection
- New unit test fails in master
- Adjust lower invalid time limit to 5 AM
2019-06-17 23:40:56 -03:00
Martin Molinero 65201cb808 Adding StepTimeProvider for live
- Adding new `StepTimeProvider` that will advance time based on a
desired custom evaluator.
- Live trading `Options`, `Futures` and `Coarse` data will use a
`FrontierAwareEnumerator` + `StepTimeProvider`. This will allow to hold
the selection data until its the desired time
- `Universe.CanRemoveMember` will round the members time in the universe
based on the `UniverseSettings.MinimumTimeInUniverse`
2019-06-17 23:40:55 -03:00
Jared ff19bd266c Merge pull request #3312 from QuantConnect/bug-datamanager-remove-utcnow-usage
Remove usage of DateTime.UtcNow in DataManager
2019-06-17 09:15:23 -07:00
Jared 5b03d3a917 Merge pull request #3309 from QuantConnect/testing-live-synchronizer-add-timeout-property
Add a virtual property get in LiveSynchronizer
2019-06-17 09:13:42 -07:00
Stefano Raggi 5143645fe6 Fix LiveTradingDataFeed handling of Auxiliary data at Tick resolution 2019-06-14 23:18:17 +02:00
Stefano Raggi e87eda1d78 Remove usage of DateTime.UtcNow in DataManager
This change is needed for live trading unit tests which use date ranges in the past.
2019-06-14 18:54:52 +02:00
Stefano Raggi 6e387d451c Add a virtual property get in LiveSynchronizer
This enables overriding the 500ms value in unit tests for faster run times.
2019-06-14 18:35:45 +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
Jared 10de77e600 Merge pull request #3307 from QuantConnect/bug-3286-live-data-delay-v2
Fix live data delay
2019-06-13 16:13:08 -07: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 1581801f9b Address reviews 2019-06-11 12:01:57 -03:00
Martin Molinero ec1d410907 Performance improvements
- `SecurityIdentifier` will calculate `StrikePrice` just once. Replacing
`!=` for a direct call to `Equals()` preventing unnecessary checks.
- Slightly improving Linq queries at `OptionFilterUniverse`
- Replace `OpenReader().CopyTo` for `Extract(stream)` avoids copying the
data twice.
- Replace `DateTime.Now` for `DateTime.UtcNow`
2019-06-10 22:40:19 -03:00
Martin Molinero 90a8f23d98 Address reviews 2019-06-07 16:02:53 -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 14c779733b Address reviews 2019-06-04 17:16:52 -03:00
Martin Molinero ee4f8fee82 Overall performance improvements
- `TimeSliceFactory` will avoid creating empty collections
- `ExecutionModels` will check target collection count before trying to
enumerate
- Reduce calls to .`TotalPortfolioValue`
- `SecurityValues` will only be created when required
- `TimeKeeper` will use TimeZone unique Id as dictionary key. The
TimeZone hash is expensive.
- `AlgorithmManager` will avoid calling `DateTime.UtcNow`,
`ConvertFromUtc()` and `RoundDownInTimeZone()`
2019-06-03 15:09:02 -03:00
Martin Molinero d360ec36ac Address reviews 2019-05-31 18:26:18 -03:00
Martin Molinero 57fbf588fe Download RemoteFile once for backtests
- For backtests download RemoteFile just once
- Live subscriptions and history requests will continue to download the
`RemoteFile` on each request.
- Adding unit tests
2019-05-29 18:38:07 -03:00
Jared 8a95a35d95 Merge pull request #3191 from StefanoRaggi/bug-3190-live-suspicious-tick-filtering
Add Suspicious Tick Filtering in LiveTradingDataFeed
2019-05-29 07:10:07 -07:00
Stefano Raggi ce45493d38 Filter suspicious ticks for tick consolidators in TimeSliceFactory.Create
With subscriptions at non-Tick resolution, suspicious ticks are filtered at the live data feed level for bar aggregations, while at Tick resolution they are never filtered (intentionally).
This change prevents ticks from being added to the consolidator update data, used by the AlgorithmManager to update tick consolidators (and indicators).
2019-05-28 18:29:35 +02:00
Stefano Raggi 1119d79f0e Add Suspicious Tick Filtering in LiveTradingDataFeed 2019-05-28 18:29:35 +02:00
Martin Molinero bb6671b811 Fix tests after RemoteFileSubscriptionStreamReader changes 2019-05-28 13:24:52 -03:00
Jared Broad 9062357b30 Remote file provider powered by download provider 2019-05-24 17:01:52 -07: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
Stefano Raggi 6eb7d2e71e Remove unnecessary switch on tick type 2019-05-03 23:28:39 +02:00
Stefano Raggi 410bdb51f5 Fix LiveTradingDataFeed.CreateDataSubscription with multiple tick types 2019-05-03 23:26:23 +02: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
Martin-Molinero 2a69b3279a Add IDataCacheProvider.IsDataEphemeral (#3160)
* Add IDataCacheProvider.IsDataEphemeral
2019-05-01 19:33:35 -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
Alexandre Catarino 3f00762bfd Adds Custom Data from US Energy Information Administration (eia.gov) (#3136)
New custom data class USEnergyInformation with new demonstration algorithms, the updated config file for users to set their EIA token.

Adds `CloseTime` to represent the time that the data period end. `EndTime` represents, in turn, the time the data is emitted. There is an offset between `CloseTime` and `EndTime` that is defined by the difference between the last bar as emitted and its time. 

In live mode, if the `USEnergyInformation.Reader` returns null, the `CollectionSubscriptionDataSourceReader.Read` method will pull for new data constantly. Therefore it should return an empty `BaseDataCollection` object.
2019-04-30 17:22:11 -07:00
Stefano Raggi 73b09d9d64 Fix merge conflicts 2019-04-29 15:34:36 +02:00
Stefano Raggi 68ce55de0e Update log message in LiveSynchronizer 2019-04-29 15:26:50 +02: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 e22e10a443 Remove Sleep(1) and replace ManualResetEvent with AutoResetEvent 2019-04-29 15:26:50 +02:00
Stefano Raggi 513ef5d581 Fix DataManager live mode flag and failing unit tests 2019-04-29 15:26:50 +02:00
Stefano Raggi b3ff72ade2 Fire DataManager events only in live mode 2019-04-29 15:26:49 +02:00
Stefano Raggi af97980a16 Fix live mode flag bug in DataManager
The live mode flag was set in the DataManager constructor, before the algorithm is initialized, causing _liveMode to always be set to false.
2019-04-29 15:26:49 +02:00
Stefano Raggi 9d930c170e Add new LiveSynchronizer + update live unit tests 2019-04-29 15:16:22 +02:00