Commit Graph

309 Commits

Author SHA1 Message Date
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 d5c89ab781 Merge pull request #1982 from AlexCatarino/feature-1981-changes-insight-group-method-return-type
Changes Insight.Group return type to IEnumerable<Insight> from Guid
2018-05-10 14:23:35 -04:00
Michael bb8c8e15a2 Merge pull request #1989 from AlexCatarino/feature-1988-standardize-compositealphamodel
Refactors CompositeAlphaModel constructors
2018-05-10 11:23:30 -04:00
AlexCatarino b15cfacff2 Insight.Group retuns the original Insight array with modified Insights
Use the new return type in PairsTradingAlphaModel.
2018-05-10 16:18:07 +01:00
Michael 0c7fc8c9b9 Merge pull request #1976 from jingwu74/master
Implements CSharp version of HistoricalReturnsAlphaModel
2018-05-10 10:39:28 -04:00
AlexCatarino 042028096b Refactors CompositeAlphaModel constructors
Changes the constructor that accepted an array to accept params array and adds a new constructor to deal with a single model addition.
2018-05-09 22:36:33 +01:00
AlexCatarino f723952457 Implements python version of QC500UniverseSelectionModel 2018-05-09 11:37:25 +01:00
AlexCatarino ff574b9d86 Fixes EmaCrossUniverseSelectionModel indicator update logic
Instead of using the `&&` operator, use `&` so that both EMA are updated.
2018-05-08 19:47:20 +01:00
AlexCatarino 5d6dea6473 Simplify EmaCrossUniverseSelectionModel by using list instread of dict 2018-05-08 18:54:17 +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 0b7d73eeff fix if statement bug 2018-05-08 10:13:59 -04:00
Jing Wu dff04a824e fix for loop bug 2018-05-07 17:55:25 -04:00
Jing Wu 198a618303 accomodate the history request to csharp convention 2018-05-07 17:39:42 -04: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 faa4e4a678 add copyright labels 2018-05-07 16:33:45 -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
Michael Handschuh d3d331f100 Make risk management models overrideable 2018-05-07 16:14:13 -04:00
Michael Handschuh 534c95902c Use VWAP indicator from indicators project
The volume weighted average price execution model had its own implementation
of VWAP since the existing VWAP didn't perform the daily reset. The intraday
VWAP indicator has since been added to the indicators project so this is just
duplicate code.
2018-05-07 16:13:10 -04:00
Michael Handschuh d3bf5159ca Make execution models overrideable 2018-05-07 16:13:10 -04:00
Michael Handschuh 1e2e9cf11e Make portfolio construction models overrideable 2018-05-07 16:13:10 -04:00
Michael Handschuh 0b2344f930 Make alpha models overrideable 2018-05-07 16:13:10 -04:00
Michael Handschuh 353e62c6e9 Make universe selection models overrideable 2018-05-07 16:13:07 -04:00
AlexCatarino 6250ed900e Use UniverseManager.ActiveSecurities instead of Securities
Framework models should not loop over `algorithm.Securities` since it contains all securities that were ever added to the algorithm, but `UniverseManager.ActiveSecurities` that contains only the active securities.

Instances of `PortfolioTargetCollection` are intended to be a class level variables and not a method level variables. As a class member it maintains a complete set of all portfolio targets so you can operate against a 'full view' instead of the potentially streaming targets (which can come in one by one as alpha is generated).
2018-05-03 22:02:08 +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 6e1d113922 Minor models fixes
- ConstantAlphaModel.py: sets default value `None` for magnitude and confidence
- BlackLittermanPortfolioConstructionModel.py: removes logging.
2018-05-03 21:50:11 +01:00
Michael Handschuh 441bd9a233 Add algorithm.framework nuspec file 2018-04-30 16:23:32 -04: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
AlexCatarino d81de45772 Implements python version of MaximumDrawdownPercentPerSecurity. 2018-04-27 22:29:10 +01:00
AlexCatarino fd461ed252 Refactors python framework models to avoid using generator
We are not using python lists instead of generator (yield) because we get better exception information in this case. The aim is to lead users to avoid using generators and/or know its limitations.
2018-04-26 19:31:11 +01:00
AlexCatarino 264da8a596 Calls python destructor to trigger exceptions
The exception in ignored because the generator isn't closed until it is being deleted (automatically in this case, when Python exits); the generator __del__ handler closes the generator, which triggers an exception of there is one.
2018-04-26 18:46:33 +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 Handschuh 0ddc160028 Fix ManualUniverseSelectionModel w/ custom data present
We add entries for custom data w/ symbol references, so the generic look
up being performed here never resolves and throws an exception. With
custom data we add the entry manually and that same pattern has been
repeated here for consistency.
2018-04-20 17:37:39 -04:00
Michael Handschuh c1c741f55f Remove canonical symbols from manual universe model
This happens when users pass Securities.Keys into the manual model,
causing the SecurityChanges object to have references to the canonical
securities, thereby leading to indicators and other things being
done to them unknowningly.
2018-04-20 09:32:22 -04: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
AlexCatarino c3ac0392b7 Removes logging in python version of MacdAlphaModel 2018-04-19 22:09:17 +01: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 0c8119de8a Merge pull request #1889 from AlexCatarino/feature-1884-python-execution-models
Adds python version of execution model examples
2018-04-19 13:24:27 -04:00
AlexCatarino f3135b118e Adds Name attribute to python alpha models
These `Name` values match those in C# alpha models.
2018-04-19 18:04:01 +01:00