Commit Graph

1000 Commits

Author SHA1 Message Date
Stefano Raggi 0a27af259d Add QCAlgorithm.GetParameters helper method 2018-06-07 15:06:50 +02:00
Stefano Raggi 8fe7651881 Add QCAlgorithm.ActiveSecurities 2018-06-06 21:45:48 +02:00
Stefano Raggi bbfe7a9beb Rename LatestSlice to CurrentSlice 2018-06-05 19:05:40 +02:00
Stefano Raggi 08f28a55cf Make the latest Slice received in OnData available to the algorithm 2018-06-01 18:24:09 +02:00
Michael Handschuh 42032ec328 Refactor setting of insight close/generated times
These times were being set AFTER they were copied, so the insights sent into
the portfolio construction model were the originals (uncopied) and then copies
that are sent into the event are then piped to the insight manager/alpha handler
for scoring, so interestingly, the scoring remained the same so regression tests
continued to pass because no types were written with a dependency on that data
other than the scoring, which as mentioned, got the copies with the correct times.
A recent change made use of this time and showcases this heinous bug in all its
glory.

This refactoring overrides the event invocator and seals the method to force
derived types to use the event handler, thereby guaranteeing that the event is
always invoked AFTER the generated/close times are properly set, also ensuring
that the copy is performed after the times are set as well.
2018-05-31 14:25:16 -04:00
Michael Handschuh 577c082b69 Confirm securities aren't in other universes before removal
Since we're moving towards better support of multiple universes,
it's important that we check that child subscriptions aren't in
those other universes before removing the security.
2018-05-30 15:55:34 -04: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
AlexCatarino 833c9f27f2 Adds overloads to QCAlgorithm logging methods 2018-05-24 12:13:42 +01:00
AlexCatarino 19d403fd46 Assures that Coarse and Fine Fundamental are passed as List to AddUniverse 2018-05-23 15:13:07 +01:00
Michael d878857e50 Merge pull request #1938 from StefanoRaggi/feature-1093-ib-time-in-force-day
Add TimeInForce.Day support in backtesting and IB brokerage
2018-05-03 14:33:40 -04:00
Michael Handschuh 0df11e91dc Add obsolete warning message for RSI short hand
The default moving average type for RSI should be wilder's avg.
We'll change the default value in about a month or so.
2018-04-30 16:22:45 -04:00
Stefano Raggi 637c153701 Add base OrderProperties class 2018-04-30 15:39:30 +02:00
Juan José D'Ambrosio bda5b11cc2 Nuspec files added for all projects.
Launcher project is packed as `QuantConnect.Lean`but as a mean ot having all Lean features just calling one package. 

In the same sense, `QuantConnect.Algorithm.CSharp` is included as package and added as dependecy in the `QuantConnect.Lean` package just to have a working example aailable out-of-the-box.
2018-04-13 07:28:34 -03:00
Michael Handschuh dd764ad8e9 Rename InsightCollection->GeneratedInsightsCollection
This type is just used as a container for generatd insights. Renaming in
preparation for a new InsightCollection to mirror the PortfolioTargetCollection
2018-04-10 19:24:36 -04:00
AlexCatarino a4db921b87 Updates pythonnet
Rebase with pythonnet/master
2018-04-09 18:59:59 +01:00
Michael Handschuh 92c5e64024 Adds VWAP and STD execution models
VWAP will submit market orders while the current price is more favorable than VWAP.
STD will submit market orders while the current price is a configured number of
standard deviations away from the mean in the favorable direction.
2018-04-06 16:30:26 -04:00
Michael Handschuh 81f8fbfb85 Add IntradayVwap indicator w/ VWAP(symbol) helper
This is the traditional VWAP indicator that resets each day at market open.
2018-04-06 16:27:14 -04:00
Juan José D'Ambrosio e475385146 remove obsolte property, make EMA default
Update HistoryAndWarmupRegressionAlgorithm
2018-04-03 17:35:10 -03:00
AlexCatarino e9cef63e12 Refactors GetSymbolsFromPyObject method
GetSymbolsFromPyObject now returns IEnumerable<Symbol> and throws if its argument is not Symbol or Symbol[] object and if the Symbol has not been added to the Securities object.
2018-03-23 19:19:52 +00:00
Jared be1d0e8ab4 Merge pull request #1730 from AlexCatarino/feature-1729-wildermovingaverage
Implements WilderMovingAverage indicator
2018-03-22 09:49:02 -04:00
AlexCatarino 03876a0b30 Adds method helper WWMA
WWMA method helper creates a `WilderMovingAverage` indicator that will be automatically updated on the given resolution.
2018-03-21 09:49:19 +00:00
Stefano Raggi 0525b99f11 Fix multiple symbol addition in AddToUserDefinedUniverse
Fixes #1733
2018-03-21 10:34:08 +01:00
Michael Handschuh 27b34a4274 Add IAlgorithm.OnEndOfTimeStep to batch universe changes
We had an issue with the data feed picking up universe/security changes
too quickly, thereby preventing user code from being able to configure the
security object properly. Specifically, users were having an issue setting
the data normalization mode of options and underlying equity securities. By
the time the user code had set the data mode, the data feed had already
created a subscription and began processing it, so the changes were never
seen in the data feed.

This change moves all security/universe changes into pending lists and at
the end of the time step applies those changes. Security objects are still
added directly to the SecurityManager for instance access, but we delay in
adding the security to the universe and the universe to the UniverseManager.
Once added to the universe manager, an event is fired and the data feed will
process the new subscriptions.
2018-03-20 10:10:29 -04:00
AlexCatarino f588e190f2 Fix data consolidation with python custom data
When creating a CRL type in runtime to represent a python custom data class, we need define `DynamicData` as its parent class so that it passes the `IsAssignableFrom` condition in `SubscriptionManager.AddConsolidator`
2018-03-14 17:55:22 +00:00
Michael 3fb429e5f4 Merge pull request #1685 from QuantConnect/feature-update-alpha-framework-for-consistency-with-api
Finalizes implementation of alpha framework, including alpha.spanner updates, many name changes, and harmonizes insight serialization with alpha streams API
2018-03-12 16:39:33 -04:00
Michael 5050a50f3b Merge pull request #1641 from AlexCatarino/bug-1636-register-composite-indicator
Fixes RegisterIndicator for python algorithms
2018-03-12 13:17:01 -04:00
Stefano Raggi 58a65bee97 Fix Forex data not received when reusing an existing internal feed
Fixes #1611
2018-03-09 23:28:23 +01:00
Michael Handschuh 6b239674e2 Renames Alpha -> Insight
The term 'alpha' is used to describe the entire algorithm. Therefore, 'alpha'
produces insights. From this we have things like IAlphaModel, which is the model
defining how insights are produced. We have IAlphaHandler, which defines how the
insights from a single 'alpha' (the algorithm) are managed, analyzed, and stored.
Types closer to the individual prediction level, such as InsightDirection, or
InsightScore relate directly to exactly 1 insight. The distinction between the
two became more clear as we developed the insights API, and from that effort it
was decided to harmonize alpha/insight terminology across the various QC systems.
2018-03-09 16:12:56 -05:00
AlexCatarino 5e2f24b90f Uses PyObject.TryConvert to determine which indicator type will be registered
Minor fixes in RegisterIndicator tests.
2018-03-08 10:54:19 +00:00
AlexCatarino 28c5fe3f16 Fixes RegisterIndicator for python algorithms
The check for Lean indicators was testing for `Indicator`, `BarIndicator` and `TradeBarIndicator` types where it should check for `IndicatorBase<T>` which includes `WindowIndicator<T>`.
2018-03-08 10:51:29 +00:00
Stefano Raggi 3fecc1b585 Remove ContainsKey checks before TryAdd in QCAlgorithm.Plotting
ConcurrentDictionary.TryAdd will return false and do nothing if the key already exists.
2018-03-07 16:45:11 +01:00
Stefano Raggi 7460d4f9c7 Fix concurrency issue in QCAlgorithm charts
Fixes #1640
2018-03-07 15:09:48 +01:00
Michael Handschuh 5ba44ed5ab Remove universe symbols from history requests
The engine defines securities for each universe to properly track them within
the data feed. These securities are not tradable and have no price data associated
with them, and as such, we should not be sending history requests for these symbols.
This change removes all universe symbols from history requests.
NOTE: Requests made directly to the history provider are not filtered out, as the
filtering happens within the QCAlgorithm implementation.
2018-03-05 14:18:33 -05:00
AlexCatarino 0f57c2fd43 Fixes Custom Data for Python
In order to access the custom data classes, the module containing them was added to the ObjectActivator. This was unnecessary if it wasn't a custom data algorithm.
Also, this operation would not be taken into account if the custom data class were defined after the algorithm was created: this is the case for QuantBook.
We refactor how custom data is handled: a new class was added to provide a instance creation factory that creates an instance of each python custom type.
2018-03-01 19:28:30 +00:00
Michael dfdce9901d Merge pull request #1622 from AlexCatarino/bug-1620-python-plot-std
Fixes Plot(string, Indicator) overload in python algorithms.
2018-03-01 11:52:46 -05:00
AlexCatarino e3cda2afe8 Improves Plot(string,PyObject) logic and test
In this new approach, we test whether the argument is a Indicator before we try to plot it. If fail, throws a ArgumentException error.
2018-02-28 18:46:00 +00:00
Stefano Raggi 86df0a20ff Add IsError flag to GetMaximumOrderQuantityForTargetValueResult
When buying power models return a zero quantity for an order, a flag can be set to indicate if it's an error condition, so CalculateOrderQuantity will show the error to the user.
2018-02-28 01:39:49 +01:00
AlexCatarino bd18dfc2f8 Adds test for new Plot overload
This text is ignore since Travis does have pythonnet installed.
2018-02-27 22:11:07 +00:00
AlexCatarino 0ea19b0558 Adds overload to Plot method to handle indicator special cases
For cases where implicit conversion to decimal from indicator was not properly handled by pythonnet, we expliticly get `Current.Value` and redirect to `Plot(string,decimal)` overload.
2018-02-27 12:36:37 +00:00
Stefano Raggi 4d735756b2 Add error messages in CalculateOrderQuantity 2018-02-27 13:05:26 +01:00
Stefano Raggi 92b7b3ecc0 Normalize decimal value in SetHoldings message 2018-02-27 11:24:16 +01:00
Stefano Raggi 4318c17974 Update buying power model interface for better messaging
The HasSufficientBuyingPowerForOrder method has been updated to return a result object including the reason the order cannot be executed.

The SetHoldings method has also been updated to display a message if CalculateOrderQuantity returns zero.
2018-02-27 11:24:15 +01:00
Michael Handschuh 18a559943e Upgrade LEAN Python to 3.6 from 2.7
- Adds log to display the python version the algorithm is using.
- Fixes python algorithms that were failing because of small subtleties
like leading zeroes.
- Updates pythonnet with a version compiled with python 3.6 flags

- Changes in DockerfileFoundation: we now use miniconda to manage the python
environment.
- Took the opportunity to add NTLK (#1349), Tensorforce (#1369) and
PyTorch/Pyro (#1385).
- Changes readme in Algorithm.Python to show steps to install miniconda
2018-02-23 15:09:06 -05:00
Michael Handschuh facbf6c9e8 Remove daily universe tick
This setting forced the data feed and algorithm threads to synchronize every day
at midnight. The changes to the regression values are due to losing the benchmark
sample at midnight
2018-02-20 12:23:12 -05:00
Stefano Raggi 1943dcd99d Revert "Add duplicate security check in AddSecurity" 2018-02-20 15:07:03 +01:00
Stefano Raggi 79d33a5ea2 Add unit test for duplicate security check
Also updated error message to show user input parameters.
2018-02-17 01:29:31 +01:00
Stefano Raggi 74b4684dd3 Add duplicate security check in AddSecurity
AddSecurity was not checking if the security had already been added.
2018-02-15 20:06:54 +01:00
Jared 5eabec08b5 Merge pull request #1578 from AlexCatarino/fix-download
Adds user agent header to WebClient in Download method
2018-02-14 17:25:22 -05:00
AlexCatarino 83fda60cb8 Adds user agent header to WebClient in Download method
Add a user agent header in case the requested URI contains a query.
2018-02-14 21:58:19 +00:00
Stefano Raggi a39e6a8e28 Revert "Merge pull request #1526 from AlexCatarino/python3"
This reverts commit 2e523992d0, reversing
changes made to fa48fc23ea.
2018-02-14 16:03:12 +01:00