Commit Graph

58 Commits

Author SHA1 Message Date
AlexCatarino 433feff1df Implements python version of FundamentalUniverseSelectionModel
- This version serves two purposes: example of universe selection model and base class for other universe selection models, since the pythonnet doesn't deal well with inheritance of abstract classes.

- Adds PyObject overload to `CoarseFundamentalUniverse`.
2018-05-08 18:54:17 +01:00
AlexCatarino b476e22e41 Implements EmaCrossUniverseSelectionModel
Adds EmaCrossUniverseSelectionModel and EmaCrossUniverseSelectionFrameworkAlgorithm to show the new model in action
2018-05-08 18:54:17 +01:00
AlexCatarino 182e8b46ad Implements MaximumSectorExposureRiskManagementModel
Provides an implementation of `IRiskManagementModel` that limits the sector exposure to the specified percentage
2018-05-03 21:50:11 +01:00
AlexCatarino 7f2902eee2 Implements python version of EqualWeightingPortfolioConstructionModel 2018-05-03 21:50:11 +01:00
AlexCatarino 11489b3edf Modifies BasicTemplateFrameworkAlgorithm
- Use `MaximumDrawdownPercentPerSecurity` as `RiskManagementModel`.
- Modifies regression test to reflect risk model choice
- Use SetXXX to set models in python version
2018-04-27 23:08:53 +01:00
Michael 5865535619 Merge pull request #1913 from jingwu74/master
Add Black-Litterman portfolio construction model
2018-04-25 16:04:09 -04:00
Jing Wu 63b05c9ec8 fix typo 2018-04-25 11:35:10 -04:00
Jing Wu 8b80e68283 add PreserveNewest property to project file 2018-04-25 11:06:26 -04:00
Jing Wu 7403853ff6 revert change in project file 2018-04-25 09:41:52 -04:00
Jing Wu 4d649447e7 add black litterman portfolio construction model 2018-04-25 09:34:48 -04:00
AlexCatarino 9c4b85b693 Adds python version of PairsTradingAlphaModel 2018-04-25 13:45:13 +01:00
Michael 1b7dec7a40 Merge pull request #1891 from QuantConnect/feature-1863-grouped-insights
Add Insight.GroupId to support grouping of insights
2018-04-20 09:31:55 -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
AlexCatarino c820ad4c36 Adds python version of C# execution models
- Typoes were fixed in `ImmediateExecutionModel.cs`;
- Refactors `PriceIsFavorable` methods in `StandardDeviationExecutionModel` and `VolumeWeightedAveragePriceExecutionModel` C# models;
- Adds python version of C# execution models
2018-04-19 11:52:10 +01:00
Michael Handschuh f47c700746 Add CompositeAlphaModel
The composite model combines multiple alpha models into a singular model and
properly sets each insight's SourceModel property to the name of the model that
generated the insight
2018-04-17 16:50:24 -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
Jared 258cb60d93 Merge pull request #1805 from AlexCatarino/feature-1798-python-alpha-models
Adds python versions of available Alpha Models
2018-04-11 14:22:53 -04:00
AlexCatarino 191d92b7ea Adds python version of RsiAlphaModel 2018-04-11 11:07:51 +01:00
AlexCatarino 5a23a18fb8 Adds python version of EmaCrossAlphaModel 2018-04-11 11:07:51 +01:00
AlexCatarino 35cb62d65a Adds python version of MacdAlphaModel 2018-04-11 11:07:51 +01:00
AlexCatarino 8325b77c07 Adds python version of ConstantAlphaModel 2018-04-11 11:07:51 +01:00
Michael Handschuh 3db242203e Add ScheduledUniverseSelectionModel
The ScheduledUniverseSelectionModel wraps the new ScheduledUniverse.
ScheduledUniverse is similar to the UserDefinedUniverse we use to create
universes for dopbox/remote files w/ symbol listing. The new abstraction
that 'turns on' this no-data/scheduled based universe behavior is the
ITimeTriggeredUniverse, which exposes GetTriggerTimes which yields the
date/times your univese selection function will be called.

A regression algorithm was also added to cover the new feature.
2018-04-10 19:24:36 -04:00
AlexCatarino a4db921b87 Updates pythonnet
Rebase with pythonnet/master
2018-04-09 18:59:59 +01:00
Jared f32f351a4d Merge pull request #1832 from AlexCatarino/feature-1798-adds-meanvariancemodel
Implements MeanVarianceOptimizationAlgorithm
2018-04-08 20:27:17 -04: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
AlexCatarino 92238a02fc Implements MeanVarianceOptimizationAlgorithm
This framework algorithm alpha model is  HistoricalReturnsAlphaModel and the  portfolio construction model is MeanVarianceOptimizationPortfolioConstructionModel.
This examples implements an algorithm that rebalances the portfolio according to modern portfolio theory.
2018-04-06 00:28:05 +01:00
Jing Wu be0f553381 revert changes in project file 2018-04-06 00:28:04 +01:00
Jing Wu cd32f955de add mean variance optimization portfolio construction model 2018-04-06 00:28:04 +01:00
Michael Handschuh b1ac56d63c Fix capitalization of QC acronyms 2018-03-29 15:30:05 -04:00
Michael Handschuh d87c121d4b Rename IPortfolioSelectionModel -> IUniverseSelectionModel 2018-03-29 12:18:44 -04:00
Michael Handschuh f5656f6113 Add EmaCrossAlphaModel
Simple alpha model that uses a fast/slow ema cross to generate
a prediction.
2018-03-26 17:33:14 -04:00
Michael Handschuh c5704a1cd4 Rename SimplePortfolioConstructionModel -> EqualWeightingPortoflioConstructionModel
The simple name was too simple and too vague. Equal weighting nicely
describes the purpose and intent of this model
2018-03-26 17:33:13 -04:00
Michael Handschuh 64b9766685 Add RsiAlphaModel 2018-03-26 16:42:24 -04:00
Michael Handschuh a7128ad0db Add QC500PortfolioSelectionModel 2018-03-23 15:10:39 -04:00
AlexCatarino 35d29060d0 Implements python support for custom models in framework
Adds method overload that accept a `PyObject` to `SetAlpha`, `SetExecution`, `SetPortfolioConstruction`, `SetPortfolioSelection` and `SetRiskManagement`. In these methods, a custom model written in python will be wrapped around the respective `PythonWrapper`.
2018-03-13 11:35:31 +00: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
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
AlexCatarino 34a271adac Updates pythonnet
In this update, we had compiled pythonnet with python 3.6 instead of 2.7 flags
2018-02-13 13:00:50 +00:00
Michael Handschuh 1dd84c65df Add NullExecutionModel and NullPortfolioConstructionModel
When focusing on generating alpha signals we don't need t both with execution or
portfolio construction models. Instead we can judge how well we do based on our
generated alphas. By not submitting orders, backtests and live performance is
greatly improved.
2018-01-02 14:53:40 -05:00
AlexCatarino 9459f47cba Updates pythonnet
In this update, methods overloads with decimal parameters accept python float.

- Fixes FractionalQuantityRegressionAlgorithm:
With the pythonnet update we can pass a python float where a decimal is required.
2017-12-29 17:25:48 +00:00
Michael Handschuh b4b3aae112 Rename Signal -> Alpha
Whoa... I think I got everything :)
2017-12-15 18:24:58 -05:00
Michael Handschuh 7a8620c66e Fix Algorithm.Framework packages.config target framework versions 2017-12-14 19:43:26 -05:00
Michael Handschuh f3596c310a Adds coarse/fine convenience portfolio selection methods/classes 2017-12-14 15:44:51 -05:00
Michael Handschuh 36311be93f Remove ISignal, add Signal.GeneratedTimeUtc
This abstraction point is completely unwarranted. The signal object is really
just a DTO and it's extensible as it is currently defined. This also allows us
to enforce certain behaviors, such as internal set of GeneratedTimeUtc.

Removes GeneratedTimeUtc from the result object as it's now directly on the signal.
2017-12-12 11:57:03 -05:00
Michael Handschuh c264132447 Move json serialization attributes to inteface
It's not unreasonable to think users will provide their own ISignal implementation
and we'll want them all behaving by the same serialization rules to make consumption
much easier.
2017-12-08 10:07:54 -05:00
Michael Handschuh 2feae2cf0d Ignore default values when serializing signals
The presence of extra nulls does little other than bloat the size of the data.
This will trim a little fat and keep the files smaller
2017-12-08 10:07:54 -05:00
Michael Handschuh 24cebd2aa1 Move signal/target data structures to common
Since these are really just data structures they belon in the common library. Also,
it stands to reason that we'll want to reuse them in other components, such as the
result handler.
2017-12-08 10:07:54 -05:00
Michael Handschuh 2f319fdbdf Add MACDSignalModel and CustomFrameworkModelsAlgorithm 2017-12-08 10:07:54 -05:00
Michael Handschuh 087c7a748d Rename INotifiedSecuritiesChanged -> INotifiedSecurityChanges
Also synchronizes the helper class's name
2017-12-08 10:07:54 -05:00
Michael Handschuh 8093a818c7 Rename Direction -> SignalDirection
This follows the naming convention of the other direction enums
2017-12-08 10:07:54 -05:00