Commit Graph

450 Commits

Author SHA1 Message Date
Jack Simonson 27e562ee15 Futures consolidator algorithm changes, new basic template algorithm for options consolidators
Changed function of BasicTemplateFuturesConsolidatorAlgorithm.py to use OnSecuritiesChanged to add/remove consolidators. Wrote equivalent algorithm for options data
2019-01-31 11:22:59 -08:00
Jack Simonson 13ed3bcaf1 Update CustomChartingAlgorithm.py
One more tweak to overlay the lines rather than separating the series
2019-01-30 14:31:24 -08:00
Jack Simonson 2e7c3fb6e4 Update CustomChartingAlgorithm.py 2019-01-30 13:54:26 -08:00
Martin Molinero aca0267bbb Updating documentation
- Removing `setup.py` and updating python documentation
- Updating ubuntu installation documentation to match
DockerfileLeanFundation
2019-01-22 21:38:01 -03: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
Martin Molinero 567e59ba00 Copy decimal.py to Launcher output dir
- Moving `decimal.py` into `Common/decimal.py` as a content copy always
file
2019-01-21 17:26:52 -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
Gerardo Salazar 40def51d93 Add python to regression test languages. Remove code with no effects from CustomModelsAlgorithm.py 2019-01-16 17:56:09 -08:00
Gerardo Salazar ad06996a7e #2715: Fixes CustomModelsAlgorithm.py making wrong trades. 2019-01-16 13:54:27 -08: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
Martin Molinero 124af7282e Improve HistoryRequestBenchmark algorithm
- The HistoryRequestBenchmark will now perform a daily and minute history
request at end of day.
- C# performance is at ~15k data points per second
- Python performance is at ~11k data points per second
2019-01-11 18:09:59 -03:00
AlexCatarino d846efdac6 Implements indexer in DataDictionary derived classes
Explictly implements the indexert `this[string]` to all classed that inherit from `DataDictionary` since pythonnet was not able to access the indexer from the parent class.

- Changes DividentAlgorithm.py to test the fix.
2019-01-09 17:48:31 +00:00
Martin Molinero af8e6bf85c Fix starting capital for non usd cash
- Moving `UniverseSelection.EnsureCurrencyDataFeeds` call into the
`IResultHandler` implementation through usage of the new `SetupHandlerHelper`
class, that will also set an initial conversion rate if none present.
- Adding regression test, that reproduces original issue
2018-12-19 16:15:28 -03:00
Jared 86807d3f04 Merge pull request #2298 from AlexCatarino/bug-2288-pythonnet-memory-leak
Updates pythonnet
2018-12-18 16:44:53 -08:00
Martin-Molinero 9f502ec15e Merge pull request #2757 from Martin-Molinero/bug-2756-disable-intrinio-regression-tests
Disabling Intrinio regression tests
2018-12-14 17:39:19 -03:00
Martin Molinero 759c15833a Disabling Intrinio regression tests
- Disabling C# and Py `BasicTemplateIntrinioEconomicData` regression
test. Free user credentials are invalid because Intrinio has now a 30 day trial for free users
2018-12-14 15:29:46 -03:00
Martin Molinero 0af7ba14f5 Address reviews
- `CashBook[NullCurrency] { get; }` will throw an exception
- Revert `Currencies.USD` changes in user facing algorithms
- Improve some documentation
- Revert some format changes
- Adding more asserts for regression test
- Adding new regression tests using a custom fee model which returns
`OrderFee.Zero`
- Adding a non-usd account currency test to the cash book tests
- Adding some unit tests for `NullCurrency` and `OrderFee.Zero`
2018-12-14 12:38:55 -03:00
Martin Molinero 0933da9303 Refactor previous commits
- Removing `AccountCurrency` from `Cash` and `Brokerage` classes.
`ICurrencyConverter` will now provide the `AccountCurrency`
- Adding new static `OrderFee.Zero` which will return a 0 order fee in
`NullCurrency`
- Adding static `Currencies.USD` value, replacing all "USD".
- Addin new static `Currencies.NullCurrency`
- Updating Bitfinex `FeeModel` so it return fees in quote currency.
Adding unit tests
2018-12-13 11:30:40 -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
Martin Molinero c5daf9ac9a Refactor IFeeModel
- Refactoring `IFeeModel`. *This is a breaking change* for implementations
inheriting directly from the interface. Deleting old and adding a new method
`OrderFee GetOrderFee(OrderFeeParameters parameters)` that will use a parameter
and a result object.
- Refactoring `CashAmount` so it does not embed a `ICurrencyConverter`
instance.
- Updating unit tests
- The `Security.QuoteCurrency`, a `Cash` instance, will provide access
to the `AccountCurrency` as a property.
- Will maintain backwards compatibility with old python custom
FeeModels, Adding unit test.

> Note that for now, consumers will ignore the currency, as before, and
directly consume the amount
2018-12-06 16:20:36 -03:00
Martin Molinero 46baedf858 Refactor FillModels
- Modifying `IFillModel` interface removing old methods and adding new
method `Fill Fill(FillModelParameters)`. This is a breaking change.
- Adding new `PythonWrapper` property for the `FillModel` base class.
This is required due to a limitation in PythonNet:
   - Given C# class T has `virtual` methods A and B. Where method A
   calls method B. And given custom python class L inherits class T.
   And overrides method B. When class L calls
   base method A (of class T). And when method A internally calls method B.
   It will call C# implementation, not the python override. This issue
   is solved going back to the `PythonWrapper`. Adding unit tests.
- Adding new `Parameters` property for the `FillModel` base class that will
be set by the call to `Fill()`. The `Parameters` property will be used by
the modified `XxxxFill()` implementations
- Adding new `Fill` result object for the `Fill(FillModelParameters)`
method
- Adding new check before removing a `SubscriptionDataConfig` due to the FillModels consuming the configuration collection when determining which Price to use. WIll now only remove the `SDC` if the symbol was removed from the selecting `universe`, this will avoid the case where the symbol is never deselected and the subscription ends, which happens at the end of all executions.
- Adding unit tests showcasing retro compatibility.
- Enabling C# `CustomModelsAlgorithm` as a regression test. Python
version returns a different result due to random number generation.
2018-11-29 15:38:46 -03:00
Stefano Raggi 64fa74b5d5 Add missing import and fix indentation 2018-11-14 21:12:57 +01:00
Stefano Raggi 67e3e98546 Merge pull request #2692 from QuantConnect/bug-2670-intrinio-regression-test-failing
Increment Intrinio time between calls to 1 minute for testing
2018-11-14 19:03:19 +01:00
Juan José D'Ambrosio f6b5da261a Implement method for setting the time interval between calls
Update Python version of BasicTemplateIntrinioEconomicData
2018-11-14 14:10:59 -03:00
AlexCatarino 70e2ef9480 Changes the custom data type base class
By using the python object parant class, which is either `PythonQuandl` or `PythonData`, instead of `DynamicData`, the `AlgorithmManager.Stream` method can find a matching subcription data configuration used to create a data feed packet.

Closes #2694
2018-11-13 19:29:34 +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
Kamuela Franco 621765fbd0 Update ScheduledUniverseSelectionModelRegressionAlgorithm.py 2018-10-28 14:52:48 +00:00
Martin-Molinero 11f5bf2a74 Merge pull request #2629 from StefanoRaggi/bug-2628-custom-data-regression-fix
Fix failing CustomDataRegressionAlgorithm
2018-10-25 10:22:50 -03:00
Stefano Raggi 82e5af0408 Add CompositeRiskManagementModelFrameworkAlgorithm Python regression 2018-10-24 22:45:13 +02:00
Stefano Raggi ea55b8ba09 Fix failing CustomDataRegressionAlgorithm 2018-10-22 14:48:16 +02:00
Michael Handschuh 614451ca30 Merge pull request #2615 from AlexCatarino/feature-2614-implements-datadictionary-getvalue
Implements DataDictionary.GetValue
2018-10-18 12:25:27 -04:00
Alexandre Catarino 5e9fac14f4 Updates readme.md by adding direct links to the installers 2018-10-18 00:23:20 +01:00
AlexCatarino 6ee4363942 Implements DataDictionary.GetValue
`DataDictionary.GetValue` is meant to be used as an alternative to `DataDictionary.TryGetValue`. It was created due to limitations to the python implementation.
2018-10-17 22:18:12 +01:00
Martin Molinero eaba3ab24e Fix ManualUniverse duplicate effort
- Removed usages of algorithm.Securities.key as a parameter for the
`ManualUniverseSelectionModel()` since those securities, added through
`AddXXXX` calls will be managed by the `UserDefinedUniverse`. This was
causing for Universes to try to add the same subscription requests
- Adding new empty constructor for ManualUniverseSelectionModel,
required for Python
- ManualUniverse will return any existing SDC for the
symbol. This is for maintaining existing behavior and
preventing breaking changes: Specifically motivated by usages of
Algorithm.Securities.Keys as constructor parameter of the
ManualUniverseSelectionModel, since those Symbols added by Addxxx()
calls will already be managed by the UserDefinedUniverse
- Making some format modifications to aling with used Lean formatting
2018-10-12 18:30:04 -03:00
Stefano Raggi 399274b29b Fix ScheduledUniverseSelectionModelRegressionAlgorithm.py regression failure 2018-09-28 15:17:38 +02:00
Michael Handschuh fdc866fda0 Reverting 'Merge pull request #2483 python-history-provider'
We didn't experience the expected performance improvements. Locally under
unit test there was aboout an order of magnitude throughput increase, but
when run against the history benchmark, this new approach was 60% slower.
We're reverting this for now to perform further analysis and better
understand the performance profiling of the python history stack.
2018-09-18 18:37:23 -04:00
AlexCatarino 3e4a71cd50 Creates QCAlgorithm.py: a bridge between C# QCAlgorithm and python algorithms 2018-09-17 19:05:48 +01:00
AlexCatarino 720e0400fc Implements custom seed function to CustomSecurityInitializerAlgorithm 2018-09-17 18:28:59 +01:00
AlexCatarino 62d4cb837a Updates PythonPackageTestAlgorithm to use QCAlgorithm.Log instead of print 2018-08-28 15:06:34 +01:00
AlexCatarino 93a88eda95 Updates FractionalQuantityRegressionAlgorithm to use SetBuyingPowerModel 2018-08-21 16:49:07 +01:00
Michael b30d429be6 Merge pull request #2427 from QuantConnect/bug-2064-add-option-contract-throw-if-underlying-not-raw
AddOptionContract - throw if existing underlying equity not in Raw mode
2018-08-21 11:44:16 -04:00
Stefano Raggi b4a2536b86 AddOptionContract - throw if existing underlying equity not in Raw mode
Also added OptionChainProviderAlgorithm to regression test suite
2018-08-21 14:51:43 +02:00
AlexCatarino 76cc75006c Refactors BlackLittermanOptimizationPortfolioConstructionModel
1. Apply the pattern used in `EqualWeightingPortfolioConstructionModel`
2. Change the logic to compute the views from the insights.
3. Change the logis to compute the posterior mean and covariance

Use `UnconstrainedMeanVariancePortfolioOptimizer` in `BlackLittermanPortfolioOptimizationFrameworkAlgorithm` to bypass the difference in regression tests with `IPortfolioOptimizer` that rely on different algorithms in C# and python.

Adds unit tests for BLOPCV to test the implementation against Black and Litterman 1999 paper.
2018-08-20 21:01:14 +01:00
Martin Molinero ed33286842 Updating regression statistics 2018-08-15 21:10:49 -03:00
Jared Broad db0f85122c Increase the universe of assets to increase insights 2018-08-15 18:41:46 -04:00
Martin Molinero c1272874fb Adding regression statistics 2018-08-15 11:58:46 -03:00
Jared Broad ff172add77 Added missing examples to py proj 2018-08-14 21:28:35 -04:00
Jared Broad c4d0baab49 Added 2 example benchmark alphas 2018-08-14 18:43:45 -04:00