Commit Graph

28 Commits

Author SHA1 Message Date
Martin-Molinero 9cdb4a91c5 Refactor live data feed (#4636)
* Live Coarse universe refactor

- Live trading will source Coarse and Fine fundamental data directly
  from disk. Updating unit tests.

* Adds ILiveDataProvider interface

  * Adds wrapper for IDataQueueHandler implementations

  * Replaces IDataQueueHandler with ILiveDataProvider in
    LiveTradingDataFeed

  * Edits IDataQueueHandler documentation

* Maintains aggregation for current IDQH impls and skips for ILDF impls

  * Note: No unit test was created for this method, go back and TODO

* Protobuf Market data

- Adding protobuf support for Ticks, TradeBars and QuoteBars. Adding
  unit tests.

* Adds unit tests for LiveDataAggregator changes

  * Fixes bug where custom data was not handled as it was before
  * Fixes race condition bug because of variable reuse in class

* Add protobuf extension serialization

* Fixes for protobuf serialization

* Refactor

* Fix OptionChainUniverse

* replace BaseDataExchange pumping ticks with consolidators

* AlpacaBrokerage

* BitfinexBrokerage

* GDAXBrokerage

* OandaBrokerage

* InteractiveBrokers

* TradierBrokerage

* FxcmBrokerage

* PaperBrokerage

* etc

* WIP fixes for existing LTDF unit tests

* Fixes more LTDF unit tests

* make IDataAggregator.Update recieving Generic BaseData rather than Tick

* Change IDataQueueHandler.Subscribe method

* Some fixes after adding new commits

* Adds protobuf (de)serialization support for Dividend and Split

* Serialize protobuf with length prefix

* Fix missing LTDF unit tests

* Adds TiingoNews protobuf definitions

* fix comments

* more fixes on IQFeedDataQueueHandler

* disallow putting ticks into enumerator directly

* ScannableEnumerator tests

* fix OandaBrokerage

* AggregationManager unit tests

* fix AlpacaBrokerage tests

* fix InteractiveBrokers

* fix FxcmBrokerage tests

* call AggregationManager.Remove method on unsubscribe

* fix GDAX existing tests

* Fixes, refactor adding more tests for AggregatorManager

* Adds BenzingaNews protobuf definitions and round trip unit test

* Adds missing TiingoNews unit test to Protobuf round trip tests

* Improve sleep sequence of LiveSynchronizer

* need start aggregating first, and then can subscribe

* More test fixes and refactor

- Refactoring AggregationManager and ScannableEnumerator so the last is
  the one that owns the consolidator
- Adding pulse on the main LiveSynchronizer

* Improve performance of LEquityDataSynchronizingEnu

* Add missing Set job packet method

* Minor performance improvements

* Improvements add test timeout

- Improvements adding test timeout to find blocking test in travis

* Improve aggregationManager performance

* Testing improvements for travis

* Remove test timeouts

* More test fixes

- Adding more missing dispose calls and improving determinism

* fix IEXDataQueueHandler and tests

* Final tweaks to LTDF tests

* more AggregationManager tests

* consume and log ticks

* fix test: couldn't subscribe to Forex tickers

* change Resolution for all bar configs

* Improve RealTimeScheduleEventServiceAccuracy

* refactoring: move common code to base class

* fixed bug; unsubscribe SubscriptionDataConfig

* Small performance improvement

* Minor fixes

* Avoid Symbol serialization

* Fixes coarse selection in live mode

* Fix for live coarse

* Adds protobuf (de)serialization support for Robintrack

  * Adds round-trip unit test

* Minor performance improvements

* More minor performance improvements

* pass LiveNodePacket through to OandaBrokerage

* Fixes empty list becoming null value when deserializing with protobuf

* Reverts BZ live trading exception removal and fixes tests

* Refactor WorkQueue making it abstract

* Add try catch for composer

* Adds optional data batching period to LiveFillForwardEnumerator

* Override data-queue-handler with config

* Improve PeriodCountConsolidator.Scan performance

* Move batching delay to main Synchornizer thread

* Reverts addition of Robintrack protobuf definitions

* Give priority to config history provider if set

* Add Estimize protobuffing

- Add Estimize protobuffing support. Adding unit tests

* Always dispose of data queue handler

Co-authored-by: Gerardo Salazar <gsalaz9800@gmail.com>
Co-authored-by: Adalyat Nazirov <aenazirov@gmail.com>
2020-08-18 20:21:10 -03:00
Martin Molinero 886e5e6445 Test fixes and updates 2020-04-23 09:59:31 -03:00
Leonardo-Ferreira 951c973d5b Adjusted the OneTimeSetup attribute usage 2020-04-22 18:19:08 -03:00
Leonardo-Ferreira 37b1906022 Updated to OneTimeSetUp 2020-04-22 18:16:58 -03:00
Martin Molinero 68d9f48c2d Address reviews
- Adding new `CompositeAlphaModel.AddAlphaModel()`
- Adding C#/Py regression algorithms using the new `QCAlgorith.AddAlphaModel()`
- Improving exception message
- Add python version of `QCAlgorith.AddAlphaModel()`
2019-04-05 18:34:18 -03:00
Martin Molinero 9cabd32d19 Add AddAlphaModel method 2019-04-04 13:36:07 -03:00
Martin Molinero cfa08a11fb Address reviews
- Removing `using QCAlgorithmFramework = QuantConnect.Algorithm.QCAlgorithm`
- Removing `QCAlgorithmFrameworkBridge`
- Removing `IsFrameworkAlgorithm`
- Making `EmitInsightBasedOnFill` private. Adding new
`IOrderEventProvider` exposing an `event` to which `QCAlgorithm` will
subscribe.
- `AccountType.Cash` algorithms will be allowed to manually trade and
emight insights manually or with alpha model.
2019-04-03 21:55:44 -03:00
Martin Molinero 32ac3146b4 Merge Framework and Classic Algorithms
- Merging Framework and Bridge algorithms into classic QCAlgorithm
class.
- Removing Framework project, VS17 and VS15
2019-04-03 21:54:32 -03:00
Martin Molinero 7d7ad17883 Obsoleting Securities configurations properties
> This PR is a mechanical refactor, no behaviour changed

- Obsoleting `IsFillDataForward`, `Resolution`, `IsExtendedMarketHours`
`Security` configuration properties. Replacing there usages by
requesting the `SubscriptionDataConfigs` to the new
`SubscriptionDataConfigService`
2018-12-05 10:05:53 -03:00
Martin Molinero 7ab6a374cf Addressing reviews
- `TimeSliceFactory` `TimeZone` will now be a constructor parameter
2018-11-14 19:12:45 -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 eaba3ab24e Fix ManualUniverse duplicate effort
- Removed usages of algorithm.Securities.key as a parameter for the
`ManualUniverseSelectionModel()` since those securities, added through
`AddXXXX` calls will be managed by the `UserDefinedUniverse`. This was
causing for Universes to try to add the same subscription requests
- Adding new empty constructor for ManualUniverseSelectionModel,
required for Python
- ManualUniverse will return any existing SDC for the
symbol. This is for maintaining existing behavior and
preventing breaking changes: Specifically motivated by usages of
Algorithm.Securities.Keys as constructor parameter of the
ManualUniverseSelectionModel, since those Symbols added by Addxxx()
calls will already be managed by the UserDefinedUniverse
- Making some format modifications to aling with used Lean formatting
2018-10-12 18:30:04 -03:00
Stefano Raggi 5c9b81cef1 Fix Python initialization and imports for multiple tests 2018-10-02 20:28:13 +02:00
Martin Molinero 1997197f47 Fix failing unit tests 2018-09-18 12:10:42 -03:00
Martin Molinero 41873b2315 Fixing unit tests 2018-08-31 16:06:41 -03:00
Stefano Raggi fadda32e08 Enable ignored/excluded Python unit tests 2018-08-09 11:51:53 +02:00
Michael f59d9754dc Merge pull request #2343 from QuantConnect/feature-2339-stdev-execution-model-tests
Add unit tests for StandardDeviationExecutionModel
2018-08-07 17:07:42 -04:00
Stefano Raggi d2252412d1 Moved PythonHelper to PythonSetup as NUnit SetUpFixture
- also made a few minor changes in StandardDeviationExecutionModelTests
2018-08-07 17:36:38 +02:00
Michael Handschuh 4fd16f6daf Fix resolution of insight close times, allow user defined close times
Fixes a bug where we were using the security's data resolution to compute
the insight's close time. This led a case such as insight.Period == 20days
to step 20days worth of tradable minutes (assuming minute data resolution),
yielding a close time that was very far in the future.

We also add different means of specifying an insight's period/close time:
1. Specify insight period as a TimeSpan and we compute close time
2. Specify insight period and a resolution and bar count and we compute close time
3. Specify insight close time local directly and we compute the insight period

The key here is maintaining consistency between the three different approaches
which is heavily validated with the corresponding unit tests.

Edits also made to trust the insight's close time as the analysis end time in
the case where the analysis period == insight period (extra analysis period = 0).
Given the current setup (extra analysis period == 0), this guarantees that close
and analysis end times are equivalent.

Regression statistics were updated and expectedly we get many more insights that
have completed analysis, and as such, average scores have also changed.
2018-08-07 11:21:11 -04:00
Stefano Raggi 265e18a3c4 Fix PYTHONPATH for all existing framework model unit tests 2018-08-04 00:24:28 +02:00
Michael Handschuh ad331118ab Add refresh to IUniverseSelectionModel to support dynamic universes
This change allows the universe selection model to select different universe
definitions as time proceeds. This enables the definition of a universe model
that, for example, could add option chains for securities selected by a different
universe model.

The BasicTemplateOptionsFrameworkAlgorithm was added to showcase and provide
regression for a universe model that selects different universes.
2018-05-31 11:48:23 -04:00
AlexCatarino e914bcf782 Make CommonAlphaModelTests.GetExpectedModelName abstract 2018-05-15 22:38:01 +01:00
Michael Handschuh a5179bc6ab Add universe data to TimeSlice
Pipes universe data from the data feed, through TimeSlice.Create and adds
TimeSlice.UniverseData dictionary property for read access from the algo
manager, where the data will be placed onto the correct security object.
2018-04-24 18:23:00 -04:00
Michael Handschuh 38d749caa4 Add PairsTradingAlphaModel w/ regression test
The PairsTradingAlphaModel is a simple example of defining an insight
grouping. Insights that are grouped together are assigned a unique
group-id that can be used by the portfolio construction model.

Updates were made to the CommonAlphaModelTests to give more control to
derived types. Some changes are still needed here to give securities
unique prices. I would recommend using a psuedo-random walk approach
by using Random with a constant seed value.
2018-04-19 16:30:20 -04:00
Michael Handschuh 90d54da87c Add INamedModel and implement in existing alpha models
Alpha models can choose to implement the Name property, if not, the system
will use the model's type name as the Insight.SourceModel.
Existing tests were updated to also assert expected model names
2018-04-17 16:50:16 -04:00
AlexCatarino 58493a2f21 Updates python version Lean AlphaModels to reflect API changes
Refactors unit tests.
2018-04-11 11:16:04 +01:00
AlexCatarino 191d92b7ea Adds python version of RsiAlphaModel 2018-04-11 11:07:51 +01:00
AlexCatarino 2bfa5dfc28 Implements a framework to perform unit tests of alpha models 2018-04-11 11:07:51 +01:00