Commit Graph

978 Commits

Author SHA1 Message Date
Martin Molinero 3630e735b0 Update AccumulativeInsightFrameworkAlgorithm stats 2020-03-11 14:34:13 -03:00
Juan José D'Ambrosio b7a503a096 Update Regression algorithms 2020-03-11 14:34:13 -03:00
Juan José D'Ambrosio 1269966e51 Rebase and squash commits
Update test to the new crypto and equity subscriptions  rules:
- Only consolidates trades
- Low resolution data are only trades.
Update and fix tests

Add missing minute sample files

Update Regression algorithms statistics
2020-03-11 14:34:13 -03:00
Juan José D'Ambrosio fd9de5895a Consolidate only trades, low resolution reads trades only, update tests
Crypto and Equities will consolidate trades by default

Daily and hourly resolution will return only trades for crypto and equities. 
Update equity TAQ regression test 

Add minute sample files

Updating regression algorithms

Update SpotMarket test cases

Add regression test for equity trades and quotes
- History request.
- Trades and quotes pumped into OnData.
- Subscriptions are added correctly.

Add sample data

Checks low resolution only subscribes to trade bars
2020-03-11 14:34:05 -03:00
Juan José D'Ambrosio 228aad658b Process Equity quotes
This is just a draft for supporting Equity quotes in Lean
2020-03-11 14:34:05 -03:00
Martin Molinero b45b7e427f Address reviews
- Address review improve regression and unit test
- Fix same time scheduled event order
- Adding comments in unit test
- Increasing unit test sleep time
2020-03-03 10:45:37 -03:00
Martin Molinero 2f4f7dc2cb ScheduledEvents fire in order
- Scheduled events will fire in order even after market hours
- Improving scheduled events performance
- Adding regression and unit test
2020-03-02 11:05:54 -03:00
Martin Molinero 983d84bf01 Implement PortfolioBias for MVOPCM, BLOPCM, AIPCM
- Implement portfolio bias for
`MeanVarianceOptimizationPortfolioConstructionModel`,
`BlackLittermanOptimizationPortfolioConstructionModel`,
`AccumulativeInsightPortfolioConstructionModel`. Adding unit tests
2020-02-21 12:12:59 -03:00
AlexCatarino c2ff03caad Implements PortfolioBias in EWPCM and IWPCM
Implements `PortfolioBias` in EWPCM, CWPCM and IWPCM. With this new feature, these PCM will ignore insights that do not respect the desired bias. E.g. for `PortfolioBias.Long`, on Insights with `InsightDirection.Up` will be converted into `PortfolioTarget.Quantity` greater than zero and other `InsightDirection` will result in `PortfolioTarget.Quantity` of zero.
2020-02-20 19:29:12 -03:00
Jared 79b6043b89 Merge pull request #4119 from QuantConnect/refactor-4117-move-ewpcm-logic-to-base
Refactor EqualWeightingPCM into base PortfolioConstructionModel
2020-02-20 13:34:08 -08:00
Martin Molinero a8120c197a Improvements
- Adding new unit test for python PCM implementations, asserting each
method is correctly called
- Reverting some unrequired changes in the
`MeanVarianceOptimizationFrameworkAlgorithm`
2020-02-20 12:13:47 -03:00
Martin Molinero 0027ab1e66 Regression test assert order list hash
- Regression tests assert order list hash value
- Normalizing some regression test behavior that had differences between
C# and Py
2020-02-19 20:26:12 -03:00
Martin Molinero 8ff23936d1 Refactor EWPCM into base PCM
- Refactor shared logic from `EqualWeightingPortfolioConstructionModel`
into base `PortfolioConstructionModel` implementation
- `MeanVarianceOptimizationPortfolioConstructionModel` will respect
rebalancing period and will use all active inisights, not just the last
2020-02-19 15:13:20 -03:00
AlexCatarino 8a1823de73 Addresses Peer-Review 2020-02-18 16:00:09 +00:00
AlexCatarino fcf2696809 Rebases With Master and Apply New API
Improves regression algorithm by adding more sanity checks.
2020-02-18 13:47:57 +00:00
AlexCatarino 21ce895c18 Implements SectorWeightingPortfolioConstructionModel
Provides an implementation of `IPortfolioConstructionModel` that generates percent targets based on the `CompanyReference.IndustryTemplateCode`.
2020-02-17 22:08:06 +00:00
Martin Molinero b5ac6bffd9 Adding unit tests
- Adding Yearly and Quarterly unit tests
2020-02-17 11:28:34 -03:00
Aytaç Aşan 2f3b7f6187 Added Examples in DataConsolidationAlgorithm
Added Examples in DataConsolidationAlgorithm for Quarterly & Yearly Data Consolidation
2020-02-14 21:08:30 -03:00
AlexCatarino ceabf93e94 Renames CalendarType to Calendar
Keeps `CalendarType` for backward compatibility.
2020-02-14 19:47:48 -03:00
Martin Molinero 3679ad591f Address reviews
- Improve custom rebalance function logic
- Add new PyObject C# PCM constructor overloads for performance
2020-02-14 16:38:16 -03:00
Martin Molinero e12788375b Adding IDateRule rebalacing PCM
- Adding IDateRule to be used by the PortfolioConstructionModel as
rebalancing function.
- Adding unit tests and C#/Py regression algorithms
2020-02-13 18:23:15 -03:00
Martin Molinero 26c731f895 Add python regression algorithm implementation 2020-02-13 16:11:23 -03:00
Martin Molinero 4584088a9e Address reviews
- Refactor to avoid calling rebalancing function twice in the same loop
- Refactor making portfolio rebalance setting instance based instead of
static
2020-02-13 16:10:52 -03:00
Martin Molinero 0845f0802d Unknown next rebalance time
- Adding new `Func<DateTime, DateTime?>` that allows PCM to return null
if the next rebalance time is null, in which case the function will be
called again in the next loop.
- Adjusting PCM next rebalance time check to perform rebalance once the
time is reached
- Adding new regression test. Updating existing
2020-02-13 16:10:52 -03:00
AlexCatarino 3a0640614c Updates Dropbox Algorithms
- Updates `DropboxUniverseSelectionAlgorithm` and `DropboxBaseDataUniverseSelectionAlgorithm` with new links to Dropbox files and date range to match the dates in the files.
- Adds copy of files in `TestData` folder.
2020-02-12 23:58:03 +00:00
AlexCatarino f6d7e5fcd7 Addresses Peer-Review
- Standarizes basic template algorithms for options and futures
- Fix typo
2020-02-12 22:28:45 +00:00
AlexCatarino 9690acfd25 Changes Basic Template Algorithms With Options and Futures to Show The New Overloads
Keeps the original overloads in the comments.
2020-02-12 16:49:44 +00:00
Martin Molinero d3a2c7ff5a Address reviews
- Moving InsightCollection into base `PortfolioConstructionModel`
- Will call `InsightCollection.GetNextExpiryTime()` on each check, and
for performance `InsightCollection` will keep track of next insight
expiry time
- Removing need for PCM base classes having to call `RefreshRebalance`
- Some refactor clean up at base
PortfolioConstructionModel.IsRebalanceDue()
2020-02-11 21:02:35 -03:00
Martin Molinero e6d07d6305 Add new regression algorithms
- Adding new regression algorithms setting PCM.RebalanceOnSecurityChanges
and PCM.RebalanceOnInsightChanges to false
2020-02-11 17:36:27 -03:00
Martin Molinero 4fc9a516fd Adding RebalanceOnInsightChanges flag
- Refactoring some PCM methods to be `protected` since they are not required
to be public
- Adding new `PortfolioConstructionModel.RebalanceOnInsightChanges`
flag, that will allow avoiding new insights or insight expirations to
trigger a rebalance
- Updating unit tests
- Fix for the MeanVarianceOptimizationPortfolioConstructionModel that
was skipping, in some cases, 0 magnitude insights
2020-02-11 16:06:27 -03:00
Martin Molinero 6cfa19697a Refactor PCM rebalacing
- Add missing PCM constructor methods for the different supported
rebalancing periods overloads
- Normalize rebalance behavior in the base `PortfolioConstructionModel`
- Adding new `PortfolioConstructionModel.RebalanceOnSecurityChanges`
that will allow disabling rebalance on security changes
- Adding unit tests
2020-02-10 22:32:09 -03:00
Martin-Molinero 7ea2e6853b Merge pull request #4054 from gsalaz98/feature-refactor-tradingeconomics-calendar-downloader
Refactors Trading Economics Calendar Events Storage
2020-02-05 21:30:21 -03:00
Martin Molinero b51ae82900 Address reviews
- Add new regression algorithm which expects no regression call to
happen
2020-02-05 20:26:17 -03:00
Martin Molinero 9aa6a7062e Fix margin call on closed market
- `FutureMarginModel` and `PatternDayTradingMarginModel` will adjust
margin requirements before market closes using the new `Exchange.ClosingSoon` property
- Adding unit tests and regression algorithm
2020-02-05 18:53:51 -03:00
Gerardo Salazar 050089a3ae Address review and add TradingEconomics.Event definitions
* Updates TradingEconomics algorithms to use new event definition
* Separated Calendar and Indicator definitions into partial class
* Refactors portions of TradingEconomicsCalendar
* Makes TradingEconomicsCalendar.GetSource return RemoteFile for live
* Fixes bugs in TradingEconomicsEventFilter
* Fixes bugs in StreamReaderExtensions (thanks Martin :))
* Adds new unit tests to cover changes
2020-02-04 13:48:04 -08:00
Martin Molinero fe78801fca Add future 'EnableIntradayMargins'
- Add `FutureMarginModel.EnableIntradayMargins` false by default to
avoid margin calls with SetHoldings usage
- Updating regression tests
2020-02-04 18:41:15 -03:00
Martin Molinero 85f5b68972 Address reviews
- Revert `OptionMarginModel` behavior change
- Renames
- Refactor future intraday margin modelling
2020-02-04 18:41:15 -03:00
Martin Molinero 6eb45baa59 Refactor GetMaximumOrderQuantityForTargetBuyingPower
- Refactoring `GetMaximumOrderQuantityForTargetValue` into
`GetMaximumOrderQuantityForTargetBuyingPower` which algorithm uses
margin
- Reducing code duplication
- Adding unit tests
- Fixing futures margin model. Adding intra day logic.
2020-02-04 18:41:15 -03:00
Martin Molinero 936af7df7b Refactor BuyingPowerModel
- Remove unrequired `GetBuyingPower`
- Making `BuyingPowerModel.GetMaintenanceMarginRequirement` protected
instead of public
- Adding `GetMaximumOrderQuantityForDeltaBuyingPower` to replace
public `GetMaintenanceMarginRequirement` and improve API experience for
consumers like the `DefaultMarginCallModel`
- Adding new unit tests
2020-02-04 18:41:15 -03:00
Jared 04a8c6af7e Merge pull request #4034 from QuantConnect/bug-4024-option-chain-universe-selection-data
Validate option universe selection data
2020-01-29 08:07:10 -08:00
Martin Molinero 20c589f0fe Validate option universe selection data
- Remove unused `OptionChainUniverseDataCollectionAggregatorEnumerator`
- Refactor `BaseDataCollectionAggregatorEnumerator` and
`OptionChainUniverseDataCollectionEnumerator` to avoid emitting invalid
data points
- Updating regression tests statistics
- Adding unit test
2020-01-27 19:11:17 -03:00
Jared 17b1acf6d2 Merge pull request #4033 from gsalaz98/feature-normalize-tradingeconomics-calendar-events-pt1
Implement filtering and normalization of Trading Economics calendar event names
2020-01-27 13:07:11 -08:00
Gerardo Salazar e7a9d06b16 Implement filtering and normalization of Trading Economics calendar
event names

* Adds unit test for new filter method

NOTE: This is a breaking change for Trading Economics calendar events
property. Any previous string matching might result in a mismatch if
results were not previously being normalized.
2020-01-27 11:32:26 -08:00
AlexCatarino 9172bf0ed2 Addresses Peer-Review
The `AlphaStreamsBrokerageModel` was unnecesarily duplicating the `GetBuyingPowerModel` from the base class. Missing docs were added.
2020-01-21 15:52:54 +00:00
AlexCatarino 63bd501306 Adds InitialMarginRequirement and MaintenanceMarginRequirement Properties to FutureMarginModel
These properties expose the current margin requirements that can be used to compute the number of contracts manually.
2020-01-20 22:49:03 +00:00
Martin Molinero 8f14f1bdfa Fix failing regression tests
- After https://github.com/QuantConnect/Lean/pull/4000
CoarseFineFundamentalRegressionAlgorithm started using `MarketCap`, but
this value was always 0 in existing data, so it caused undeterministic
results. Adding new data and update expected result.
- `AccumulativeInsightFrameworkAlgorithm` expected statistic were not
correct, updating.
2020-01-17 11:14:09 -03:00
Gerardo Salazar 4102c83e88 Modify and fix select regression algorithms
* OnEndOfDayRegressionAlgorithm - Since the EndTime of the hourly benchmark is during the day,
the OnEndOfDay method gets called one less time than usual. Updates statistics

* CustomUniverseWithBenchmarkRegressionAlgorithm.cs - modified algorithm so
that it works with hourly benchmark. Previously only tested for Daily benchmark

* BasicTemplateAlgorithm.py - Modified resolution to be
Resolution.Minute, just like it is in C#

* CustomDataRegressionAlgorithm.py - Remove warmup call from Initialize

* IndicatorSuiteAlgorithm.py - Adds PythonQuandl import to fix import error
2020-01-16 14:03:55 -08:00
Gerardo Salazar 66e093babb Address review - Remove SampleAssetPrices from IResultHandlers
* Changed variable names of protected members in BaseResultHandler to
match existing variable naming convention
* Changed AlgorithmRunner return type
* Remove AlgorithmResults dictionary from AlgorithmRunner
* Create AlgorithmRunnerResults container class
* Modify Relative Sampling test to accept failure cases
* Misc. updates as a result of changing AlgorithmRunner return type
2020-01-16 14:03:55 -08:00
Gerardo Salazar 61aa0d3a65 Updates regression statistics
Please note that with these changes, any algorithms that
use daily data exclusively will have incorrect statistics.
2020-01-16 14:03:54 -08:00
Gerardo Salazar 3266b1a4e5 Address Martin's review - code refactoring and cleaning
* Removed Sample[a-zA-Z]+ methods from IResultHandler definition
* Converted Sample[a-zA-Z]+ methods from public to protected
* Updated inheritors of BaseResultHandler to use new accessibility
modifiers
* Removes useless code in ResolutionSwitchingAlgorithm
2020-01-16 14:03:54 -08:00