Commit Graph

118 Commits

Author SHA1 Message Date
Jared a2a63ae058 Merge pull request #3016 from QuantConnect/feature-3015-add-weight-to-insights
Add Insight optional Weight
2019-06-04 16:52:48 -07:00
Martin Molinero ac53e2a790 Rebase from master. Adding missing Python algo 2019-04-24 11:05:15 -03:00
Martin Molinero 968adcea32 Adding InsightWeightingPortfolioConstructionModel
- Adding new `InsightWeightingPortfolioConstructionModel` that will
generate percent `Targets` based on the latest active `Insight` `Weight` per
`Symbol`.
   - Will ignore `Insights` that have no `Weight`.
   - If the sum of all the last active `Insight` per `Symbol` is bigger than 1, it
will factor down each target percent holdings proportionally so the sum is 1.
- Adding unit tests
- Adding a new regression test framework algorithm
- Note most of the code, including tests, are reused from the
`EqualWeightingPortfolioConstructionModel`
2019-04-24 11:05:14 -03:00
AlexCatarino c3de660551 Updates pythonnet to 1.0.5.20 2019-04-23 23:15:14 +01:00
Martin Molinero 4d108094e5 Implement QCAlgorithm.AddRiskManagement
- Implemention `QCAlgorithm.AddRiskManagement`
- Adding Py/C# regression test algoririthms
- Moving `CompositeRiskManagementModel` from `Framework` to `Algorithm`
project
2019-04-08 10:53:06 -03:00
Martin Molinero 9cabd32d19 Add AddAlphaModel method 2019-04-04 13:36:07 -03:00
Martin Molinero 4bc7ec124c Rebase - Improve exception message 2019-04-03 22:00:27 -03:00
Martin Molinero 19f1806ddc Address review: readd Framework project 2019-04-03 21:55:43 -03:00
Jared 6dd7a2d50f Merge pull request #3028 from HalldorAndersen/patch-9
New Universe Selection Model: Correlation breakdown
2019-04-03 16:09:45 -07:00
AlexCatarino da6519b9f4 Updates pythonnet to 1.0.5.19
Updates PythonNet to 1.0.5.19
 - Related  https://github.com/QuantConnect/pythonnet/pull/28/
2019-04-02 17:17:40 +01:00
HalldorAndersen d117b08c73 Update QuantConnect.Algorithm.Framework.csproj 2019-04-01 10:25:45 -07:00
HalldorAndersen 28fbce4b12 Update QuantConnect.Algorithm.Framework.csproj 2019-04-01 10:06:34 -07:00
AlexCatarino 6d2460d8ed Updates pythonnet to 1.0.5.18
- Updates PythonNet to 1.0.5.18
  - Cherry picks the memory leak fix from upstream/pythonnet
2019-03-28 00:47:38 +00:00
HalldorAndersen 7477775f8b Update QuantConnect.Algorithm.Framework.csproj 2019-03-26 10:08:49 -07:00
AlexCatarino d91cad3123 Updates pythonnet to 1.0.5.17
- Updates PythonNet to 1.0.5.17
  -  Improve performance by adding new `interop` `type` cache holding a `bool`, true if its an `exception`. And adding a `setter` and `getter` cache for the `propertyobject`. Closes #2925.
  - Decimal parsing allows numeric string in exponential notation. Closes #2918 #2919.

Closes #2929
2019-02-22 17:46:59 +00:00
Martin Molinero d53a922cf0 PythonNet installation does not require copy pasting
- Requires a new PythonNet 1.0.5.15 package where the different `.dll` are in a
specific folder: `\win` `\linux` and `\osx`
- Removed not present `decimal.py` from `Algorithm.Python` project. It
was moved into `Common`.
- Replace `xbuild` for `msbuild` required for using the `System.Runtime.InteropServices`.
Also note the `xbuild` on travis prints:
> >>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
2019-01-22 19:48:11 -03:00
AlexCatarino ef59fa7ba2 Updates pythonnet package.
In the new package:
- C# decimal conversion will use C# double and python float due to the big performance impact of converting C# decimal to python decimal;
2019-01-18 23:18:35 +00:00
AlexCatarino 823bb01438 Updates pythonnet
Includes memory leak fix (https://github.com/QuantConnect/pythonnet/commit/c6db86653e7fa4fa89e1f8404d72e346b67ed857 and https://github.com/QuantConnect/pythonnet/commit/bec9563d2958acc5adf3e8972b23609fe3914402)

- Fix python version to 3.6.6 (avoid updating to 3.7)
- Fix numpy version to 1.14.5 (tensorflow requirement)

- Adds py-earth python package (closes #2399).
2018-12-07 09:36:48 +00:00
AlexCatarino 25baaf179a Implements python version of TrailingStopRiskManagementModel
- Implements python version of `TrailingStopRiskManagementModel`
- Implements python version of `TrailingStopRiskFrameworkAlgorithm`
2018-11-07 15:50:40 +00:00
AlexCatarino 5389f9bf8b Implements python version of MaximumDrawdownPercentPortfolio
- Implements python version of `MaximumDrawdownPercentPortfolio`
- Implements python version of  `MaximumPortfolioDrawdownFrameworkAlgorithm`
2018-11-06 23:52:52 +00:00
AlexCatarino b20716a282 Adds python version CompositeRiskManagementModel
The C# version was supposed to handle python modules, but when they inherit from a C# module, pythonnet send them as C# objects. Consequently, they are not wrapped and cannot be used. The python version of `CompositeRiskManagementModel` solves the issue.

- Implements python version of `MaximumUnrealizedProfitPercentPerSecurity`

- Updates `CompositeRiskManagementModelFrameworkAlgorithm` in order to use python risk model.
2018-11-06 23:22:53 +00:00
Jared e3cd28cae3 Merge pull request #2643 from dd-w/feature/portfolio_max_drawdown
Feature: Maximum Portfolio Drawdown
2018-11-05 09:25:26 -08:00
David b59550dd59 Initial TrailingStop implementation
Restructured


Update message


Added removal of trailing highs for unnecessary securities


Add logging message


Improvements


Rename


Add regression Algorithm


Changed to use TradeBar values instead of only current price


Cleaned msg layout


Update Regression test
2018-10-29 08:57:44 +00:00
David 3b089af75a Added MaximumDrawdownPercentPortfolio Risk Management Model
Updates
2018-10-25 00:03:36 +01:00
Michael Handschuh 72327507ad Rename MaximumUnrealizedProfitPerSecurty->MaximumUnrealizedProfitPercentPerSecurity
While it is a long name, this aims to provide consistency with it's inverted
brethern, the MaximumDrawdownPercentPerSecurity risk model
2018-10-15 13:52:41 -04:00
Michael Handschuh d818b56d6e Add MaximumUnrealizedProfitPerSecurity risk model
This is the inverse of the MaximumDrawdownPercentPerSecurity risk model.
It's goal is to liquidate holdings for a security when the unrealized profit
passes a specified threshold. This can viewed as a 'take the money and run'
risk model.
2018-10-13 03:30:13 -04:00
David 9e25420ba5 Convert to RiskManagmentModel 2018-10-06 15:01:07 +01:00
AlexCatarino 9c99794bfb Adds covariance parameter in IPortfolioOptimizer.Optimize
Add a multi-dimensional array of double representing the covariance. Some models, e.g., Black-Litterman may want to optimize a covariance that is different from the historical one.

Adds UnconstrainedMeanVariancePortfolioOptimizer: a simple optimizer that has a solution, therefore no numerical optimization method is required.
2018-08-20 20:51:02 +01:00
AlexCatarino e5ed09924b Implements BasicTemplateFuturesFrameworkAlgorithm
This algorithm shows how to implement a futures strategy in a framework algorithm.
`FutureUniverseSelectionModel` portfolio selection model was implemented to provide a base class to help create other futures universe selection models.
2018-07-30 22:21:47 +01:00
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