Commit Graph

396 Commits

Author SHA1 Message Date
HalldorAndersen 6e5b7ddd1d Update UncorrelatedUniverseSelectionModel.py 2019-04-10 16:31:04 -07:00
HalldorAndersen 682836677f Update UncorrelatedUniverseSelectionModel.py 2019-04-10 15:34:20 -07: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 cfa08a11fb Address reviews
- Removing `using QCAlgorithmFramework = QuantConnect.Algorithm.QCAlgorithm`
- Removing `QCAlgorithmFrameworkBridge`
- Removing `IsFrameworkAlgorithm`
- Making `EmitInsightBasedOnFill` private. Adding new
`IOrderEventProvider` exposing an `event` to which `QCAlgorithm` will
subscribe.
- `AccountType.Cash` algorithms will be allowed to manually trade and
emight insights manually or with alpha model.
2019-04-03 21:55:44 -03:00
Martin Molinero 19f1806ddc Address review: readd Framework project 2019-04-03 21:55:43 -03:00
Martin Molinero 32ac3146b4 Merge Framework and Classic Algorithms
- Merging Framework and Bridge algorithms into classic QCAlgorithm
class.
- Removing Framework project, VS17 and VS15
2019-04-03 21:54:32 -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 8509cf9f22 Update UncorrelatedUniverseSelectionModel.py 2019-04-01 10:50:16 -07:00
HalldorAndersen de753e0e43 Update UncorrelatedUniverseSelectionModel.py 2019-04-01 10:28:54 -07: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
HalldorAndersen 3fe468d2d5 Update UncorrelatedUniverseSelectionModel.py 2019-04-01 09:51:58 -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 716652e6fa Rename UncorrelatedToBenchmarkUniverseSelectionModel.py to UncorrelatedUniverseSelectionModel.py 2019-03-26 11:20:29 -07:00
HalldorAndersen ac3667cef9 Rename UncorrelatedToSpyUniverseSelectionModel.py to UncorrelatedToBenchmarkUniverseSelectionModel.py 2019-03-26 10:18:30 -07:00
HalldorAndersen 7477775f8b Update QuantConnect.Algorithm.Framework.csproj 2019-03-26 10:08:49 -07:00
HalldorAndersen fdae6a9f9a Update UncorrelatedToSpyUniverseSelectionModel.py 2019-03-26 10:05:38 -07:00
HalldorAndersen 6e36e55836 Update UncorrelatedToSpyUniverseSelectionModel.py 2019-03-26 09:59:46 -07:00
HalldorAndersen 1194a04678 Update and rename Algorithm.Python/UncorrelatedToSpyUniverseSelectionModel.py to Algorithm.Framework/Selection/UncorrelatedToSpyUniverseSelectionModel.py 2019-03-25 16:40:27 -07:00
AlexCatarino 0d64032dfe Remove logging 2019-03-12 16:36:40 +00:00
AlexCatarino fa179b4659 Fix QC500 bugs and inconsistencies
- ConstituentsQC500GeneratorAlgorithm:
  - Change monthly flag to be consistent with Selection Model that cannot use Schedule events.
  - Use a Dictionary keyed by `Symbol` instead of `string`.
  - Selector functions return `Universe.Unchanged` instead of empty list;
  -Refactoring and more informative logging.
- QC500UniverseSelectionModel
  - SelectFine methods were performing all the logics every day and it should be only once per month
  - Log and return `Universe.Unchanged` before division by zero if universe drops to zero members after filtering before selection by sector.
  - Refactoring
2019-03-12 10:57:01 +00:00
AlexCatarino 00963aa07d Adds Check for Fundamental data in MaximumSectorExposureRiskModel
`MaximumSectorExposureRiskModel` needs `IndustryTemplateCode` which is only found in Equity data with Fundamental data. Thus, we check whether all active securities have such information.
2019-02-25 22:51:25 +00: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
Martin Molinero d9195317e3 C# decimal to Python conversion
- This commit is related to PR 19 in QC/pythonnet
   - C# decimal will be cast to C# double and converted into python
   float
- Adding new `decimal.py` into the python algorithm project. This is
required for backwards compatibility with users performing operations
over expected decimal types (like `Price`)
- Updating two python regression test algorithms using custom python
execution models to be aware and ignore floating point precision errors
when handling order sizing.
2019-01-15 12:13:42 -03: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
Jared d241aa49a0 Merge pull request #2657 from QuantConnect/bug-2656-macd-alpha-model-constainskey-check
Adds ContainsKey check in MacdAlphaModel
2018-11-09 09:06:01 -08:00
Stefano Raggi 57d50c69c4 Fix XML documentation compiler warnings
- Fixed all warnings except for missing XML comments (CS1591)
2018-11-09 11:44:03 +01:00
AlexCatarino 8c853543c0 Adds ContainsKey check in MacdAlphaModel
In `MacdAlphaModel.OnSecuritiesChanged`, a missing `ContainsKey` is not preventing a second key addition to a dictionary.

Closes #2656
2018-11-08 15:03:36 +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
AlexCatarino b89bc97d61 - Use ValidateImplementationOf method in RiskManagementModelPythonWrapper
- Use recently implemented `ValidateImplementationOf` extension method in `RiskManagementModelPythonWrapper`
2018-11-06 23:11:21 +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 c35649b1b5 Add support for trailing portfolio stop loss 2018-11-04 08:41:38 +08:00
David f2aacb2645 Removed logging message 2018-10-29 08:57:54 +00: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 879843c9a8 Refactored TotalDrawdownPercent() 2018-10-26 09:03:07 +01:00
David f41315cb69 Remove non-conforming features 2018-10-25 23:40:50 +01:00
David dfd8027715 Add regression algorithm - MaximumPortfolioDrawdownFrameworkAlgorithm 2018-10-25 00:03:57 +01:00
David 3b089af75a Added MaximumDrawdownPercentPortfolio Risk Management Model
Updates
2018-10-25 00:03:36 +01:00
Martin Molinero 2c2612aa71 Addressing reviews
- SecurityManager will no longer inherit ISecurityService
- Rebase from master
2018-10-18 16:45:16 -03:00
Martin Molinero a288648929 Creating new ISecurityService
- Adding new ISecurityService and its implementation SecurityService.
Expose by SecurityManager.
This class will expose a method for creating new securities. The
SecurityManager is exposing this new interface, calling _securityService
internally, so Future/OptionUniverseSelectionModel.cs can use it
- Replacing all usages of SecurityManager.CreateSecurity for new
ISecurityService
- Modifying `Cash.cs` and `CashBook.cs` `EnsureCurrencyDataFeeds()` to
return newly added `SubscriptionDataConfig` instead of `Security`. This
will avoid using `Security.Subscriptions` at call site.
- Moving old SecurityManager.CreateSecurity into new
SecurityServiceTests.cs
2018-10-18 16:25:32 -03:00
Michael Handschuh a875023837 Merge pull request #2605 from QuantConnect/feature-2581-multiple-risk-models
Add CompositeRiskManagementModel
2018-10-18 12:25:04 -04: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 446e07aa56 Fix composition bug in CompositeRiskManagementModel
The CompositeRiskManagementModel aims to provide support for multiple
risk management models. In order to accomplish this, it must respect
the return values from each individual model. As previously written,
the composite model was allowing models run later to completely nuke
the targets produced by earlier models. This change performs the
composition of targets using the same technique as is used when over
laying the risk adjusted targets on top of the portfolio construction
model's targets. This approach gives preference, by symbol, to the
risk adjusted targets, but if there is no risk adjusted target, then
it uses the targets from the previous step. For example, if targets
for A, B, C, and D are produced by PCM, then risk model 1 adjusts to
zero targets for B and cuts the targets for C in half, these are then
piped to risk model 2 (A, C/2, D). Risk model 2 may return ZERO targets.
This doesn't mean we should remove all the targets, it simply means
that the risk model didn't adjust any and we should use the output
from risk model 1. Now, let's say risk model 2 zeroes out A and cuts
B in half again, the final result should (and now is) C/4, D. IOW,
risk models only return deltas, things to be changed, so returning
nothing means there are no changes.
2018-10-15 13:52:41 -04:00