The term 'alpha' is used to describe the entire algorithm. Therefore, 'alpha'
produces insights. From this we have things like IAlphaModel, which is the model
defining how insights are produced. We have IAlphaHandler, which defines how the
insights from a single 'alpha' (the algorithm) are managed, analyzed, and stored.
Types closer to the individual prediction level, such as InsightDirection, or
InsightScore relate directly to exactly 1 insight. The distinction between the
two became more clear as we developed the insights API, and from that effort it
was decided to harmonize alpha/insight terminology across the various QC systems.
When creating time slices for warmup history requests, data for security types with multiple tick types (Crypto, Futures, Options) were being matched to the configuration for the first subscription, instead of using the correct data type.
For example, with the Crypto security type, historical data of type TradeBar was passed to TimeSlice.Create with a SubscriptionDataConfig object for the QuoteBar data type.
Instead of tracking just the security's symbol in the cash object we're now
maintaining a reference to the actual security object. This removes the need
to worry about cash update data in the time slice create method.
The logic for margin calls was previously split between SecurityPortfolioManager.ScanForMarginCall and IMarginCallModel methods, now it is entirely contained within margin call model implementations.
One of the margin call model tests was also testing against the Null model, it has been updated to use the DefaultMarginCallModel.
Using the newly added split warnings, submit market on close order at the last
possible moment to liquidate option contract holdings. After the liquidate order
has been submitted, we now mark the option contract as non-tradable, thereby
preventing any further trading in post-split option contracts.
This is added because we currently do not properly support option contract splits.
To properly support, we'll need some extra data sources defining how the contracts
are rewritten due to the split event. This data is freely available via the OCC in
pdf format.
This method was not removing the symbol dictionary entry when removing the last subscription, allowing the collection to grow excessively over time (especially with universe selection algorithms).
This PR also includes a few minor performance fixes.
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/
Provides estimates of alpha value as well as performs online computations of
alpha scores and other KPIs.
Sends alpha stats to result handler
Update live result with framework flag
IAlgorithm.FrameworkOnData is used to pulse models with new data each time step
IAlgorithm.FrameworkOnSecuritiesChanged is used to pulse models with security changes
These two functions need to be separate to ensure that if we add an indicator during
the securities changed event that it will get the data from the current time step.
This forces us to call the securities changed event before we invoke the consolidators
for the current time step.
The message for short option order events at expiration was "Automatic option assignment on expiration" for both ITM and OTM. It has now been corrected to "Option expiration" for OTM short options.
The same message is now also being reported in QCAlgorithm.OnAssignmentOrderEvent instead of the generic "Option Assignment" message.
This check ensures that the data is on the subscribed interval.
A bug was found where daily data with a different data tz and
exchange tz was not being pumped into the consolidator. This is
because we were rounding a time such as 20:00 by 1-day. If we
convert the time to the data time zone, it becomes 00:00 and
then the rounding operation returns the same input value which
signals that we should use this data point to update consolidtors.
If backtesting, we need to check if there are realtime events in the past
which didn't fire because at the scheduled times there was no data (i.e. markets closed) and fire them with the correct date/time.
In live mode, no changes are needed.
1. Made sure we treat properly option expiration dates before Feb 2015 and after. Added tests.
2. Refactored expiration delisting, assignments/option exercise to happen in the end of the date, not MOC orders in the beginning of the day. Regression test.
3. Refactored option exercise model to generate proper fills on assignments/option. Those fills are reflected correctly in margins, in stats and correspond to IB model. Still need to run IB real-life live tests.
4. Refactored option symbol related functions into separate module (OptionSymbol.cs)
5. Made sure OnAssignmentEvent arrived to the user algo in regression test. Do we need OnExercise event? Not sure.
6. Tested end-to-end Ray's current code (covered call strat) to see short option legs expire worthless, and stats updated.
* Swallow bug in QuoteBar.Reader() if an error is thrown during parsing
Following the pattern in TradeBar.Reader(), the QuoteBar.Reader() method will now swallow a parsing error, log the error message and line number and then proced to return a default instance of Quotebar. The current implementation of QuoteBar.Reader() will stop the executation of the program if a parsing error is found. Given the amount of data Lean may parse during the execuation of an algorithm, it is better to be resiliant to small errors in the data than to stop the execuation of the program because of a malformated line of csv.
* Added QuoteBar.Reader tests
* Minor changes to config.json; back to proper defaults
Remove QLLib.NET reference
Added date to QuoteBar.Reader() error message
* Incorrect timezone specified on consolidator filter