- `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`
- Removing OrderFeeParameters.AccountCurrency. Where required replacing
for constructor parameter defaulting to USD.
- Updating IB fee model to use to correct fee currency
- `CashBook[NullCurrency] { get; }` will throw an exception
- Revert `Currencies.USD` changes in user facing algorithms
- Improve some documentation
- Revert some format changes
- Adding more asserts for regression test
- Adding new regression tests using a custom fee model which returns
`OrderFee.Zero`
- Adding a non-usd account currency test to the cash book tests
- Adding some unit tests for `NullCurrency` and `OrderFee.Zero`
- Removing `AccountCurrency` from `Cash` and `Brokerage` classes.
`ICurrencyConverter` will now provide the `AccountCurrency`
- Adding new static `OrderFee.Zero` which will return a 0 order fee in
`NullCurrency`
- Adding static `Currencies.USD` value, replacing all "USD".
- Addin new static `Currencies.NullCurrency`
- Updating Bitfinex `FeeModel` so it return fees in quote currency.
Adding unit tests
- Replacing `decimal` for `OrderFee` at the `OrderEvent`.
- Adding `FeeModelNotUsingAccountCurrency` regression test
- Adding unit tests for `CashBuyingPowerModel` and `SecurityMarginModel`
with non account currency fees
- Refactoring `IFeeModel`. *This is a breaking change* for implementations
inheriting directly from the interface. Deleting old and adding a new method
`OrderFee GetOrderFee(OrderFeeParameters parameters)` that will use a parameter
and a result object.
- Refactoring `CashAmount` so it does not embed a `ICurrencyConverter`
instance.
- Updating unit tests
- The `Security.QuoteCurrency`, a `Cash` instance, will provide access
to the `AccountCurrency` as a property.
- Will maintain backwards compatibility with old python custom
FeeModels, Adding unit test.
> Note that for now, consumers will ignore the currency, as before, and
directly consume the amount
- `BuyingPowerModel.GetInitialMarginRequiredForOrder` will now receive
the new `InitialMarginRequiredForOrderParameters` object containing an
`ICurrencyConverter` instance.
- 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`
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.
Move delisting date estimation to the constructor
Using `MarketHoursDatabase` for option delisting date estimation instead USHolidays
Adding file header.
Regression algorithm added.
Use of `ExchangeHours.IsDateOpen` instead `ExchangeHours.IsDateOpen.Holidays`.
Extract values from `symbol.ID` into a local variable.
Improved Regression test
These two helper methods makes it simpler to select options with a specific right. This selection could be done with a Linq expression, but there is no equivalent for python. It is more user friendly to add those helper than adding a `PyObject` overload to `Contracts` method.
Use `PutsOnly` method in `BasicTemplateOptionsFrameworkAlgorithm`.
Sometimes we want to make decisions based on strike prices but still only
want the filter to be executed at market open and run once per day. Without
this change there was no way to force this behavior. Also, using this
method can greatly improve system performance by not running the contract
filter on every time step.
Without this helpers users would need to call .
We provide a helper for strikes only but not expirations only. This change adds the
missing helper. A similar method is also available for futures.
OptionFilterUniverse was lacking a means of explicitly setting the set of
contract symbols to be selected, which means algorithms had to use the
various helper methods but were unable to define their own selection function
for the contract universe. This change adds two methods, one to epxlicitly
set the contracts to be selected and another that mirrors the way universe
selection works, by providing a function that accepts the full set of contract
symbols and returns the filtered set of contract symbols. This enables LINQ
filtering of the contract universe.
According to the MSDN documentation for Array.BinarySearch, the value of our index variable after taking the bitwise complement should be between zero and count-1.
Provides an abstraction for securities w/ an underlying security.
This is intended to pair with IDerivativeSecurityFilter.
This enables othe code to not need to bind and look for specific
security types in order to access the Underlying property.
GetInitialMarginRequiredForOrder and GetInitialMarginRequirement methods in the SecurityMarginModel class are made protected as they can still be overridden in derived classes.
This code was an attempt at modeling option splits. The reality of the situation
is far more complicated and requires an external data source to be properly modeled.
Some things to consider are handling a split event before all the contracts from the
previous split event have expired.
With respect to the holdings, I think a more generic method to rewrite the holdings
would be beneficial when we have the data, but it isn't as simple as applying a split
factor. During splits and other corporate events, the OCC will rewrite the options
conract such that you are 'made whole'. Sometimes this involves adjusting the contract
multiplier away from the default 100 (or 10 for minis). Another fairly common case
(especially with M&A's) is to have part of the contract paid out in cash. So it's
possible for pretty much every value in the contract/holdings to change:
1. Multipler
2. Strike Price
3. Number of contracts held
4. Cash payout in leiu of fractional stock
5. Constant cash payout
The OptionMarginModel.GetMaintenanceMargin method was returning very large margin requirements for short options held until near expiration, causing "Insufficient funds" errors.
This feature enables users to write complex filters for option universes.
Fixes OptionExerciseAssignRegressionAlgorithm
Adds regression test for OptionExerciseAssignRegressionAlgorithm
When assigning shares of the underlying equity for an option at expiration, the equity quantity was incorrectly set equal to the option quantity. Now this quantity is multiplied by option.ContractUnitOfTrade (usually 100 for US options).
This bug was hidden by the option assignment tests in SecurityPortfolioManagerTests, which have also been corrected.
The regression stats for OptionExerciseAssignRegressionAlgorithm have also been updated.
In some cases this bug was also causing division by zero exceptions in OnOrderEvent, which seem to be fixed with this PR.
- Moved provider implementations out of brokerages into their own classes
- Removed DefaultOptionChainProvider
- Added BacktestingOptionChainProvider and LiveOptionChainProvider
- Moved SetOptionChainProvider call from Engine to setup handlers
- Update quantity to decimal in OptionExerciseOrder
- Update FractionalQuantityRegressionAlgorithm to use QuoteBarConsolidator
- Update FractionalQuantityRegressionAlgorithm stats
- Truncate order quantity to int in IB exerciseOptions
- Truncate order quantity to int in FuzzyInferenceAlgorithm
* Fixes 5 warnings with code CD1572
* Adds the Xml Comment parameter and implements the missing selector parameter
* Fixes rest of the 13 warnings with code CS1572