Commit Graph

57 Commits

Author SHA1 Message Date
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
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
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 7d730f8db7 Improve timing of data available events for LiveSynchronizer 2019-04-29 15:26:50 +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
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
Martin Molinero 0933da9303 Refactor previous commits
- Removing `AccountCurrency` from `Cash` and `Brokerage` classes.
`ICurrencyConverter` will now provide the `AccountCurrency`
- Adding new static `OrderFee.Zero` which will return a 0 order fee in
`NullCurrency`
- Adding static `Currencies.USD` value, replacing all "USD".
- Addin new static `Currencies.NullCurrency`
- Updating Bitfinex `FeeModel` so it return fees in quote currency.
Adding unit tests
2018-12-13 11:30:40 -03:00
Martin Molinero 75ffa300f1 Adding new IAlgorithm.AccountCurrency
- Adding new `IAlgorithm.AccountCurrency { get; }` that will point to the
`Portfolio.CashBook.AccountCurrency`. Setter will be added in a
following PR.
- Base `Brokerage` class will now have a `AccountCurrency { get }`
pointing to the `IAccountCurrencyProvider`. Will be used by the different
brokerages implementations.
2018-12-10 11:59:02 -03: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 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
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
Stefano Raggi db942e0d2e Zero volume out in fill forward TradeBars 2018-09-25 22:29:53 +02:00
Martin Molinero 4f5f7330a9 Fix for Quandl custom data race condition 2018-08-10 18:30:17 -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 ad36e4e9a7 Add JSON deserialization test for FineFundamental 2018-05-07 21:43:11 +02:00
Stefano Raggi 1315a12f15 Update live custom data tests to match the new initial frontier
The frontier in LiveCustomDataSubscriptionEnumeratorFactory.CreateEnumerator is no longer initialized with DateTime.MinValue but is now set to request.StartTimeLocal, so these tests were updated to reflect this change.
2018-04-24 14:51:24 +02:00
Stefano Raggi 2c2e3360a4 Exclude EnqueableEnumeratorTests.MoveNextBlocks from Travis build 2018-03-06 21:46:02 +01:00
Stefano Raggi 5f7c481053 Exclude memory leak tests from Travis build
These tests occasionally fail when ran with Travis, so we only exclude them from Travis build.
2018-02-14 18:45:10 +01:00
Stefano Raggi 29f765555c Exclude memory leak test from Travis build 2018-02-09 22:47:36 +01: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
Stefano Raggi d8cf058144 Fix FineFundamentalSubscriptionEnumeratorFactory test 2018-01-12 21:06:43 +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 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 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
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
Stefano Raggi de037ad4ef Universe selection with FineFundamental filtering - backtesting and live 2016-12-06 15:44:41 +01: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
Stefano Raggi 7a0ef5515b Add tests for FineFundamentalSubscriptionEnumeratorFactory 2016-08-19 11:29:01 +02:00
Stefano Raggi 8c561bb402 Add test for FineFundamentalSubscriptionEnumeratorFactory 2016-07-05 08:13:56 +02:00
Michael Handschuh 85cde03280 Adds OptionChainUniverseDataCollectionAggregatorEnumerator
Phew, that was mouthful!
2016-04-07 14:12:44 -04:00
Michael Handschuh b584af5615 Adds SynchronizingEnumerator 2016-04-07 14:12:36 -04:00
snugs 457496c6eb FastForwardEnumerator - prevent emitting past data
When running a remote file in live mode with a high resolution (~second), it is possible
for us to download the file, fast forward to the end, and then emit duplicate data.

This change adds an extra filter in the FastForwardEnumerator to prevent it from emitting
data in the past, that is, data the is earlier than the previous piece of data emitted

-- forward only behavior --
2015-12-07 12:40:28 -05:00
snugs 252c91f873 Fix spelling of EnqueueableEnumerator 2015-12-07 11:58:46 -05:00
snugs ba27306316 Implement blocking feature in EnqueueableEnumerator 2015-12-07 11:58:45 -05:00
snugs 17c1374103 Adds Count and LastEnqueued properties to EnqueueableEnumerator 2015-12-07 11:58:45 -05:00