Commit Graph

978 Commits

Author SHA1 Message Date
Gerardo Salazar dfee825ef6 Refactors sampling strategy in AlgorithmManager loop
* Refactors AlgorithmManager loop
* Refactors StatisticsBuilder methods and strategy for series alignment
* Move sampling logic to the corresponding IResultHandler
* Changes benchmark resolution to Resolution.Hour
* Modifies IResultHandler to enable external sampling
* Adds BacktestResultHandler unit tests
* Adds ResolutionSwitchingAlgorithm to test misalignment
* Adds support to AlgorithmRunner to store algorithm IResultHandler

Warning: this commit breaks accurate calculations for algorithms that
only make use of `Daily` resolution data. Previously, because
the benchmark was added in Daily resolution in backtesting, any
algorithm that only made use of daily data would have an accurate
calculation for beta and various other statistics.

These changes serve to fix the statistics calculations of non-daily
resolution algorithms, with daily resolution to be revisited at a later
time.
2020-01-16 14:03:54 -08:00
Jared b95973cf69 Merge pull request #3940 from wardjm/feature-accumulative-model
Feature accumulative model
2020-01-14 13:57:10 -08:00
Martin Molinero 6cd12abff4 Remove duplicate EndOfDayEvent for Symbols
- Remove duplicate EndOfDayEvent for Symbols added with `AddData` calls
- Adding regression test
2020-01-14 18:06:52 -03:00
AlexCatarino 76c70f1ea2 Adds MarketCap Member to FineFundamental Class
Adds `MarketCap` member to `FineFundamental` class that represents the aggregate market value of a company represented in dollar amount.

Changes `CoarseFineFundamentalRegressionAlgorithm` (C# and Python) to select securities based in its market capitalization. Same result as selecting by P/E ratio.
2020-01-04 00:33:29 +00:00
Martin Molinero 87bc03d71e Address reviews
- When BacktestNodePacket has the inital `CashAmount` set we will clear
all existing cash amounts and set the account currency
- Adding more unit tests
2019-12-31 13:25:58 -03:00
Jeffrey Ward a296d346a4 Pull request fixes. 2019-12-20 18:01:35 -05:00
Michael Handschuh d6f1dd8630 Add ObjectStoreExampleAlgorithm
Shows how to read/save object store entires. In this case, it shows a
use case where a potentially time intensive operation's result is saved
in the object store and on subsequent runs the result is pulled directly
from the object store to enable faster run times
2019-12-18 08:46:14 -05:00
Martin-Molinero ca5e8a4291 Merge pull request #3917 from RohanTalip/RT/minor-comment-fixes-OBA
Minor typo fixes to comments in OpeningBreakoutAlgorithm.
2019-12-16 10:57:57 -03:00
Rohan Talip 6307fb142a Minor fixes to comments in MultipleSymbolConsolidationAlgorithm. 2019-12-14 17:12:08 -08:00
Rohan Talip f421270f39 Minor typo fixes to comments in OpeningBreakoutAlgorithm. 2019-12-14 17:11:33 -08:00
Martin Molinero 491cae2c1d Fix ProcessSplitSymbols exception
- `UserDefinedUniverse` will no longer be removed as a data subscription.
- When `algorithm.AddData()` is called a universe selection data point
will be added to the `UserDefinedUniverse` subscription to trigger
selection and add the requested data.
- `DataManager` will make sure an active subscriptions
`SubscriptionDataConfig` will be present in the configuration collection
- Adding unit and regression tests
2019-12-12 17:14:47 -03:00
Jared ec4f714799 Merge pull request #3862 from gsalaz98/feature-3775-add-benzinga-custom-data
Implements Benzinga Custom Data
2019-11-27 15:39:22 -08:00
Gerardo Salazar 8c16ffde8d Address review - Fixes bug where tags were not being deserialized
* Write files by `UpdatedAt` date instead of the `CreatedAt` date
* Added ability to append to compressed files if file does not exist
* Cleaned up code as per review
* misc. documentation changes
2019-11-25 14:32:45 -08:00
Martin Molinero d34a6f4a67 Add Constituent basic template algorithm 2019-11-22 11:39:03 -03:00
Gerardo Salazar a3c96059f7 Address review - Remove RSS converter and only parse API responses
* RSS converter now lives at: https://gist.github.com/gsalaz98/b87992cd5a5a214d01c63dbbefbbf12c
* Removed BenzingaNewsFactory as it is no longer needed
* Cleaned up code as per review to make this more maintainable
* Included new documentation
* Filter articles with no Symbols from being written
* General code improvements (duplication reduction, etc.)
2019-11-20 14:47:32 -08:00
Martin Molinero 394130e58a Revert qc500 constituent - Fix data order
- Reverting qc500 constituent universe
- Fix data parsing order, based on the constituent universe data already
generated
2019-11-20 19:47:19 -03:00
Martin Molinero fca1b3db45 Revert previous changes. Add unit tests
- Only generate files for week days
2019-11-20 17:32:14 -03:00
Martin Molinero c95955025f Adjust ConstituentsUniverseData dates for backtesting 2019-11-20 17:31:46 -03:00
Martin Molinero b75569ab61 Address reviews
- Addressing reviews
- Rebasing
- Reducing unit test time length
2019-11-20 17:22:27 -03:00
Martin Molinero 70358482d4 Add ConstituentsUniverseDataGenerator algorithm
- Fix `ToString` implementation of the `SecurityIdentifier.None`. Adding
unit test
2019-11-20 17:22:27 -03:00
Martin Molinero 81974b3fb3 Address reviews 2019-11-20 17:20:33 -03:00
Martin Molinero e2c129a311 Improved version
- Renaming `PreSelected` to `Constituents`
- Adding base `ConstituentsUniverse`
- Adding Py and C# regression algorithm
- Fixing bug in `UniverseSelection`, it wasn't removing pending to be
removed securities unless the universe selection changed
- Adding test data
2019-11-20 17:16:44 -03:00
Martin Molinero eee4c7cb79 Adding PreSelected data types
- Adding new custom data `PreSelected` type and `PreSelectedQC500` using
it.
- Adding 1 day worth of pre selected data for the QC500
2019-11-20 16:58:43 -03:00
Gerardo Salazar e4789e0b23 Implement Benzinga News Downloader
* Make Benzinga News Converter more efficient (and cleaner!)
* Implement JSON converter for serialization/deserialization process
* Fix bug where duplicate symbols would be added to news.Symbols
* Modify algorithm strategies
2019-11-19 10:28:48 -08:00
Gerardo Salazar e6a9a3a4d1 Address review Mike's review and Fix timezone issues in BenzingaNews
* Cleaned up code inside BenzingaDataConverter
* Added more documentation to potentially confusing bits around the code

Previously, we would be storing Benzinga time in local time (i.e. with
about a 7hr offset from UTC since I'm in Pacific Time). But now, we
instruct Json.NET to serialize and deserialize dates as UTC.

Additionally, because the data resolution was not set to `Second`,
EndTime would be rounded down with `Time` to the closest minute. We
fixed that by specifying that the data is in `Second` resolution.
2019-11-19 10:28:48 -08:00
Gerardo Salazar bc1f608dce Address review - Code cleanup
* Makes BenzingaNewsAlgorithm throw a hard error if the Symbol is not
found inside the BenzingaNews object in OnData
2019-11-13 13:38:37 -08:00
Gerardo Salazar 4a95c36a96 Address Jared's review: Update example algorithms and property types 2019-11-13 13:38:36 -08:00
Gerardo Salazar 629de49b10 Implement Benzinga custom data as ToolBox application and BaseData class 2019-11-13 13:38:36 -08:00
Martin Molinero ec7a8fa906 Bump PythonNet to 1.0.5.29 2019-11-13 17:33:32 -03:00
Martin Molinero c6ab54f6d2 Bump PythonNet to 1.0.5.28 2019-11-12 16:06:55 -03:00
Jared bd0613f8cb Merge pull request #3804 from Martin-Molinero/bug-3327-invalid-initial-symbol-changed-event
Fix invalid initial SymbolChanged event
2019-11-08 08:07:34 -08:00
Jared 63076f4a18 Merge branch 'master' into bug-3740-scheduled-universe-selection-model-time-zone 2019-11-08 07:56:41 -08:00
Jared 83c9e78c2c Merge pull request #3782 from QuantConnect/bug-3781-setholdings-market-on-open-orders
SetHoldings will check existing OnMarketOpen orders
2019-11-08 07:49:52 -08:00
AlexCatarino 3fca51e314 Addresses Peer-Review 2019-11-07 22:26:46 +00:00
AlexCatarino fb76003048 Adds New Static Members to LiquidETFUniverse
New members represent the different ETF categories. Each one has a `List<Symbol>` for Long and Inverse ETFs.
2019-11-07 17:01:15 +00:00
Martin Molinero 86ffbcb3f9 Fix invalid initial SymbolChanged event
- EventProvider will receive start date during initialization, this will
be used by the `MappingEventProvider` to correctly set current mapped
symbol
- Adding unit test, updating existing regression test
2019-11-06 14:41:12 -03:00
Martin Molinero 2812ad6f8e Address reviews. Improvement
- Improve mechanism to fetch open orders quantity, based on method used
by the `ImmediateExecutionModel`
- Adding unit test
2019-11-06 12:14:10 -03:00
Martin Molinero 9b507bbf34 Fix SetHoldings OnMarketOpen orders
- `SetHoldings` will take `OnMarketOpen` ordes into account when
determining order quantity
- Adding new regression test. Updating existing algorithms which
suffered of the issue
- Adding a performance improvement, will avoid margin and portfolio
calculations for MarketOnOpen orders that wont be able to fill
2019-11-05 21:05:49 -03:00
Martin Molinero 2f9814f2f9 Add SetHoldings for collection of targets
- Adding `SetHoldings` implemenetation for a collection of portfolio
targets
- Adding regression test
- Some performance improvements
2019-11-05 13:47:42 -03:00
Martin Molinero 68ad2f51b6 Address reviews
- Replacing `BaseData.AdjustResolution` for `DefaultResolution` and
`SupportedResolutions`
- Making `Resolution` nullable for `Algorithm.AddData` methods
- The `ISubscriptionDataConfigService` will set the default resolution
if none was provided and assert it is supported
- Fix bug with `PythonData` `IsSparseData` and `RequiresMapping`
resolution
2019-11-04 20:42:30 -03:00
Martin Molinero 1d43dcd601 Add BaseData.AdjustResolution
- Adding `BaseData.AdjustResolution()` that should return a valid
resolution for the given data and security type.
This allows us to set a limitation which is useful to avoid invalid data
requests or unnecessary fill forward situations. The user will be
notified through a console message.
- Adding unit and regression test
- Updating example algorithms custom data resolution
- Some performance improvements. Wont change console color if
`SelectedOptimization` is defined
2019-11-04 20:38:26 -03:00
Martin Molinero 98ae5cdd4e Fix TimeRules time zone issues
- `ITimeRules` are expected to yield time date in UTC, fixing `Noon`,
`Midnight` and `Every`
- `ScheduledUniverseSelectionModel` will use UTC time zone by default
since that is the default expected time zone `ITimeRule` provides
- Adding regression test
2019-11-04 15:34:57 -03:00
Martin Molinero 62753b5425 Adding Security.NullLeverage
- Adding `Security.NullLeverage` value to determine when the
`SecurityInitializer` leverage should be used or not
- Adding regression algorithm which reproduces the issue
2019-10-30 20:03:37 -03:00
Martin-Molinero aaf81ef467 Merge pull request #3768 from QuantConnect/bug-3763-margin-remaining
Fix maintenance margin calculation
2019-10-30 13:04:24 -03:00
AlexCatarino 49701657fb Use Train Helper Method Instead of Schedule.TrainingNow 2019-10-28 18:13:59 +00:00
AlexCatarino 5bb28b44a8 Adds Examples for Train Feature
- Adds Python version of `TrainingInitializeRegressionAlgorithm`;
- Adds C# version of `TrainingExampleAlgorithm`;
- Removes `TrainingScheduledRegressionAlgorithm`.
2019-10-28 17:49:53 +00:00
Martin Molinero 6719109ed1 Fix maintenance margin calculation
- Maintenance Margin will be calculated using current securities Value
and not acquisition price.
- Adding unit and regression tests
2019-10-24 20:52:28 -03:00
Jared ee07baa0c8 Merge pull request #3758 from AlexCatarino/feature-3757-ewpcm-refresh
Extends EWPCM Rebalancing Options
2019-10-23 17:45:22 -07:00
AlexCatarino 725889198c Adds EWPCM Usage Examples in BasicTemplateFrameworkAlgorithm 2019-10-24 01:19:35 +01:00
Gerardo Salazar 3aadf5635b Convert FRED properties to fields
* Add example FRED usage
2019-10-23 16:59:37 -07:00