- 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
Energy futures (CL, HO, RB, NG) expire in the month before the contract month.
To handle these properly, the following changes have been implemented:
- the AlgoSeekFuturesReader has been updated to create the future symbol with the correct expiry date
- the zip entry names in futures data files now contain the full expiry date (in addition to the contract month)
- the sample data files have been updated to use the new zip entry names
- new unit tests have been added and existing ones updated
AJY, AKL, AKZ, ANE, APS, AR0, ARE, AUP, AVZ, AW, AYV, AYX, AZ1, B0, B7H, BCF, BIO, BK, BOO, BR7
Correct wrong entry for symbol ZT in symbol-properties-database
Add missing holidays or early closes for energies and fx in mhdb
Adds Russell 2000 E-Mini (RTY), Nikkei 225 Dollar (NKD) and Sugar 11 CME Globex (YO) to future data: entails update entries in market hours and symbol properties databases.
Updates `FutureExpiryFunction` to handle these contracts expiration date.
- Removing OrderFeeParameters.AccountCurrency. Where required replacing
for constructor parameter defaulting to USD.
- Updating IB fee model to use to correct fee currency
- 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.
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.
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.
FutureFilterUniverse was lacking a means of explicitly setting the set of
contract symbols to be selected, which means algorithms had to use the
vairous helper methods but wereunable to define their own selection function
for the ontract universe. This change adds two methods, one to explicitly
set the contracts to be selected and another that mirrors the way universe
selection works, by providing a function that accept sthe full set of contract
symbols and returns the filtered set of contract symbols. This enables LINQ
filtering of the contract universe.
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.
- Move BacktestingFutureChainProvider provider to Lean.Engine.DataFeeds along with its options equivalent.
- EmptyFutureChainProvider: provider that returns an empty list of symbols
- CachingFutureChainProvider: implements caching by date
- BacktestingFutureChainProvider: provider that gets chain from local files
- LiveFutureChainProvider: provider that gets chain from external source (empty list of symbols for now)
This issue was causing an OverflowException in SecurityPortfolioManager.ScanForMarginCall due to a precision error in the margin calculation that was returning a value for TotalMarginUsed = 0.0000000000000000000000061M.
This solution simplifies the calculation of maintenance margin, removing the unnecessary division and multiplication by the same value.
Some Futures (CL, HO, RB, NG) expire during the month before the contract month. Incorrect symbol mapping was causing two issues:
- IB requests were returning an "Ambiguous contract" error
- The ticker generated by SymbolRepresentation was referring to the previous contract month