Build & Test Lean / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / 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
* Implement indicator-based option price model
This model uses IV and Greeks indicators to implement Lean's own option pricing model
* Minor fixes
* Address peer review
* Minor tests fixes
* Make the indicator based price model the default for options
* Address peer review
* Cleanup and minor changes
* Support indicators configuration for new pricing model
* Some cleanup
* Add QL option price model example algorithm
* Return lean models from static helpers
* Minor tests fixes
* Minor test fixes
* Address peer review
* Cleanup
* Fix unit tests
* Move QL models to OptionPriceModels.QuantLib.*
* Add forward tree helper method
* Initial solution
* Solve review comments
* Fix unit tests
* Resolve comments reviews
* Return a default symbol instead of throwing an exception
* Add unit test
* Fix pandas converter to handle list of data with different symbols
* Properly convert list of data into dataframe
Take into consideration data for multiple symbols in the same list
* Cleanup
* Index dataframes by symbol object instead of SID string
* Add symbol equality operator to compare against object
* Exclude "ID" from option chain dataframe
* Minor fix
* Add greeks columns directly in option chain dataframe.
Also add pass-through properties for greek values in OptionUniverse
* Some cleanup
* Minor fix
* Add new QCAlgorithm.OptionChains() method
- Use OptionChains as output
- Add DataFrame to OptionChain and OptionChains
- Rename Greeks classes
- Add ISymbolProvider for classes that have a symbol (IBaseData, OptionContract)
* Unify QCAlgorithmOptionChain API
Also refactor OptionContract to handle: (1) Actual market data and option price model data, and (2) OptionUniverse data
* Pass symbol properties to OptionUniverse option chain from algorithm
* Format OptionContract for dataframe
* Minor fix
* Add multiple option chains api regression algorithms and other minor changes
* Address peer review
Add NullGreeks class: keep ModeledGreeks as internal as possible
* Minor fix and add PandasConverter unit tests
* Peer review: Non-thread-safe Lazy for Python
* Handle Greeks unwrapping by PandasData
* PandasData cleanup
* Add data and other minor changes
* Unit test fix
* Update Pythonnet to 2.0.39
* Cleanup
* PandasData handling children class members
Address peer review
* Fix: indexing symbol conversion in pandas mapper
* Fix pandas mapper to convert string keys to symbol only when necessary
* Cleanup
* Cleanup
* Add PandasColumn python class to handle proper indexing
This allows propery hash and equality between Symbols, C# strings and Python strings
* Minor fixes
* Symbol cache improvements
* Minor fix for cache miss
* Revert PandasMapper reserved names and improvements
* Minor fix
* Revert reserved names
* Minor fix for Symbol equality operators
---------
Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
* Implement risk free interest rate as an algorithm model
* Use risk free insterest rate model in Sharpe Ratio indicator
* Address peer review
Also added python wrapper
* Take pyobject as interest rate model in Sharpe Ratio indicator
* Minor fix
* Minor fix
* Address peer review
* First attempt to fix the bug
* Allow the splitFactor to change over time
- Add unit test
* Nit change
* Address required changes
* Address required changes
* Adjust upper bound
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
* Implement Trailing FreePortfolioValue
- Implement Trailing FreePortfolioValue by default, users will be able
to set it to a fixed number if desired. Adding regression algorithm
- Setting the default 'MinimumOrderMarginPortfolioPercentage' from 0 to
0.1% of the TPV to avoud tiny trades by default
* Update existing regression algorithms
* Address reviews
- Send warning message to the user if a trade does not happen due to the
default setting of the minimum order margin percentage value
* Address reivews
* Rename TotalPortfolioValueLessFreeBuffer
* Update new regression algorithm
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
Research Regression Tests / build (push) Has been cancelled
* Fix the bug and add unit tests
- The bug was raised by different conditions.
First, the tick created in tick generator for Open Interest was not of type Open Interest.
Second, TickAggregator.cs was made to use daily resolution for OpenInterest always.
Third, the RandomValueGenerator, generated a random friday as expiration date for the option created but this one needed first two underlying data points, so if the expiration date was before the start date plus 3 days, RandomDataGenerator just generated OpenInterest data for the option.
* Add docs
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
* initial commit
* get history from data providers
* merge history from history providers
* merge slice
* Add merge function in slice
* Update test
* merge aux data
* add data points in _data
* append new data points in original list
* Add test suite for HistoryProviderManager
* reduce complexity
* setup once
* add fake history provider
* doesn't count aux data
* add tests for options
* style changes
* add custom data
* merge rawDataList
* use array of history providers
* optimize
* fix formatting error
* add comment
* add tests
* simplify
* use list
* use abstraction
* split tests
* add test
* use abstraction to create generic enumertor class
* refactor
* accept list of type T
* sync history slices
* use SubscriptionDataReaderHistoryProvider for live
* rename test file
* return empty
* add tests
* cleanup
* address reviews
* optimize
* Fix method definition
* use initial time for basedata
* refactor
* re-use collection
* inherit HistoryProviderBase
* always return HistoryProviderManager
* add tests
* update rawDataList
* reset composer
* consider null elements
* add tests for binary search method
* Follow lean coding style
* revert
* remove binary search method
* convert to field
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
* replace to local functions as they are more performant
* fix random generator upper bound
Next() includes minValue, but not maxValue, so we increment it +1
* introduce abstract layers
* refactoring
* fix tets
* adapt tests
* fixup
* implement blackschole price model for options
* use risk free rate
* use ql price model
* wip
* change interface
* fix
* tidy up the code
* wip
* iterate groupped symbols
* wip
* wip
* fix
* allow symbol of different types
* improve settings
* wip
* iterate full range
* fix issue with negative option
* fix
* fixup
* use StandardDeviationOfReturnsVolatilityModel
* re-use existing tick types per security type
* parametrize underlying security type
* use default option style
* dynamic option price model
* fix enumeration
* test
* fix unit tests
* refactor code
* remove unused file
* minor tweaks and refactoring
* rename symbol generator class
* fix interface
* add comments
* more comments and unit tests
* more tests
* add disclaimer
* more tests
* more comments and tests
* split tests into different files
* tidy up the code
* tidy up the code; more tests
* refactor TickGenerator => use security price directly on each iteration
* remove dupe; reuse main constructor
* use SecurityManager, refactor code
* bugfix: save ticks in history array
* check volatility warm up & tests
* more unit tests
* describe volatility period span in settings
* rename command line option
* Minor adjusments. Address review
- Use Lean log handler instead of writting directly to console
- Rename BlackShcolesPriceGenerator to generically OptionPriceModelPriceGenerator
- Minor format clean up & standarization
- Add support for specifying the option chain size
* Rename TickGenerator private fields
* Fix unit tests
* fix tests class name
* Support tickers being specified
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
* Add new DownloaderDataProvider
- Moving LeanDataWrite and IDataDownloader to common project
- Add new BaseDataDownloaderDataProvider with concurrency helper method
- Add new DownloaderDataProvider which will use a IDataDownloader or
IBrokerage implementation as data source
* Add support for downloading symbol chains data
* Update projects to use .NET 5.0, the successor to .NET Core
* Fix ambiguous errors. Add IBAutomator net5
* Remove FXCM
* Upgrade IBAutomater to v1.0.51
ignored, and an empty message aborts the commit.
* Fix rebase
- Fix ambiguous Index
- Remove StrategyCapacity.cs
- Update System.Threading.Tasks.Extensionsy
* Remove unrequired references
* Fixes
- Travis will use dotnet, not nunit nor mono
- Remove mono from foundation image
- Fix python setup in research
- Fix unit tests
* Don't call ReadKey when input is redirected
* Fix ConsoleLeanOptimizer
* Research fixes
* Update comment
* Add vsdbg to Dockerfile
* Fixes
- Revert dockerfile FROM custom changes
- Adjust and fix regression algorithms
- Option assignment will be deterministic in the order
- 'Rolling Averaged Population' is calculated using doubles, updating
expected values.
- Update readme, removing references to mono
- Add missing Py.Gil lock
* Replace ICSharp with .NET Interactive
* Fixes after rebase
* CSharp research fixes
- Adding new Initialize.csx that pre loads all assemblies
- Adjusting template research file
- Moving steps in dockerfilejupyter
- Fix unit tests and regression tests after rebase
Co-authored-by: Gerardo Salazar <gsalaz9800@gmail.com>
Co-authored-by: Stefano Raggi <stefano.raggi67@gmail.com>
Co-authored-by: Jasper van Merle <jaspervmerle@gmail.com>
* Update RandomDataGeneratorProgram.cs
Replaced AddMonths(6) with a Datetime value half way between settings.Start and settings.End.
* Update RandomDataGeneratorProgram.cs
* Update to bug-5030-CFDdatanotoworking
* Added midpoint unit test
* Minor test assert improvement
Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
* Adds preliminary universe selection for Future Options
* Fixes scaling issues with Future Options
* Fixes scaling multiplying by 10000x instead of using _scaleFactor
* Fixes scaling for Tick
* Revert changes to Tick since it divides the scaling factor
* Changes stale method name to new method name after rebase
* Fixes selection bugs, adds new methods, and adds unit tests
* Fixes bug where Equity Symbol was created for an underlying
non-equity Symbol, resulting in equity data trying to be loaded
* Adds unit tests covering changes to Tick, QuoteBar, TradeBar and
LeanData
* Adds regression test for AddUniverseOption filter contract selection
for Future Options
* Addresses review - modifies the AddFutureOption signature
* Adds new AddUniverseOptions method overload
* Removes and adds a new unit test
* Misc. modifications to account for new changes
* Fixes bug where futures were loaded using default SID Date
* Refactors and removes unnecessary work
* Fixes regression algorithm, which previously made no trades
* Adds future option data
* Adds the corresponding underlying data, in this case, futures data
to enable usage of future options data
* Replaces data with new data (ES18Z20)
* Improves Future chain filtering and updates regression stats
* Add AddFutureOptionContract API
* Expands regression and unit tests to test in finer detail
* Adds Python regression algorithms for AddFutureOption[Contract] methods
* Adds new unit test for BacktestingOptionChainProvider
* Fixes bug with BacktesingOptionChainProvider where we
attempted to load the Trades option chain first, resulting
in breakage of backwards compatibility and limitation of the
option chain.
* Adds new regression algorithms (Py) to Algorithm.Python project
* Adds FutureOptionMarginBuyingPowerModel
* Modifies code paths used to select margin model
* Adds related unit tests for margin model
* Fixes issue with unit test and MHDB/SPDB lookup for Future Options
* Preliminary regression algorithm testing ITM call/put option buying
* Fixes bug where fee model used did not find non-US market
options fee model. We now use the futures fee model for future
options because IB charges the same commissions per contract
between futures and futures options
* Adds proper regression algorithm for ITM future options expiration
* Pushing broken algorithm for review
* Currently, algorithm does not fill forward, causing
a single future option to not get exercised when it is delisted.
* Adds FutureOptionPutITMExpiryRegressionAlgorithm
* Improves existing regression algorithm for call side
* Fixes bug in existing regression algorithm
* Adds AAPL daily data to advance enumerator for ^^^ fix
* Adds additional future option regression algorithms
* Adds Buy OTM expiration regression algorithms
* Adds Sell ITM/OTM expiration regression algorithms
* Adds missing Python regression algorithms
* Adds remaining Python regression algorithms and fixes issues
* Fixes naming issues and statistics
* Adds short option OTM regression algorithms (Py)
* Add license header and class comments to python algorithms
* Cleans up comments and docstrings
* Create Buy/Sell call intraday regression algo
* Redirects future options symbol properties to futures symbol properties
* Asserts exercise/assignment price and updates stats in regression algos
* Adds new unit test covering changes to SecurityService
* Adds comments and fixes failing test
* Partially fixes future option mis-calculated profit/loss
* Adjusts portfolio model to calculate FOP as a no upfront pay asset class
* Updates regression algorithm statistics
* Begin IB FOP support
* Initial support for FOP IB data streaming, live í¾
* Adds additional functionality to LiveOptionChainProvider
- Allows querying CME API to retrieve option chains for CME products
- Ultimately, it's also the groundwork for the CME
LiveFutureChainProvider
* Edits IDataQueueUniverseProvider interface to provide greater
control to implementors of it
* Misc. bug fixes required to get FOP data streaming through IB
* Adds comments, adds missing rategate call, and cleans up code
* Force exchange for FOP and Futures when no exchange is provided
* Fixes bug with Portfolio modeling across all asset classes
* Adds LiveOptionChainProvider tests for Future Options
* IB brokerage option symbol bug fixes and improvements
* Fixes contract multiplier lookup bug
* Fixes issue where we attempted to subscribe to IB data feed with canonical security
* Adds ES MHDB entry
* Reverts portfolio modeling changes for Futures Options
* Since IB eats into our account's cash balance when
a new FOP contract is purchased, we must model by applying funds
to our cash whenever a new purchase/sell occurs.
If we choose to model FOPs exactly as we do with futures, we
will end up with an invalid TotalPortfolioValue on algorithm
restart. By all means and purposes, FOPs are modeled exactly
the same as equity options with respect to the portfolio.
* Adds comments clarifying portfolio modeling and clarifies
existing portfolio modeling comments with additional context.
* Fixes IB symbol lookup for future options
* Fixes LiveOptionChainProvider looping 5 times per option chain
request, even on success
* Sets OptionChainedUniverseSelectionModel to produce a canonical
future/future option/option Symbol to avoid creating two Symbols
* Adds GLOBEX future option symbol mapping from future -> fop
* Fixes LiveOptionChainProvider loading wrong contract option chains
* Fixes loading of futures options ZIP files when backtesting
* Adds a string -> decimal JSON converter
* Additional fixes/refactoring to the LiveOptionChainProvider
* Adds tests for changes to Symbol and LeanData
* Reverts changes to IB-symbol-map
* Fixes Value for mapped future options tickers
* Fixes Symbol test
* Changes path of future options to future's expiry date
* Extra changes made to remove scaling from writing CSV
* Added method to map from FOP Globex -> FUT Globex
* Fixes MOO and MOC orders for future options
* Note: this order type might not be supported by IB or CME.
* Bug fixes and updates unit tests
* Update regression tests and data format
* Rebase changes
* 1. Multiple bug fixes for LiveOptionChainProvider, reverts IQFeed changes
2. Address review (partial): Code reuse and cleanup
1.
* Modifies check in
`AddFutureOptionShort(Call|Put)ITMExpiryRegressionAlgorithm`
to ensure no buys have negative quantity
* Code reuse changes in IB brokerage
* Bug fix in IB brokerage where we assigned the FOP expiry
as the futures expiry (requires verification)
* Doc changes and adds missing summaries/license banners
* Disposes of HTTP client resources in LiveOptionChainProvider
* Renames classes and adds FutureOption folder in Common/Securities
2.
* We revert back to the quotes API for the option chain,
since the settlement API sometimes had missing strikes.
* Fixes future option expiry being set as future's expiry
in LiveOptionChainProvider
* Fixes bug where wrong option chain was selected because of bad
expiry lookup in the futures expiries returned from CME
* Fixes multiple looping bug in LiveOptionChainProvider
* Adds strike price scaling for LiveOptionChainProvider
* Reverts IQFeed changes and simplifies interface upgrade changes
Some additional challenges we'll have to solve as part of FOPs:
- The `OptionSymbol.IsStandard` method makes the assumption that
weeklies contracts follow the pattern equities follows, which
does not apply to Futures Options
- The Subscription created in:
`OptionChainUniverseSubscriptionEnumeratorFactory`
...adds a Trade config. For illiquid contracts, this
will delay universe selection for the option symbol
until we get a trade. However, if we add a quote config,
the data would instead be loaded based on the first quote
we received from the brokerage.
But since we're currently using a trade config, illiquid
contracts won't start streaming data until it receives a trade.
NOTE: this commit is a WIP to addressing the reviews received in the PR,
but has been committed early for efficiency in the review process
* Fixes regression algorithms and misc. bugs
* Fixes map file lookup for non-equity options
* Adds extra assertion at end of algorithm to ensure no holdings are
left when the algorithm ends.
* Adds FutureOptionSymbol, allowing all contracts through as standard
* Changes SPDB to allow defaulting to underlying future symbol
properties if no entry is found for the given FOP
* Fixes calls to SPDB in SecurityService, IBBrokerage
* Reverts AAPL daily ZIP file to fix majority of regression algorithms
* Adds FOPs symbol properties
* Fixes existing symbol properties for a few futures
* Adds tests for changes to Symbol Properties Database
* Removes string SPDB lookup method
* Updates tests and misc callees of previous method
* Updates all regression tests to use data of already expired contracts
* Adds Futures Options Expiry Functions tests
* Adds required futures data for 2020-01-05
* Address review (partial): Expands test coverage and fixes tests
* Set option chain tests parallelism to fixture only
* Fixes broken test for contract month delta for FuturesOptionsExpiryFunctions
* Changes delisting date logic for Futures Options
* Address review: removes duplicate code, misc code fixes
* Bug fix in MarketHoursDatabase.GetDatabaseSymbolKey() where
we would use the underlying's Symbol for lookup in the MHDB
* Adds missing license banner
* Removes Futures Options entries from MHDB
* Adds new tests
* Adds SecurityType.FutureOption
* Converts any underlying comparisons and uses SecurityType directly
instead for FOP specific behavior
* Extra code modifications to acommodate new SecurityType
* Addresses review: fixes order fee bug on exercise
* Additional bug fixes and adding of SecurityType.FutureOption
* Updates regression algorithms OrderListHash
* Fixes various bugs in IB live implementation
* Fixes bug setting the right contract expiration date for FOP
generated by LiveOptionChainProvider
* Adds new function to FuturesOptionsExpiryFunctions
* Clarifies parameter names better in some functions/methods
* Fixes bugs in IB brokerage for FOPs
* Address review - code cleanup and refactor
* Remove MappingEventProvider, SplitEventProvider, and
DividendEventProvider for Futures Options in
CorporateEventEnumeratorFactory
* Address review: Use MHDB key resolver in SPDB
* Makes regression tests pass and adds comment for expiry issue
* Fixes MHDB lookup on string symbol method
* Adds Futures Options greeks regression algorithm (C# only)
* Adds explanitory comment on MHDB FOP lookup
* Remove python from FutureOptionCallITMGreeksExpiryRegressionAlgorithm
Previously, map files were generated with multiple rename events
and only one symbol was output. Now, data files are created for
each map file entry.
Fixed wrong formatting for IPO date
first entry
Changed behavior of dividend generation. Some symbols may now be excluded
from having dividends completely.
Fix bug where we would generate the same dividend entry due to the way
the variable used to calculate the next dividend was placed.
Changed initial starting value for dividends and splits for symbols with
no splits or dividends
Remove `NormalizeMonth` method in FinancialCalendar
Fixed bug where factor file reference price output had very high
precision
Fixed bug where map file had a useless entry before the final line if
the asset was not delisted
Fixed bug where program would crash because of NextPrice reaching its
maximum attempts. Fixed by removing call to NextPrice and using another
generation method.
Created random-seed argument for rdg in order to let the user get deterministic output
Update documentation in 'FactorFileRow.cs' to accurately reflect factor
file structure
Update CSV generation for FactorFile so that it uses FactorFileRow's CSV
generator
Add FinancialCalendar to make it easier to implement logic regarding
financial quarters
Add mapping events to RandomDataGenerator
Update MapFileRow ToCsv method to correctly emit the ticker as lowercase
Fix bug in FactorFile where we would get the same initial data point twice
when we converted it to CSV
Create new method to convert a MapFile to CSV
Create new method to write MapFile to disk as CSV
Add unit test to test for successful CSV generation in MapFile
Add new files to project
Add FinancialCalendar unit tests
Create new class to handle generation of dividends, splits, and maps
This commit removes start date in the coarse generator. This option was used in the previous version, in order to process only the newest dates.
The reason is the fact that coarse files now contains factors to estimate adjusted prices. In turn, factors are updated backward with a new corporate event (split, dividends, etc); the new coarse generator should *always* process the full symbol historical data, for all symbols.
This side steps the issue reported in #2840 by removing the desire to pass
zero for the maximum deviation. The previous issue was that we were leaning
on the trade ticks to produce the series variation and then trying to fit
quote ticks around a previously generated trade tick. This solution permits
both quote and trade ticks to produce variations and prevents the generator
from emitting both at the same time step.
A new parameter, --quote-trade-ratio, determines the relative density of each.
For example, a quote trade ratio of 1 means equal trade and quote ticks, whereas
a value of 2 means twice as many quote ticks as trade ticks.
This change also removes special treatment regarding the downsizing of the
requested deviation for quote ticks. If the consumer wants to limit the
deviation of quote ticks than the consumer can make that decision, but the
random value generator should simply follow instructions like a good little
boy.
Fixes#2840
Higher resolution means more frequent whereas lower resolution
means less frequent. This piece of logic is picking the next
time using a higher frequency resolution to guarantee we get a
time within market hours
The existing IdentityDataConsolidator consumes all ticks, completely ignoring
the tick type. I doubt this is ever the desired behavior, but given my
reluctance to break existing regression and unit tests as well as perhaps
user algorithms, I've added a layer on top to provide the proper filtering.
Removed the stub type which mirrored the TickAggregator and also expanded
the TickAggregator implementations to provide full coverage of the possible
ticktype/resolution cases: OpenInterestTickAggregator and IdentityTickAggregator
Invoke from toolbox cli using --app=rdg or --app=randomdatagenerator
Produces random data over the requested time frame in the desired resolution,
security type and density.
Here's a few sample command line invocations:
--app=rdg --start=20190101 --end=20200101 --symbol-count=1 --resolution=Daily --data-density=Dense --include-coarse=false
--app=rdg --start=20190101 --end=20200101 --symbol-count=10 --security-type=Future --resolution=Hour --data-density=VerySparse
--app=rdg --start=20190101 --end=20200101 --symbol-count=5 --security-type=Option --resolution=Minute --data-density=Sparse
The random value generator aims to abstract away the generation of the
key bits of data from the toolbox project. This provides a baseline
implementation for anyone who wishes to customize their data randomizaton.
Simply subclass and override the desired methods. A full test suite is
included to ensure the data generated meets specifications.