Commit Graph

24 Commits

Author SHA1 Message Date
Martin Molinero 1581801f9b Address reviews 2019-06-11 12:01:57 -03:00
Martin Molinero ec1d410907 Performance improvements
- `SecurityIdentifier` will calculate `StrikePrice` just once. Replacing
`!=` for a direct call to `Equals()` preventing unnecessary checks.
- Slightly improving Linq queries at `OptionFilterUniverse`
- Replace `OpenReader().CopyTo` for `Extract(stream)` avoids copying the
data twice.
- Replace `DateTime.Now` for `DateTime.UtcNow`
2019-06-10 22:40:19 -03:00
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
Martin Molinero c39638668c Overall performance improvements
- `FactorFile` will keep an ordered reversed list with the dates.
Calling `Reverse()` on the `SortedList` is expensive.
- `MapFiles` will keep first and last date, so we don't need to call
`First()` and `Last()` multiple times.
- `Liquidate` will go through all the algorithms securities only if
necessary
- `TradeBar` parsing will not call `new T` for pure `TradeBar` which is
expensive
- Removing `Lazy` hash code and security type for the
`SecurityIdentifier`, replacing for direct initialization. Accessing the
`Lazy` value adds an overhead.
- Replacing `Enum` to string for hardcoded switch statement. `Enum.ToString` is expensive.
- `DataManager` will be lazy for counting the subscriptions for
determining if its above the limit
- Adding `AlgorithmSecurityValuesProvider.GetAllValues()`, removes the
need to fetch all the security keys twice.
- During universe selection, will not try to re add already added symbol
2019-04-22 10:47:27 -03:00
Martin Molinero 9865fe63e0 Improve initialization speed
- `Composer` will load `QuantConnect` assemblies and keep the `Types`
which is much faster than using previous wway of getting types that uses
reflexion.
- Adding static `MapFileProvider` improving calls to
`QuantConnect.commo.Symbol.Create` or `Addxxx` which created a new
instance every time
- `Engine.StackExceptionInterpreter` will be lazy initialized, since it
takes some time because it goes through all assemblies
- Moving `MarketHoursDataBase` initialization earlier and in a `Task`
since it takes some time.
2019-04-12 21:27:56 -03:00
Martin Molinero b7930aff67 Performance improvements
- Using `Aggregate(lambda)` vs `Sum(lambda)` since the later is slower
due to performing an extra `Select`
- For `QCAlgorithm.Framework.OnFrameworkData()` will avoid calling
`ToArray()` on empty `Enumerables` due to its cost * the number of
calls. If the `Enumerable` is the empty instance, which is static,
will create a new empty array and return it instead.
- Replacing `SecurityIdentifier` `SecurityType` and `GetHashCode`
implementations for `Lazy` versions, that are performed just once, since
these values do not change and are used multiple times.
- For the different `DataDictionary<T>` implementations adding `this[
Symbol] get; set` since existing overload `this [string]` produces an
extra round operations `Symbol->string->Symbol` with a significant
impact.
- Adding `PortfolioTargetCollection.AddRange()` overload using an array
to avoid unnecessary convertions.
2019-04-11 19:01:27 -03:00
Michael Handschuh 8dae77d94a Provide optional arg to avoid using Composer for IMapFileProvider
The composer takes forever and when iterating on unit tests quickly
becomes a drag. This allows a unit test to provide its own implementation
so it doesn't need to do the work
2018-07-20 19:32:50 -04:00
Stefano Raggi 5655143fdb Speed up SecurityIdentifier parsing from string
With this update there is a 3x speedup in SecurityIdentifier.TryParse.
This method is heavily used in coarse universe selection, when parsing coarse data files.
2017-12-19 21:57:25 +01:00
12112 83fdf9c386 crypto wip 2017-07-14 16:53:42 +01:00
Stefano Raggi 1b4047c4c0 Fix bug in parsing SecurityIdentifier
This bug was introduced in PR #934
2017-05-24 02:01:47 +02:00
Stefano Raggi df470a452e Log SecurityIdentifier parsing errors 2017-05-22 16:40:25 +02:00
Stefano Raggi e1710e9031 Remove BaseData underlying symbol from Future symbol 2017-04-17 13:52:23 +02:00
quant1729 e20f33f5cd Updated InvalidSymbolCharacter collection initialization in SecurityIdentifier class to be compatible with C# <4.5. 2017-01-16 10:48:21 +08:00
quant1729 bfc4c49b7c Added IsCanonical() to Symbol class 2016-12-12 20:51:53 +01:00
quant1729 9b704434a3 Improved performance of options converter on Ubuntu -- ~25 times 2016-12-08 15:59:37 +01:00
quant1729 7c8013b49c -Added futures support to Symbol, SID
-Loading IQFeed futures universe
2016-09-26 17:16:22 +02:00
quant1729 dd72878d2c Implementing futures support. Future, FutureCache, Futures Chain, Futures Universe classes and more 2016-09-26 13:56:02 +02:00
Michael Handschuh bf69db0551 Changes, issues with BTOA 2016-04-20 12:15:37 -04:00
Michael Handschuh bc522062d9 Check for invalid characters '|' and ' ' 2016-04-20 12:15:36 -04:00
snugs b1b7bdfb60 Changes to support IFactorFileProvider impls 2015-12-16 18:45:22 -05:00
snugs 04bda544bb SecurityIdentifier - grab config value once via static context 2015-12-07 12:02:10 -05:00
Stefano Raggi 1e7d8f47ee Fixed XML comments compiler warnings 2015-12-06 16:26:48 +01:00
snugs b71ca0a25a Move market maps to the Market class 2015-11-24 15:09:48 -05:00
snugs 188fb807e7 Move SecurityIdentifier to QuantConnect namespace 2015-11-19 20:46:50 -05:00