Commit Graph

36 Commits

Author SHA1 Message Date
Martin Molinero 8d5745319e Obsoleting Securities configurations properties
> This PR is a mechanical refactor, no behaviour changed

- Obsoleting `DataNormalizationMode`. Replacing the usaged by requesting
the `SubscriptionDataConfigs` to the new `SubscriptionDataConfigService`
> Note we still need to refresh the Security.DataNormalizationMode
property.
2018-12-05 10:41:21 -03:00
Martin Molinero 7d7ad17883 Obsoleting Securities configurations properties
> This PR is a mechanical refactor, no behaviour changed

- Obsoleting `IsFillDataForward`, `Resolution`, `IsExtendedMarketHours`
`Security` configuration properties. Replacing there usages by
requesting the `SubscriptionDataConfigs` to the new
`SubscriptionDataConfigService`
2018-12-05 10:05:53 -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
Martin Molinero 7f1471000a Address reviews - Obsolete Constructors
- Adding new and obsoleting old constructors which received
SecurityInitializer as a parameter.
- Extracting the setting of Underlying security at UniverseSelection for
Option and Future chain universes.
2018-10-02 16:22:00 -03:00
Martin Molinero 2967776130 Refactor AddToUserDefinedUniverse
AddToUserDefinedUniverse will receive configuration settings as parameters.
2018-10-02 09:59:33 -03:00
Martin Molinero 4e424c4f19 Refactor UserDefinedUniverse, UniverseSelection
- Obsolete Universe.CreateSecurity, Universe.SetSecurityInitializer,
Universe.GetSubscriptionRequests(Security security, DateTime currentTimeUtc, DateTime maximumEndTimeUtc)
- Adding new GetSubscriptionRequests() overload that will receive
instance which implementes new ISubscriptionService
- UserDefinedUniverse will stop using Security.Subscriptions
2018-10-02 09:59:23 -03:00
Martin Molinero fda1183222 Fix underlying security seeding at OnEndOfStep 2018-08-15 14:54:43 -03:00
Martin Molinero 2479768b7e Fix for null reference in TimeSlice.Create when calling HandleOptionData 2018-07-23 14:43:44 -03:00
Stefano Raggi 0525b99f11 Fix multiple symbol addition in AddToUserDefinedUniverse
Fixes #1733
2018-03-21 10:34:08 +01:00
Michael Handschuh 27b34a4274 Add IAlgorithm.OnEndOfTimeStep to batch universe changes
We had an issue with the data feed picking up universe/security changes
too quickly, thereby preventing user code from being able to configure the
security object properly. Specifically, users were having an issue setting
the data normalization mode of options and underlying equity securities. By
the time the user code had set the data mode, the data feed had already
created a subscription and began processing it, so the changes were never
seen in the data feed.

This change moves all security/universe changes into pending lists and at
the end of the time step applies those changes. Security objects are still
added directly to the SecurityManager for instance access, but we delay in
adding the security to the universe and the universe to the UniverseManager.
Once added to the universe manager, an event is fired and the data feed will
process the new subscriptions.
2018-03-20 10:10:29 -04:00
Stefano Raggi 58a65bee97 Fix Forex data not received when reusing an existing internal feed
Fixes #1611
2018-03-09 23:28:23 +01:00
Michael Handschuh facbf6c9e8 Remove daily universe tick
This setting forced the data feed and algorithm threads to synchronize every day
at midnight. The changes to the regression values are due to losing the benchmark
sample at midnight
2018-02-20 12:23:12 -05:00
Michael Handschuh 0cc6a53e9c Set correct time zone for custom data in MarketHoursDatabase
Add MarketHoursDatabase.SetEntry and SetEntryAlwaysOpen. This allows runtime modification of the
market hours database which is necessary for correct custom data time zone handling.

Extracts complicate ternary logic into its own method and make it human readable.
Set the market hours entry for custom data universe subscriptions defaulting to the security's time zone.
2018-01-04 12:36:57 -05:00
Michael Handschuh b07928bd58 Properly account for market hours in alpha prediction periods
If we make a prediction for 1 day in the future, we actually mean 1 trading day.
This change updates the alpha analysis logic to take into account the security's
market hours.
2017-12-28 11:27:41 -05:00
Stefano Raggi c6aba7bfec Reduce full locking on ConcurrentDictionary objects
This PR is an attempt to reduce contention in concurrent dictionaries, replacing method calls using full locks with lock-free equivalents:

- dictionary.Count -> dictionary.Skip(0).Count()
- dictionary.Keys -> dictionary.Select(x => x.Key)
- dictionary.Values -> dictionary.Select(x => x.Value)

The most frequent usages of these methods are: CashBook, SecurityManager, UniverseManager and indirectly, SecurityPortfolioManager.

The reasons for this update are explained very clearly in this article:
https://arbel.net/2013/02/03/best-practices-for-using-concurrentdictionary/
2017-12-20 17:18:54 +01:00
Stefano Raggi de037ad4ef Universe selection with FineFundamental filtering - backtesting and live 2016-12-06 15:44:41 +01:00
Stefano Raggi b6a96c38c1 Fix benchmark subscription when same symbol added later
This change handles subscriptions when adding/removing the benchmark symbol from OnData or in universe selection.
2016-10-17 23:41:12 +02:00
Stefano Raggi c59a1776b0 Add new overload for AddUniverse with fine fundamental selection
Accepts a predefined universe instead of a coarse selection function
2016-09-20 16:07:21 +02:00
Stefano Raggi 50fe22163c Adds AddUniverse(coarse, fine) method to QCAlgorithm 2016-06-29 00:39:37 +02:00
Michael Handschuh db8592058a Add CoarseFundamentalUniverse type 2016-06-28 04:03:33 -04:00
Michael Handschuh a95b4c722a Remove remaining single sub assumptions from Algorithm projects 2016-04-12 19:06:46 -04:00
Michael Handschuh cc25950e10 Adds SubscriptionDataConfig.IsFilteredSubscription
Subscriptions can now be explicit as to whether or not a SubscriptionFilterEnumerator is to be applied.
Regular security price data subscriptions get filtered (user/market-hours)
Universe subscriptions don't get filtered (even if a subscription of equity price data, such as options underlying feeds)
2016-04-05 15:51:45 -04:00
Michael Handschuh 82823890c0 Use Universe.SecurityInitializer property 2016-03-16 19:39:42 -04:00
Michael Handschuh 12d8df887a Remove duplicate universe storage in QCAlgorithm 2016-03-16 19:39:35 -04:00
snugs 589a84224d Fixes bug market benchmark as internal feed
Updated the AddToUserDefinedUniverse method to handle adding to the Securities
collection to prevent this from happening again.
2015-12-28 11:05:26 -05:00
snugs aa6c3726aa Fixes comment on QCAlgorithm.UniverseManager 2015-12-17 18:28:41 -05:00
snugs 2b0fd189ed Renames IAlgorithm.Universes->UniverseManager 2015-12-17 17:32:13 -05:00
snugs a77950ce56 Adds UniverseDefinitions, DollarVolumeUniverseDefinitions 2015-12-17 17:17:56 -05:00
snugs ada41f7e8f Adds MinimumTimeInUniverse to UniverseSettings 2015-12-14 19:13:24 -05:00
snugs a29ebf0595 Rename SubscriptionSettings to UniverseSettings 2015-12-14 16:58:18 -05:00
snugs ae16cc8443 Adds more AddUniverse overloads for IEnumerable<string> results 2015-12-09 13:32:36 -05:00
snugs f1aafd33ec Change UserDefinedUniverse interval to one day
This causes more equity points to be taken which is the reason for the change in the regression values.
2015-12-09 13:32:33 -05:00
snugs 3a322e0877 Change IAlgorithm.Universes to use UniverseManager type 2015-12-09 13:32:29 -05:00
snugs dd4125fb42 Adds UsersDefinedUniverseAlgorithm example 2015-12-07 12:02:10 -05:00
snugs 5cee3261f4 Use string symbol in AddUniverse functions 2015-12-07 12:02:08 -05:00
snugs 796b9666db Adds QCAlgorithm.Universe for universe functions 2015-12-07 12:02:07 -05:00