This update reverts PR #664 and includes an improved filtering solution.
It prevents consolidators and indicators from receiving inputs at a resolution higher than the data subscription resolution, typically fill-forward bars.
Volume-based indicators and consolidators will now be calculated correctly with fill-forward data.
It also fixes the RegressionAlgorithm failing test.
Added support for history requirements, exposed by vol models. AM processes requirements.
Added new volatility model - standard deviation of returns - default vol model. Compared its results with publicly available.
Refactored option pricing engine to support optimal approximation calculations.
Added basic greeks approximation in case they are not available in QL. Tests.
Updated BasicTemplateOptionHistoryAlgorithm to print greeks.
Currently, most consolidators rely on receiving a piece of data after
the consolidation period before firing the consolidated event. This
introduces a lag in the results. We've mostly gotten around this for
the most common case through usage of the IdentityConsolidator.
The issue arises when considering fill forward behavior and subscriptions
with different resolutions.
Consider a Minute subscription a Daily subscription. Default behavior will
fill forward that daily bar on every minute. If your indicator is based on
the IdentityConsolidator, then it will receive the same price update for
each minute the security trades that day.
By scanning the consolidators based on time, the consolidator is able to
determine that it is indeed time for it to emit a new consolidated bar.
This removes the need for the IdentityConsolidator while also fixing the
aforementioned bug.
- Updated IB fee model to support option exercise
- Added support for splits for options. Not tested on real data yet.
- Added option exercise functionality for long positions. Unit Tests. Not tested on real data yet.
- Added option assignment functionality for short positions. Assignment event. Unit Tests.
- Added basic option assignment simulator for backtesting brokerage. Simulates assignments for deep ITM short positions close to expiration. Unit Tests.
Reverts commit f4abe9ce
Now delisted securities are removed using IAlgorithm.RemoveSecurity that properly removes a security from a SecurityManager: keeps it at the Portfolio, but remove it from the user universe, unsubscribing to the datafeed in the process.
A security must have a single normalization mode, any added subscriptions will need to be forced to the current mode and when updating the mode it must be done to all... this should probably be a 'locked' property as well since changing it mid execution can lead to unexpected behavior
IResultHandler has an Initialize method which accepts a job, so all instances should know
they job (algo id, proj id, user id) and so these methods shouldn't be requiring the field
Many places in the code used Log.Error(err.Message) or equivalent which
strips out all the really useful information, such as the stack trace
and inner exceptions. Using Log.Error(exception) is the correct way to
log an error as it will correctly write all the message details, also,
by passing the full Exception object we can improve the logging in this
one place and all call sites will automatically benefit from the improvements
The command queue provides external messaging into the algorithm.
It yields ICommand instances which are runnable against the algorithm.
This allows a user to exercise some control/change over the algorithm's
behavior while it's still running.
To show the pattern, I've implemented the Order, Liquidate, and Quit commands
The first emit from the live bridge can have more data than usual since
the first emit is dependent on when the Run method is actually called.
Inspect all data and make sure it's after the handover time
Cases can arise such that the data feed's first iteration includes data
for about 50ms before the feed time sync loop is actually started, so give
a 100ms buffer on the handoff time check