Commit Graph

23 Commits

Author SHA1 Message Date
Martin Molinero 08b72c5907 Overall performance improvements v2
- Adding `LazyToUpper()` implementation, that will avoid the call to
`ToUpper` if the string is already upper.
- Reduce the timezone conversions at `Time.EachTradeableDayInTimeZone`
- `TotalPortfolioValue` will iterate over all securities once
- Adding new `SecurityIdentifier` cache, significant impact for
algorithms using coarse/fine data
2019-06-05 17:06:59 -03:00
Stefano Raggi 7d730f8db7 Improve timing of data available events for LiveSynchronizer 2019-04-29 15:26:50 +02:00
Stefano Raggi 8d43ef5b6a Reduce CPU usage in live synchronizer 2019-04-29 15:16:21 +02:00
Martin Molinero 251071ee73 Remove Security from Subscription
- Removing unneeded `CashBook` instance to create a new `TimeSlice`
- Adding new `TimeSliceFactory`, an instance base class that will
provide methods to create a new `TimeSlice`. Will own the `DateTimeZone`
property.
- Adding new `ISecurityPrice` and `IOptionPrice` that will provide a
reduced interface for accessing price properties and methods used when
creating a new `TimeSlice`
2018-11-14 18:28:18 -03:00
Martin Molinero 70b370ef25 Addressing reviews
- Removing `Subscription.HasSubscriptionRequests`
2018-11-08 13:02:12 -03:00
Martin Molinero ee2dc32710 Subscriptions will track Universe requests
- The class `Subscription` will internally track each `Universe`
`SubscriptionRequest` added or removed
- Adding regression test in which two different `Universe` request the
same `SubscriptionDataConfig` and one of them removes/adds it in a
toggle fashion (fails on current master)
- `UniverseSelection` pending removals will also be tracked by
`Universe`
- `UniverseDecorator` will overwrite the `Universe` member of
`SubscriptionsRequests` at `GetSubscriptionRequests()`. This is due to
`this != this,Universe`
- Adding `Subscription` unit tests covering expected behavior
- Extracting pending removals logic from `UniverseSelection` class into
a new helper class `PendingRemovalsManager`. This new class will keep
track of the `universes` requesting to remove a security. Adding unit tests
2018-11-08 13:02:11 -03:00
Michael Handschuh 5d69b2a5e2 Remove disposed security data from TimeSlice
If we pull data and on the same time step that security gets removed,
we can still get that data in OnData(Slice) even though it was removed.
This change filters out removed securities by tracking a reference to
the subscription's disposed flag. Another change was made to wait until
the end of the time step to dispose of subscriptions.

Add IDataFeed.GetSubscription(SubscriptionDataConfig)
2018-05-24 17:40:29 -04:00
Michael Handschuh cee7ff7766 Move clone and tz conversion operations to DF thread
A large percentage of synchronization time is spent performing time zone conversions.
Previously, it was possible that we may compute the same tz conversion multiple times
on the same piece of data until it's emitted. This change moves the time zone conversion
logic onto the data feed thread right before it puts the data into enqueueable enumerator.
In addition, we're not performing the clone operation at the same moment. This removes
unnecessary computation while moving the necessary computation to the data feed thread to
lighten the load on the synchronization/algorithm thread.
2018-02-13 15:59:56 -05:00
Michael Handschuh 141ff52d1e Add Subscription.ToString override
Makes debugging much easier when we can easily see what a subscription is for
2018-02-12 14:32:04 -05:00
Michael dfde3aaf7f Fixes documentation on Subscription.TimeZone
This is clearly the exchange time zone by looking at the implementation.
This change remedies the discrepancy between the xml comment and the implementation.
2018-02-01 14:26:52 -05:00
Michael Handschuh 70a56ab8bc Adds subscription configuration to Subscription ctor 2016-04-12 19:06:51 -04:00
snugs a470fec863 Mark Subscription.EndOfStream=true on Dispose 2015-12-07 12:02:06 -05:00
snugs 1546f25898 Review usages of config.TimeZone 2015-12-01 11:30:36 -05:00
snugs 6f15d4e569 Rename SubDataConfig.TimeZone to DataTimeZone
Also reviewed usages to check for data time zone vs exchange time zone
2015-11-30 18:43:41 -05:00
snugs a56a8bde81 Fixes memory leak in LiveTradingDataFeed
The issue here seems to be that the TradeBarBuilderEnumerator was able to grow unbounded in some circumstances.
2015-10-28 12:57:25 -04:00
snugs c2c36e89d4 Make Universe control its own membership
This had happy side effect of removing the Subscription.IsUserDefined flag
2015-10-21 13:05:11 -04:00
snugs 68676a3dab Change IUniverse -> abstract Universe class 2015-10-21 13:05:10 -04:00
snugs 28a39f2504 Use single ctor for Subscription
In preparation for everyone having a universe, for now, current
behavior/values are maintained.
2015-10-21 13:05:10 -04:00
snugs cd27c2833b Rewrites the LiveTradingDataFeed to be enumerator centric
This refactor was an effort to bring into line the various concepts between the
FileSystemDataFeed and the LiveTradingDataFeed. The former works using enumerators
and a time sync loop that uses the concept of a frontier to decide when to 'pull-off'
data that's at or before the frontier. This makes the feed uninterested in how the
data (via enumerators) is provided, and only concerns itself with things at the
subscription level, that is, time syncing and universe selection invocation.

These concepts were brought over to the LiveTradingDataFeed with some modification.
This change heavily uses object composition of enumerators to handle the various
concerns that were previously within the enumerator loops in the LiveTradingDataFeed.

Some enumerator types that help accomplish these concerns:

	FastForwardEnumerator 		- fast forwards an enumerator that contains old data
	RateLimitEnumerator			- prevents an enumerator from being invoked too frequently
	TradeBarBuilderEnumerator 	- Builds trade bars from tick data
	FrontierAwareEnumerator		- Emits the underlying when the frontier is on or after Current
	EnqueableEnumerator			- Acts as a liason between a push/pull system using a queue
2015-10-15 11:10:54 -04:00
snugs 471a137ff6 Add Universe to the base Subscription
Provides two ctors, one for universe subscriptions and one for normal subscriptions
2015-10-07 12:54:31 -04:00
snugs e919d99053 Updated universe selection to be more generic
Includes changing FundamentalType to UniverseSelectionType
IDataFeed.Fundamental -> IDataFeed.UniverseSelection
FundamentalEventArgs -> UniverseSelectionEventArgs

All in preparation for another type of selection, hand-picked
2015-10-07 12:54:25 -04:00
snugs 5db66b6551 Adds Start/End to subscription 2015-08-25 17:48:04 -04:00
snugs 844a040be5 Initial impl of coarse universe selection
Adds concept of Subscription to contain everything a data feed needs in order to process  single data feed item
Moves preparation of all data to data feed thread, algo thread receives data in format it needs
QCAlgorithm.SetUniverse( func ) allows selection based on market/symbol/dollar volume/price
Remove laziness from Slice as optimization, no order by in real time handler
2015-08-06 17:52:23 -04:00