77caa034e3231de2aaafafbbb09694bdbbfb5ebb
19 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
95739b8a58 |
Increase option strike digits precision to 6 (#9086)
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
* Increase option strike digits precision to 6 - Increase option strike digits precision to 6. Adding unit test * test:fix: couple of build tests * fix:test: Asset CUSIP and OrderListHash in Regression Algorithms * test:fix: several regression algos * test:fix: old Symbol CUSIPs to new ones --------- Co-authored-by: Romazes <romazes20@gmail.com> |
||
|
|
7008d17714 |
Add MaxDrawdownRecovery metric (#8865)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Implement a prototype of the maximum recovery time function. * Add unit test skeletons. * Add failing test * Issue #4581: Implement MaxDrawdownRecoveryTime. * Issue 4581: Add DTO for Drawdown Percentage, Drawdown Enddate, and High Value * Issue 4581: Fix bgu for when lDrawdowns list is empty. * Issue 4581: Change names of tests. Change name of file. * Issue 4581: Make adjustements to flow of adding drawdowns to lDrawdowns. * Issue 4581: Add multiple unit tests. * Issue #4581: Change name of unit test * Issue #4581: Add to PerformanceMetrics * Issue #4581: Add Maximum Drawdown Recovery to PortolioStatistics class. * Issue #4581: Add to portolfio statistics class. * Issue #4581: Add to statistics builder. * Issue #4581: Add report key. * Case #4581: Convert to decimal. * Issue #4581: Correct comment. * Issue #4581: Correct performance metrics view model string. * Case #4581: Correct statistics builder view model string..again. * Issue #4581: Placed DradownDradownDateHighValueDTO at the end of the file for simpler diff. * Issue #4581: Add 2 new tests. * Issue #4581: Change algorithm so that when multiple maximum drawdowns occur, the longest of all recoveries is reported. * Issue #4581: Add unit test. * Issue #4581: Remove reportkey. Change dto name. * Issue #4581: Change summary. * Issue #4581: Change comment. * Add max drawdown recovery calculation with unit tests * Update regression algorithms with the new metric * Solve review comments * Update regression algorithms * Add TryGet to safely get the key: MaximumDrawdownRecovery * Ignore MaximumDrawdownRecovery metric in OptimizationBacktest Json * Revert changes in Messaging * Update regression algorithms * Add test case: TakesLongestRecoveryAmongMultipleDrawdowns * Use integer days for MaximumDrawdownRecovery * Add MaximumDrawdownRecoveryReportElement * Use more explicit names * Rename files and variables for consistency * Update regression algorithms --------- Co-authored-by: Alain Schaerer <aschaerer@pcatg.com> |
||
|
|
e29bb2c5e0 |
File-based options universe (#8212)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Initial options universe with greeks implementation * Options universe improvements * Address peer review * File based options universe fixes and improvements. - Adjust OptionUniverse start-end times and period. - Adapt unit tests and some algorithms to pass with new options universe selection. * Updated options regression algorithms stats for new universe data * Updated options regression algorithms stats for new universe data * Updated options regression algorithms stats for new universe data * Updated options regression algorithms stats for new universe data * Updated options regression algorithms stats for new universe data * Option chain provider with new options universe * Allow canonical option history requests * Address peer review * Address peer review * Fix symbols parsing in OptionUniverse * Fix universe selection subscriptions start time to not include extended market hours * Minor changes * Minor changes * Peer recommended changes and fixes * Update regression algorithm stats * Update regression algorithms stats and minor fixes * Fix option chain provider history request * Round option indicators values * Added option universe csv header property * Update regression algorithms stats * Update regression algorithms stats * Data fixes and regression algos stats update * Unit test fixes * Minor changes * Option chain handling in live trading data feed * Minor changes * Added processed data provider * Fix thread-safety violation in Slice class * Minor change * Update options filter universe API to use OptionUniverse data Add new filter methods for greeks, IV and open interest * Option filter universe api updates * Add OptionUniverse history regression algorithms * Add regression algorithms for new options filter universe api methods * Added options greeks data and updated regression algorithms * Address peer review * Address peer review * Add more assertions to new options filter api regression algorithms * Minor performance improvement. Reduce greeks binomial model steps to 140 * Minor tests updates * Greeks numerical models performance improvements * Greeks numerical models performance improvements * Revert array pool change for option pricing numerical models * Update default dividend yield provider depending on option type * [TEST] * Add helper method con calculate time till expiration * Use double in price option numerical models * Implied volatility calculation improvements - Adjust root finding method accuracy as a factor of the option price - Use BSM to get a first guess * Cleanup * Some regression algorithms and unit tests cleanup * Regression tests updates after rebasing from master * Add universe files * Self review and cleanup * Minor regression tests updates after rebase * Fix: set data time zone to same as exchange tz for options universes * Minor change * Minor change * Fix for live trading options universe selection * Keep underlying when aggregating collections in BaseDataCollectionAggregatorEnumerator * Update index options regression algorithms stats * Minor change * Address peer review * Memory usage improvements * Minor build fix * Minor changes and test fixes * Cache symbols in OptionUniverse * Cleanup * Fix index option creation in OptionUniverse * Use cached underlying SID when parsing from string * Abstract symbols cache to BaseDataCollection * Return actual underlying symbol when mapping decomposing ICO ticker * Address peer review * Minor performance improvements reduce garbage * Limit Symbols and SIDs cache size to help with memory usage * Minor fix in symbols and sid cache cleanup * Build fix * Lazily parse greeks on individual access * Cleanup and tests * Address peer review * Minor greeks fix --------- Co-authored-by: Martin Molinero <martin.molinero1@gmail.com> |
||
|
|
aa5ab68b47 |
Fix 3/4 of CA2201 warnings (#8102)
* Fix 2/4 of CA2201 Warnings * Fix 3/4 of CA2201 warnings |
||
|
|
8c33536498 |
Add algorithm status statistic (#8095)
* First draft of the solution * Fix bugs * Fix bugs |
||
|
|
cce8945fe8 |
Api Clean up, Documentation and Standarization part two (#7964)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Add improvements * Add improvments and unit tests * Add XML comments * Nit changes * Add unit tests for OrderJsonConverter * Improve unit tests * Address requested changes * Fix bugs * Fix bugs * Fix bugs and self-review * Fix bugs * Address requested changes * Fix unit test bug * Fix bugs * Improve unit tests * Solve bugs |
||
|
|
ead2efe6b9 |
Add Starting and Ending KPI's (#7811)
* First draft of the solution * Add missing changes * Remove the new KPI's from report * Fix bugs * nit change * Add improvements * Fix regression tests * Solve bugs in the regression algos * Fix regression tests bugs * Expand unit tests and add minor changes |
||
|
|
feff802479 |
Standardize trade count statistic (#7827)
* Standarize trade count statistic * Rename 'Total Trades' to 'Total Orders' |
||
|
|
442dd771a3 |
Remove dynamic options filter behavior (#7620)
* Make options filter non-dynamic by default and explicitly set * Deprecate ContractSecurityFilterUniverse.OnlyApplyFilterAtMarketOpen * Add regression algorithm * Remove dynamic option chain filter behavior |
||
|
|
eefa74baaa |
Add Sortino ratio to statistics and report (#6698)
Regression Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Add Sortino ratio to statistics and report * Adds Sortino Ratio to Report Key Statistics * Addresses Peer-Review Reuse `SharpeRatioReportElement` and change the template. * Reuse Calculations Across Statistics and PortfolioStatistics * Adds Sortino Ratio to Regression Algorithms * Removes Sortino Ratio from Optimization Result Table --------- Co-authored-by: Alexandre Catarino <AlexCatarino@users.noreply.github.com> |
||
|
|
314a334e88 |
Price adjustment mode Order property (#7582)
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
* Add new Order.PriceAdjustmentMode property * Minor fix and unit test * Minor fix and regression algorithms' stats update * Unit test fixes * Minor fix * Set order price adjustment mode to raw always for live trading |
||
|
|
18e848853d |
Approximate order price for options when using IB Fee model (#7436)
Research Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
* Modify IB Fee model to work without order.Price * Fix bugs and add unit tests * Update regression tests * Solve bug and address changes * Nit change * Fix stats |
||
|
|
bbbab6d9a8 |
Refactor alpha statistics phase I (#7055)
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
* Refactor alpha statistics - Refactor alpha statistics, cleaning up and simplifying no longer required calculations and scoring - Adding new InsightEvaluator abstraction, adding C# & PY regression algorithms * Optimization backtest result json converter update * Address reviews - Remove IAlphaHandler, move insight storage responsability to IResultHandler and centralizing insight collection on the QCAlgorithm.Insights to be reused by the framework models - Fix portfolio turnover single day backtests and duplicate time sampling handling. Updating regression algorithms * Add InsightCollection tests and minor fixes * Adding more & improved tests |
||
|
|
c4433098c3 |
Refactor Framework Statistics (#7041)
* Refactor framework statistics * Further insight chart cleanup |
||
|
|
56270464cc |
IsOption Use Underlying Holidays and Early Closes if Empty (#7007)
Regression Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
* IsOption uses underlyings holidays - Option assets will use underlyings holidays, early closes and late opens if their own are not defined * Update regression algorithms |
||
|
|
d1ff914e5a |
fix docs (#6285)
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
|
||
|
|
15066ae5e1 |
Feature improve regression tests (#6245)
* add data count properties * 'add history count property * assert data counts * update missing override * consider override/virtual cases * implement data count * add message handler for regression tests * use regression test message handler * set algorithm manager for regression test message handler * update data count * check if stats are present, check if algo manager is not null * update * add c# algo * make same as c# algo * use new line * logic shifted to RegressionTestMessageHandler * cleanup * auto cleanup * skip non deterministic data count * change data count * use inheritance * improve stats * update couht * add sma indicator to c# and customSMA to python * call base method before executing further * skip test * revert to original * add duplicate sma * skip regression test |
||
|
|
58793acae8 |
Removes Assets that Are Not Invested and Not Tradable From Capacity Calculations (#5515)
Build & Test Lean / build (push) Has been cancelled
* Add property for capacity. Remove unused variable * Move SymbolCapacity and CapacityEstimate to common, passed through Symbol to runtime statistics * Add null checks * Remove uninvested and untradable assets from capacty calculations * Add SymbolCapacity influential period * Updates Regression Tests - DelistingEventsAlgorithm - Allows additional contributions from delisted AAA.1 - DelistingFutureOptionRegressionAlgorithm - Removes DC01H12 contributions one month later - FutureOptionBuySellCallIntradayRegressionAlgorithm - Allows additional contributions from future after expiry replacing the contribution of the next contract option - DelistedFutureLiquidateRegressionAlgorithm - FutureOptionCallITMExpiryRegressionAlgorithm - FutureOptionCallITMGreeksExpiryRegressionAlgorithm - FutureOptionPutITMExpiryRegressionAlgorithm - FutureOptionShortCallITMExpiryRegressionAlgorithm - FutureOptionShortPutITMExpiryRegressionAlgorithm - FuturesAndFuturesOptionsExpiryTimeAndLiquidationRegressionAlgorithm - Allows additional contributions from future after expiry - FutureOptionCallOTMExpiryRegressionAlgorithm - FutureOptionPutOTMExpiryRegressionAlgorithm - FutureOptionShortPutOTMExpiryRegressionAlgorithm - IndexOptionCallITMGreeksExpiryRegressionAlgorithm - IndexOptionCallOTMExpiryRegressionAlgorithm - IndexOptionShortCallOTMExpiryRegressionAlgorithm - Allows additional contributions from option after expiry - MACDTrendAlgorithm - Removes contribution when SPY is not invested for over one month - UniverseSelectionRegressionAlgorithm - Allows additional contributions from delisted GOOAV replacing GOOG (new symbols) * Adds Lowest Capacity Asset to Regression Tests * Normalize expected value -0, because -0 is also written to file if updated * Write Symbol.Value for lowestCapacitySymbol or empty string for empty Symbol * Update Regressions * Update 'Lowest Capacity Asset' to Symbol.ID Co-authored-by: Jared Broad <jaredbroad@gmail.com> Co-authored-by: Martin-Molinero <martin@quantconnect.com> Co-authored-by: Colton Sellers <Colton.R.Sellers@gmail.com> |
||
|
|
83f9499b4a |
Option Margin Strategies (#5511)
* Refactor HasSufficientBuyingPowerForOrder implementations Adds Sufficient and Insufficient helper methods to HashSufficientbuyingPowerForOrderParameters enabling syntax like: return paraeeters.Sufficient() returnparameters.Insufficient(reason) The next change will add the initial margin required which will simply require updating both of these helper methods to accept the value. * IBuyingPowerModel: Add margin functions Maintenance/Initial/ForOrder These were originally hidden in an effort to only expose what's necessary for the engine to perform its work. Additionally, we encapsulated all of the method arguments into parameters classes to prevent having to break anyone in the future. Not including these foundational methods turns out to be an oversight. These methods are not required by the engine, but rather by other models. Another possible solution here is to add an additional abstraction and include these methods on this new abstraction. BuyingPowerModel would then explicitly implement these methods and models that depend on them would require two code paths, one for when the buying power model implements this interface and another for when it doesn't. Tests were additionally updated to remove test model implementations created for the sole purpose of exposing these private methods. * Add ConstantBuyingPowerModel Provides an implementation of IBuyingPowerModel that returns the same constant value * Update BuyingPowerModelPythonWrapper to use reflection for method names Having a bunch of hard-coded strings is a sure fire way for someone to overlook when changing methods. This change ensures that noone needs to remember that this code exists :) Cleans up the syntax around verifying a python object implements a particular C# interface via the ValidateImplementationOf<T> method by having it return a value since the only use cases are in constructors when setting the models. I was initially going to update ALL python wrappers to validate the passed in models, but such a change could break many things that are 'working' right now. Such an effort should be saved for its own dedicated PR. * Add Parameters/Result types for new buying power model methods * Support computing maintenance margin for arbitrary quantities The existing GetMaintenanceMargin function assumes that we're only interested in the maintenance margin for the entirety of the provided security's holdings. This makes it impossible to perform what-if analysis or to even ask how much maintenance margin is devoted to a particular subset of the security's holdings. This change adds the quantity to the MaintenanceMarginParameters class. Futures and Options models also depend on holdings cost and holdings value, so they have also been added to the parameters type. Finally, static factory methods were added to improve discernment of intent: ForCurrentHoldings provides the existing behavior and then ForQuantityAtCurrentPrice to support what-if scenarios where we're looking for the change in maintenance margin if we were to execute an order for the securiy at the current time step. Obviously a constructor is provided to set all of the values explicitly, using any price metric the caller desires. * Address review - Fix BPM xml documentation - Fix python unit tests and PythonWrapper validate method * Add SecurityHolding.QuantityChanged event Adding event handlers will allow us to orchestrate complex events from distant parts of the codebase through wiring them up. If we continue down this path, it will move us away from the current, very 'mechanical' data flows expressed in LEAN and towards a more modern, event processing based system. This is but a baby step in that direction and the initial use case is using this QuantityChanged event to trigger resolution of the algoritm's positions groups. This is part of an effort to improve the fidelity of options margin modeling where we'll model an OptionStrategy as an IPositionGroup. This will allow us to compute the margin requirements of an OptionStrategy as a unit instead of computing margin of each security individually in isolation. See #4065 * PortfolioManager: Group fields and remove unused field This codebase generally places fields as the first members, but this class had some fields at the top, then some properties, and then some more fields. This change brings all the fields together at the top of the file and also removes pointless comments placed directly above some of the fields. Additionally, an unused field was removed. * Remove unused _currencyConverter from Security Looks like at some point the only code using this member variable was removed and the necessary clean up was overlooked. * Add Parse.Enum functions * Support disabling regression algorithms by language via config.json Adds 'regression-test-languages' to config.json and filters regerssion algorithms to run based on this value. When cycling on a particular feature, it's nice to be able to run the entire regression set while ignoring the python algorithms. Once the C# algorithms are all passing, one can then go back and run C# and Python in a final run, since 99% of feature work doesn't impact python specifically. * Implement IComparable in SecurityIdentitfier This can be used to deterministically sort securities and symbols * Add .editorconfig to enforce common formatting for json/sh files * Fix typo in IBuyingPowerModel.GetBuyingPower xml docs * Add ListEquals/GetListHashCode and OrderDirection.Closes(PositionSide) ListEquals and GetListHashCode are designed to be used together as they complement each other according to C#'s requirements for Equals and GetHashCode functions. PositionSide.ToOrderDirection() extension simply converts a PositionSide to its logical equivalent OrderDirection. Long->Buy, Short->Sell, None->Hold OrderDirection.Closes(PositionSide) determines if a particular OrderDirection would have the effect of reducing a position's absolute size. This function greatly improves the readability of buying power functions that must provide adjustments when an order/contemplated trade reduces/closes an existing position. OrderDirection.Buy.Closes(PositionSide.Short) OrderDirection.Sell.Closes(PositionSide.Long) All other combinations return false Adds ToArray/ToImmutableArray convenience functions that combine a call to Select followed by To(Immutable)Array all in one function call. * Add decimal.DiscretelyRoundBy extension method Supports rounding a decimal value by an arbitrarily chosen maximum precision, or 'quanta' * Update FutureMarginBuyingPowerModelTests to respect the security's lot size * Add core position group classes and abstractions * Add initial/maintenance margin support, buying power model consistency tests * Add SufficientBuyingPower and GetReservedBuyingPower to position group model Includes update to BrokerageTransactionHandler to use position group BPM for sufficient buying power checks. * Resolve position groups on each fill We need to update the state of our position groups on each fill so that we can properly handle multiple orders within the same time step. We also limit the number of positions sent into the resolver by removing securities without any holdings. * fixup! Add SufficientBuyingPower and GetReservedBuyingPower to position group model * Add GetMaximumLotsFor{Target|Delta}BuyingPower Instead of computing order quantity, these functions compute the maximum number of position group lots, which is the position group quantity, and is guaranteed to be a whole number, for the provided target/delta buying power parameters. The SecurityPositionGroupBuyingPowerModel delegates to the security's IBuyingPowerModel by applying a scaling factor equal to the security's lot size. This change also updates references to IBuyingPowerModel.GetMaximum... to use the new position group model methods. * Convert remaining IBuyingPowerModel call sites to position groups * Rename PositionManasger.CreateDefaultGroup -> GetOrCreateDefaultGroup Better describes its behavior * Add Position Groups readme.md * Add Option Strategy BuyingPowerModel - Adding CompositePrositionGroupResolver and OptionStrategyPositionGroupResolver - Adding OptionStrategyPositionGroupBuyingPowerModel handling option strategies based on IBs margin table. Adding regression algorithms - Few changes so that option strategies executed by multiple orders are detected - Adjust OptionStrategyDefinitionMatch to include equity legs in the matching result - Minor tweaks fixing previous rebase - Minor fixes for existing option strategies definitions, adding new missing strategies. - Fixing minor bugs in option strategy matcher. Adding more unit tests * Address self reviews - Fixing bug in 'PositionGroupCollection' - Few minor simplificaitons - Adding BasicTemplateOptionEquityStrategyAlgorithm * Address reviews - Improve regression algorithms margin remaining and used assert logic to be exact. Taking into account spread and fees Co-authored-by: Michael Handschuh <mhandschuh@gmail.com> |