> 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.
> 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`
- 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`
This commit will allow an easier `FillModel` refactor:
- Removing `ISecurityTransactionModel` and its implementations
- Merging identicall tests from `EquityTransactionModelTests`,
`ForexTransactionModelTests` and `SecurityTransactionModelTests` under
`ImmediateFillModelTests`. This was possible because the mentioned
`TransactionModels` implementations used `ImmediateFillModel`
Security instances will require private access to this value in order to
compute close profit.
NOTE: The extent of these changes for simply adding a constructor argument
insinuates that we're missing an abstraction to manage the construction of
these objects, such as a factor object for Security. This will need some
careful TLC in the near future.
- Adds `BuyingPowerModelPythonWrapper` to wrap a python class that represents a custom buying power model.
- Adds `SetBuyingPowerModel` and `SetMarginModel` to enable the seeting of custom buying power model.
The previous implementation had some issues and introduced undue
complexity. This implementation follows established patterns of
having the algorithm manager apply changes to the algorithm that
result from universe selection.
Fetches the unique set of securities that are currently members of at least one
universe. This is the set of active/tradable securities that are currently receiving
data. It does not guarantee that we've received pricing data, but does guarantee that
the security is a member of the universe and we've minimally added a subscription for
data and have not yet removed that subscription (although it is possible for the sub
to end before the security is removed -- very rare/unlikely scenario though).
The Security.Fundamentals property returns a merged view of the coarse
and fine data for a security. If a fine universe is not used, this data
is not populated because the merging happens after we read the fine data.
This change aims to reduce confusion by making the coarse values available
even if fine data isn't used.
NOTE: Fine properties will be null and cause null reference exceptions if
accessed. This is by design so that algorithms error when trying to access
fine data that wasn't requested.
Creates a python wrapper for volatility models created in python algorithms and adds a method to the Security object to set such models.
Adds an algorithm to show how volatility models can be implemented.
These properties are used frequently and should only be updated when adding a new subscription:
- Resolution
- IsFillDataForward
- IsExtendedMarketHours
This property can also be updated by SetDataNormalizationMode:
- DataNormalizationMode
This method is a convient way to check if the security has a subscription that represents custom data. It returns true if the security contains at least one subscription that represents custom data
Implements IPriceVariationModel interface which takes the security object and returns a decimal variation
Implemets SecurityVariationModel class: default implementation of IPriceVariationModel that returns a fixed value (read from symbol-properties-database) for decimal variation
Implemets EquityVariationModel class: implementaion of IPriceVariationModel that returns a decimal variation as a function of equity price
Implemets AdjustedPriceVariationModel class: implementaion of IPriceVariationModel that returns zero
Adds unit test
- 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.
On LiveTradingResultHandler.ProcessSynchronousEvents, realtime price was assigned to Security.Cache._lastData.Value and that assignment did not change Security.Price used to update Portfolio statistics (eg. TotalPortfolioValue).
For Forex securities, adds Portfolio.CashBook updates with realtime price.
When this was originally written, we were assuming one subscription per security.
This removes that assumption and tries to find subscriptions matching the request