Commit Graph

139 Commits

Author SHA1 Message Date
Martin Molinero c73b7bb62f Adding smarter methods for PortfolioTargetCollection 2018-07-27 10:48:55 -03:00
AlexCatarino b402c3673e Fixes MVOPC: it was not testing whether all magnitures are zero
- Changes `ExpectedStatistics` in MVOFA
  - All regression tests now
- Removes unnecessary constructor arguments in `ReturnsSymbolData`
- Tide up code and add method summaries.
2018-07-24 16:53:11 +01:00
Art Wild d5996fb7c8 MV & BL portfolio optimization implementation
Closes #1998. Closes #2219.
2018-07-24 16:53:11 +01:00
AlexCatarino b0d1606118 Refactors portfolio construction models with portfolio optimization
- Creates `MinimumVariancePortfolioOptimizer` and `MaximumSharpeRatioPortfolioOptimizer` portfolio optimizer. They implement `Optimize` method that returns a array of float representing the portfolio weights.
- Refactors `BlackLittermanOptimizationPortfolioConstructionModel` and `MeanVarianceOptimizationPortfolioConstructionModel` to use the portfolio optimizers. Part of the logic in BLOPC was changed to match the MVOPC one.
- Adds `BlackLittermanPortfolioOptimizationFrameworkAlgorithm` similar to `MeanVarianceOptimizationFrameworkAlgorithm` that uses BLOPC.
2018-07-20 23:09:48 +01:00
AlexCatarino ada48acfde Implements IPortfolioOptimizer interface
Provides an interface to portfolio optimization algorithms that can be used in portfolio construction models.
2018-07-20 22:28:42 +01:00
AlexCatarino 8e3b7153b2 Rebase with pythonnet/master and fix datetime UTC bug
Updates pythonnet with pythonnet/master and fix datetime issue ([65ac279](https://github.com/QuantConnect/pythonnet/commit/65ac279a03dbded39fe3e28bb79c233f0c970f6f)).
2018-07-16 11:52:54 +01:00
AlexCatarino c59ff47ed7 Refactors PearsonCorrelationPairsTradingAlphaModelFrameworkAlgorithm
- Moves `PearsonCorrelationPairsTradingAlphaModel` class to its own file in order to make it available as a framework model.
- Follows existing pattern design that alpha models receive a lookback and a `Resolution` object.
- Algorithm implements `IRegressionAlgorithmDefinition`.
2018-07-11 23:40:30 +01:00
AlexCatarino 6dbe83d0be Renames PairsTradingAlphaModel
- Since it will be used as a base class for other pairs trading models, it was ranamed as BasePairsTradingAlphaModel

- Use a tuple of symbols are key of BasePairsTradingAlphaModel._pairs dictionary.
2018-07-11 23:40:29 +01:00
AlexCatarino 049fba334e Implements python version of OptionUniverseSelectionModel
Since `OptionUniverseSelectionModel` derives from `UniverseSelectionModel`, a python version of this class was also implemented.
2018-07-05 20:59:08 +01:00
Stefano Raggi aa989ceab7 Set the XML documentation setting in Algorithm.Framework project 2018-06-21 20:48:25 +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 31c32be7d4 Add python version of NullAlphaModel 2018-05-29 22:42:16 +01:00
Michael Handschuh e95157b097 Add QCAlgorithmFrameworkBridge for easier porting of QCAlgorithm
Provides demonstration algorithm showing the steps required to convert a
QCAlgorithm into the framework with minimal code changes.

1. Subclass QCAlgorithmFrameworkBridge
2. Add EmitInsights calls to where orders are placed
3. Profit :)
2018-05-29 22:42:16 +01:00
Michael Handschuh af80420afa Add NullAlphaModel 2018-05-29 22:41:06 +01:00
AlexCatarino 97d6420e2a Python risk management models subclass C# RiskManagementModel
- Adds python version of `NullRiskManagementModel`
2018-05-15 20:52:13 +01:00
AlexCatarino 4ad1b5bd8a Python execution models subclass C# ExecutionModel
- Adds python version of `NullExecutionModel`
2018-05-15 20:48:13 +01:00
AlexCatarino efb75a9e30 Implements python version of NullPortfolioConstructionModel 2018-05-15 12:13:41 +01:00
Michael 8534df4e20 Merge pull request #1979 from AlexCatarino/feature-1961-python-qc500
Implements python version of QC500UniverseSelectionModel
2018-05-11 14:47:09 -04:00
Michael Handschuh 2bb99a595b Add base class for risk management models
Update existing models to derive from new base class
2018-05-11 01:55:16 -04:00
Michael Handschuh fc9380bcd8 Add base class for execution models
Update existing models to derive from new base class
2018-05-11 01:50:45 -04:00
Michael Handschuh 2c0f9a580a Add base class for portoflio construction models
Update existing models to derive from new base class
2018-05-11 01:50:45 -04:00
Michael Handschuh df41ec2a80 Add AlphaModel base class
Update existing models to derive from new base class
2018-05-11 01:50:45 -04:00
Michael Handschuh beb136062a Rename and move AlphaModel->AlphaModelExtensions
In preparation for AlphaModel default base class impl
2018-05-11 01:50:45 -04:00
Michael Handschuh afbbf9b1f4 Add UniverseSelectionModel base class
Update existing models to derive from new base class
2018-05-11 01:50:45 -04:00
Michael 0c7fc8c9b9 Merge pull request #1976 from jingwu74/master
Implements CSharp version of HistoricalReturnsAlphaModel
2018-05-10 10:39:28 -04:00
AlexCatarino f723952457 Implements python version of QC500UniverseSelectionModel 2018-05-09 11:37:25 +01:00
AlexCatarino 04f357f2b8 Implements python version of EmaCrossUniverseSelectionModel
Adds EmaCrossUniverseSelectionModel and EmaCrossUniverseSelectionFrameworkAlgorithm to show the new model in action
2018-05-08 18:54:17 +01:00
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
Jing Wu cd5944faae revert change 2018-05-07 16:40:40 -04:00
Jing Wu 6b7857226e modify properties in project file 2018-05-07 16:34:49 -04:00
Jing Wu 72e2b38f19 revert change 2018-05-07 16:30:48 -04:00
Jing Wu 33250b8c70 add HistoricalReturnsAlphaModel 2018-05-07 16:25:47 -04: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