* First Draft of the solution
Handle the case where the security has already been added in the
algorithm
* Improve implementation
* Improve changes
* Add unit test
* Improve unit tests
* Fix bugs in unit tests
* Nit changes
* Nit changes
* Improve implementation
* Solve bugs in unit tests
* Add more unit tests
* Plotting Limits Handling Improvements
- Improve the handling and enforcement of plotting limits
- Increase local default limits
* Minor plotting test fix
* Solve bug and add unit tests
The bug was raised due to a race condition when writing a file and
deleting it. In order to stop it, a check condition was added at the end
of the PersistData() method to remove files that have just been deleted.
* Nit changes
* Add a different constructor for the test
The old description is incorrect. A stock can have positive Alpha but have negative Beta. In this case, if the benchmark increases, the performance of the stock may be dominated by its negative Beta, causing it to underperform the benchmark.
* Adds Unit Tests for ParseFutureSymbol
Tests:
- Ambiguous year with missing decade
- Non-ambiguous known year
- Expiring before 2000
* Fixes Missing Decade Tests
If the ticket doesn't provide a decade, VXZ2, we assume the current decade. So VXZ2 expires on Dec 2022.
* Fixes SymbolRepresentation.ParseFutureSymbol
Use the value of `futureYear` to handle contracts that expire before 2000. (E.g.: NQZ99).
Tickers from live trading may not provide futureYear. Use the current decade (2020).
- Fix bug where there might not be any data to sample. Adding unit test
- Fix bug where candlestick sampling might add point which shouldn't be
there. Adding unit tests
- Adjust series json converter to serialize any base series type. Adding
unit test
* 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>
* Add support for null chart points
- Add support for null value chart points, updating existing and adding
new unit tests
* Minor selfreview tweaks
* Address review & fix deserialization bug
* Ignore null values when using NullResultValueTypeJsonConverter
* Narrow NullResultValueTypeJsonConverter conversion support
* Allow inherit of series sampler
* Solve bug and add unit test
The bug was raised when the sum of the True Range values was zero. Since
the Ultimate Oscillator provides a more reliable indicator of momentum,
if the prices don't change, its value should be zero, as there is no
acceleration of a security's price.
* enhance implementation
* Index.IsTradable Can Be Set
Indices are not tradable. LEAN will not set it to `true`, but the users can for backtesting.
* Adds Regression Tests
* Revert Changes to ProcessSecurityChanges
After running the regression tests in my local pc, I found some of them
were failing in the stats. Then, after debugging them I realized it was
because some of the strings were being casted without using
InvariantCulture parameter.
* Update Future-cme-[*] and Future-cme-ES
Acoording to `pandas_market_calendars` there were some dates in
Future-cme-[*] who wasn't early_closes, so they needed to be removed
from there. On the other hand, the early closes list of Future-cme-ES were
shifted by 1 hour according to CME webpage. Besides, there were some
missing dates.
* Update CME Future entries in MHDB
* Rebase
* nit change
* Fix unit tests
* Resume after early close/halts
* Add missing dates in MHDB and fix bugs in it
* Fix bug, add more unit tests and add docs
* fix regression algos
* address required changes
* Update failing regression test stats
After debugging the tests it was found they were failing due to the last
change on SecurityExchangeHours.IsOpen(). That method wasn't taking into
account that even if there is a late open after an early close if the
timespan is after the early close but before the late open, the market
is still close.
* enhance solution
* Update and fix bugs in MHDB
* Address required changes and update stats
* Update stats after rebase
* Nit change
* Missing update to regression test
* Use MHDB instead of USHoliday for Expiration Dates
VIX expiry function now relies completely on MHDB. However, it had to be
created an entry in MHDB for VIX since there wasn't one for it. CBOE
webpage only provided 2023 holidays so only those dates were considered
in the Holidays entry in MHDB. Therefore, some unit tests failed so it
was necessary to change also the VIX entry in FuturesExpiryFunctionsTestData.xml.
* Remove Global.cs/USHolidays class
* Use a lazy implementation
* First draft of the solution
* Use MHDB in FuturesExpiryFunctions.cs
* Remove unused class and fix indentation errors
* Fix indentation errors
* Nit changes
* Merge branches 7501 and 7506
* Merge changes in 7501 and 7506
In order to check compatibility between those branches, a new branch
was created out of branch 7501 and then it was merged with branch 7506.
2 regression tests and 8 unit tests failed, the regression tests failed on
the DataPoint stats. On the other hand, the unit tests failed since the
default parameter UseEquityHoliday was removed from
FuturesExpirtyUtilityFunctions.AddBusinessDays() and from other methods in
the same class too.
* Add missing changes
* Remove repeated good fridays
* Address minor review
---------
Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
* feat: ETFConstituentsModel overloading constructor
* test
* feat: new constructor of ETFConstituentsUniverse
test: support all constructor on c#
* feat: cached symbol in ETFConstituentsUniverse.py
test: validate getting symbol from cahed collection
* remove: extra ctor in ETFConstituentsUniverseSelectionModel
* refactor: add miss condition secType in py
refactor: rename out existTicker -> Symbol
refacotr: rewrite test
* feat: new ETFConstituentsFrameworkAlgos
* refactor: more neat ETFConstituentsAlgos
* fix: CompositeUniverse to SetUniverse
* 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
* Fix using brokerage transaction handler algo befor set
Brokerage open orders are being set before algorithm is set to the transaction handler, so SetPriceAdjustmentMode needs to get the algo to use
* Update unit tests
* 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
* Shortable modeling improvements
- Do not limit live trading because of shortable model, will send
algorithm warning
- Add Interactive brokers shortable provider
- Minor LocalDiskShortableProvider API changes
* Fix shorted order update
- Fix shorted order update. Updating regression algorithm
* Minor improvement
* Address reviews
* Improves Error Handling in OptionPriceModelResult.Evaluate
Use the maturity calculation to calculate dividend and risk free discount to prevent the `negative time` error.
Adds Exception Message and StackTrade to `DebuggingEnabled` messages.
* Set Evaluation Date Before Every Calculation
Adds loggings to record the reference date which is set by the `Settings.setEvaluationDate` method.
- Once a security has been delisted or no longer selected by any
universe it will be remove from the main algorithm securities
collection but kept in the new Complete collection, this improves
performance in long running backtests where security collection can
get enumerated in different cases
- Minor refactor for security exchange local time to avoid having to set
it explicitly
* correlation as lean indicator #6983
* correlation as lean indicator #6983, added SPY QQQ test and Spearman test
* correlation as lean indicator #6983
* correlation as lean indicator #6983, fixes after review
* correlation as lean indicator #6983, fixes after review
* correlation as lean indicator #6983, fixes after review
* correlation as lean indicator #6983, added AcceptsQuoteBarsAsInput Test
* Minor review changes
---------
Co-authored-by: Grzegorz Wodnicki <info@funchips.co.uk>
Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
* Store traded securities subscription data configs to disk
* Delegate traded subscriptions storage to the data monitor
* Add unit tests
* Address peer review
* Minor changes
* Async universe selection
- Add support for async universe selection, which will happen ahead of
time in the data stack for a performance improvement
* Thrown if using Coarse+Fine Asynchronous Universe selectioon
* Add Bybit brokerage model regression algorithm
* Add BibytFutures brokerage model name and Bybit backtesting regression algorithms
* Add Bybit margin calculations unit tests
* Minor changes in data
* Unify Bybit Spot and Futures brokerage model into one class
* Add new Bybit configurations
* Revert config change
* New Fundamental Data
* Minor CIK lookup fix
* Handle live mode & delete unexisting properties
* Minor coarse fundamental adjustment
* Add fundamental history support
* Fix unit tests
* Performance improvements
* Fixes
* Minor regression algorithm fix
* Improvements. Add FundamentalUniverseSelectionModel
* Change default values
* Fix unit test
* Minor tweaks
* Fix unit test
* Minor error handling improvement
* Fix rebase
Adds a new constructor overload that matches the pattern in Lean: Symbol, Symbol, other types.
Adds a new constructor that infers the indicator name: "B(period)".
* Add new libraries and updates
* ARM foundation update
- Deleting creme library which has been merged into already included river, because it causes copulae build to fail
- Deleting Riskfolio-Lib which would try to install old numpy and fail
* Add ClrBubbleExceptionInterpreter
* Add ClrBubbledExceptionInterpreter tests
* Bump pythonnet version to 2.0.23
* Minor changes
* Minor change
* Minor fix
* Fix failing unit tests
* Set default always open market hours entry for base security without subscription
Also return proper matching subscription for custom data symbols wihtout subscription.
* Minor changes
* Minor change
* Adds `SimpleCustomFillModel` to `CustomModelsAlgorithm`
The simple fill model shows how to implement a simpler version of the most popular order fills: Market, Stop Market and Limit.
This model was tested on QuantConnect Cloud, and will serve as additonal example, since we don't have an example that does not reuse the method of the base class.
* Handles Tick Resolution Case
Tick-resolution data doesn't have TradeBar. We can use the security price, since it represents a trade (`TickTrade`).
* Support sourcing custom data from ObjectStore
* Add Python regression algorithm
* Wire engine to pass ObjectStore down to the stream readers
* Minor changes
* Minor unit tests fixes
* Remove unused SetupHandlerParameters.ObjectStore
* Minor changes
* Minor changes
* Support single-file zipped data to be sourced from object store
* Assert object store custom data history requests in regression algorithms
* Add custom object store data live data feed unit test
* Add multi-file object store custom data regression algorithms
* Minor fix
Calling UniverseDefinition.ETF("TICKER",...) in Python was resolving the UserDefinition.ETF(Symbol...) overload due to Symbol's implicit string operator, causing the symbol to be wrongly created.
* Changes up to the date
* Revert "Changes up to the date"
This reverts commit 45dc9756bc.
* First attempt to solve bug
* Improve solution
* Add unit tests
* Fix bugs and add regression tests
* Solve bugs
* Deprecates IAlgorithmSettings.DataSubscriptionLimit
We will let the brokerage check and notify users that they have subscribed to datafeeds beyond their quota.
* Removes Unit Test
Also remove usage in `EmptyEquityAndOptions400Benchmark`.
* Fix brokerage tests filled order modification race condition
* Listen to fill event in test setup in brokerage tests
* Minor changes
* Address peer review
* Minor changes
* Removed platformId support from C2.
Modernized C2 API calls to APIv4.
Added C2 rate limiters (RateGate).
Added response logging so users can easily debug their code.
Added a few symbols for the demo.
* Address requested changes
* Address requested changes
---------
Co-authored-by: Francis Gingras <francis@collective2.com>
* Add support for Combo Orders with Fill Model
- Override ComboMarketFill, ComboLimitFill, ComboLegLimitFill in
FillModelPythonWrapper.cs
- Modify FillModel.Fill() to use Python Fill model if it exists when the
order is COMBO
- Add regression algorithm ComboOrdersFillModelAlgorithm.py
* Add regression algorithm
* Add regression algos
* Fix bug
* 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
* Add unit test and test data
* Add unit test for model greeks accuracy and comparison
* Add regression test
* Correction on previous unit test to use realtime official IB Greeks
* Switch default American option price model to CRR model
* Address peer review
* Draft of unit test to reproduce error
* Fix bug and regression tests
* Remove draft unit test
* Check fees in ComboMarketOrderAlgorithm.cs
* Fix bug in fees for combo orders
- Update regression tests
- Solve bug in fees when combo orders had legs with different quantity
- Solve bug in fees when combo orders had legs with different security
types
- Update IB comission rate for options where the price is higher than 0.1 USD
* Add explaining comments
* Use leg security fee model
* Fix optimization candlestick handling
- Fixes for optimization candlestick handling
- Centralize deserialization of ChartPoint into new
ChartPointJsonConverter
* Minor fixes
- Update failing tests
- Update CI to fail if anything fails
* Candlestick charts base implementation
* Series and Candlestick series json serialization
* Some cleanup
* Add AddPlot method for candlestick series to QCAlgorithm
* Remove Values property from ISeriesPoint
* Add candlestick QCAlgorithm.Plot trade bar methods
* Implement candlestick series re-sampling
* Add more SeriesSampler unit tests
* Add examples of candlestick charts usage to exisiting charting algorithm
* Address peer review
* Address peer review
* Derive Candlestick from Bar
* Sampler changes
* Add new series types from the cloud
* Add more candlestick series sampler tests
* Minor cleanup
* Minor changes
* 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
* Solve bug in the parameters of the Report
Before, when the number of keys were odd a part of the raw template was
shown in the report generated. Additionally, the user couldn't define
the number of columns of the parameters table
* Add unit tests
* Enhance unit tests
* Nit change
* Add support for custom HTML file in Report
* Add support for custom crisis HTML template
* Revert "Add support for custom crisis HTML template"
After considering this option carefully, the QC team has decided to
add this functionality in a different way.
This reverts commit aead1ff850.
* Get parameters and crisis HTML custom templates
* Move parameters html template to a file
* Nit change
* Remove template.crisis.html and add unit tests
* Nit change
* Nit change
* Add unit tests for the fail cases
* Add trailing stop orders base implementation
* Handle trailing stop order prices rounding
* Implement trailing stop orders fill logic
* Minor fill model changes
* Add ApplySplit to fill model interface for models that might need to be aware of splits.
Filling trailing stop orders require keeping track of min/max prices, which need to be split adjusted.
* Add brokerage order updated event for communicating certain order types prices changes
* Add order update event args class for brokerage side order updates
* Revert IFillModel.ApplySplit
* Add trailing stop orders regression algorithm
* Updated order ticket demo algorithm to include trailing stop orders
* Some cleanup
* Support trailing stop orders in IB brokerage model
* Some cleanup
* Fix failing tests
* Fix failing regression algorithm
* Address peer review
* Add trailing stop price calculation unit tests
* Minor changes
* Minor change
* Add algorithm configurations to Report
* Add just Parameters section in the Report
* Revert "Add just Parameters section in the Report"
This reverts commit 775255127a212db81fc1cc1e23a35b7c60214eac.
* Include just AlgorithmConfiguration.Parameters
* Create ParametersReportElement
* Generate parameters into HTML dynamically
* Enable the user to modify CSS content throu
* Enable CSS override file to be passed through cmdline
* Check CSS Override file exists
* Fix bugs
* Address required changes
* Address required changes
* Address required changes
* Implement RangeConsolidator
It turned out that the behavior of RangeConsolidator was similar to
ClassicRenkoConsolidator. Then, some of the ClassicRenkoConsolidator
methods, were abstracted to new class called BaseTimelessConsolidator.cs,
from which both RangeConsolidator and ClassicRenkoConsolidator could
inherit, therefore resusing code. The following tasks were done:
- Create RangeConsolidator.cs
- Create RangeBar.cs
- Create BaseTimelessConsolidator.cs
- Create RangeConsolidatorTests.cs
- Modify ClassicRenkoConsolidator.cs
* Allow intermediate/Phantom RangeBar's
- Enhance unit tests
- Nit changes
- Allow intermediate/Phantom RangeBar's on RangeConsolidator
* Nit changes
* Create ClassicRangeConsolidator and more changes
- Add regression tests
- Enhance unit tests
* Address required changes
* Address requested changes
* Address requested changes
* Add regression tests with Tick Resolution
* Address required changes
* Increase Range for RangeConsolidatorWithTickAlgo
* Add more unit tests and solve bugs
* Nit change
- Minor adjustment not to transition from canceled to invalid order
status, which can happen in some cases in live trading as a race
condition. Adding unit test
- Make sure open order status is set to submitted if none provided,
adjusting existing test
- Always respect the minimum time in universe even if we haven't gotten
any data point yet. This is specially useful for live trading options
which are illiquid
* Changed argument exceptions so that they used the nameof() operator for parameter names
* Update IQSocket.cs
---------
Co-authored-by: John Doe <john@doe>
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Contract chain selection improvements
- Adjust contract chain selection behavior for futures and options so we
are sure to use the correct local time when filtering expirations.
Adding unit test reproducing issue
* Update futures regression algorithms
* Address reviews
* Fix contract security filter universe
- Fix for contract security filter universe which would would use .Time
to filter expirations which could be yesterdays time at midnight
localtime. Adding unit tests reproducing issue
* Update regression algorithms
* Update MHDB CBOT Futures on Good Friday
* Update MHDB CME Futures on Good Friday
* Update MHDB CBOT Futures on Good Friday
* Update MHDB CME Futures on Good Friday
* Update MHDB comex and nymex futures on good friday
* Revert "Update MHDB comex and nymex futures on good friday"
Since all nymex and comex futures had a holiday on Good Friday, it's
better to add the holiday on `Future-nymex-[*]` and `Future-comex-[*]`
This reverts commit e111c8e461.
* Remove Good Friday holiday for cme and cbot futures
- Remove Good Friday holiday from `Future-cme-[*]` and `Future-cbot-[*]`
- Add Good Friday holiday for specific cme and cbot futures
* Add unit tests and update MHDB
- Add unit tests asserting LEAN reads correctly Good Friday holidays and
early closes for CME Group Futures
- Update the holidays for other CME group Futures on MHDB
* Fix bugs
* Enhance unit tests
* Add security dynamic properties unit and regression tests.
These assert that dynamic properties that are instances of python classes that inherit c# classes keep their python object references.
* Minor change
* Bump pythonnet version to 2.0.21
* Fix security dynamic properties cast from PyObject
* Minor change
* Minor tweaks to avoid CI tests random failures
- Increate timeout of research start test, using default value
- Minor tweaks for rate gate to improve performance
* Clean up rategate tests
* Update MHDB with NYSE and ICE holiday hours
- Update holidays and early closes for ´Equity-usa-[*]´
- Update holidays for certain products from Ice Futures US
* Add missing holiday hours in MHDB for CME-G Futures
- The missing holiday hours were from 3 July 2023
* Remove duplicates
* Address JB comment
* Remove repeated fields in BaseRenkoBar
- Add new unit test to all indicators that inherit from
IndicatorBase<TradeBar>. This test asserts the indicators can receive
RenkoBar's as input
* Add Regression test and improve unit tests
- Change `Volume` property from `RenkoBar.cs` since RenkoBar's don't
have Volume. Now it throws an error when accessed
* Address required changes
* Add Python regression test and enhance unit tests
* Enhance unit and regression tests
* Assert indicator current value at the end
* Allow more indicators to use Renko/VolumeRenkoBar
* Fix Security.IsMarketOpen for cases outside regular MH and last bar
* Minor changes
* Move bar check of IsMarketOpen into FillModel
* Minor changes
* Minor changes
* Minor changes
* Fix bug
- Add `ResetHandler()` and `IsReset` field in `CompositeIndicator.cs`
- Modify `CompositeIndicator.Reset()` to invoke the IsReset event
- Modify `VolumeWeightedAveragePriceIndicator.Reset()` method to reset
its composite indicator
- Modify `IndicatorExtensions.WeightedBy()` to register an event to the
returned composite indicator `IsReset` field
* Enhance implementation
* Address Requested changes
* Nit changes
* Nit change
* Nit change
* Address chages
- Make ResetCompositeIndicator inherit from CompositeIndicator and
override `Reset()` method
- Add ResetCompositeIndicator unit tests
- Modifiy IndicatorExtensions to keep returning the same type in
`WeightedBy()` method
* Avoid modify other IndicatorExtensions methods
* Nit changes
* Reset inner indicators and add more unit tests
* Dynamic security properties for quick objects storage
* Documentation and other minor changes
* Add Security indexer to access custom properties
* Address peer review
* Minor changes
* Improve regression algorithms
* Bumped pythonnet to version 2.0.19
* Bumped pythonnet to version 2.0.20
* Address peer review
* Fix bug and add unit tests
- Modify `InsightWeightingPortfolioConstructionModel.cs/py` to take the
absolute value in its `GetValue()` method
- Modifiy `InsightsReturnsTargetsConsistentWithDirection()` unit test to
consider also the case where the direction is Down and the weight is
negative
* Nit changes
* Fix bug
The algorithm `CustomPartialFillModelAlgorithm.cs` was not working as
expected with short orders because in its Fill model, the variable
`absoluteRemaining` instead of decrease was being increased since
the `FillQuantity` in each call to this method was negative. Therefore
when this amount was substracted to `absoluteRemaining`, instead of
substract, it was added. Hence the method created more partial orders
than expected, specifically: 580 short orders for SPY with Quantity -10.
* Fix `CustomPartialFillModelAlgorithm.py`
* Address required changes
* Nit change
* Address required changes
* Make statistics available at runtime to algorithms
* Re-calculate statistics on every call
* Housekeeping
* Add regression algorithms
* Address peer review
* Support for custom summary statistics at runtime
* Minor changes
* Address peer review
* Address peer review
* Minor changes
* Minor changes
* Fix bug and add unit tests
The bug was raised because rounding the first point inserted in the
RenkoConsolidator didn't get the closest y-multiple of the given number
x, where y is the bar-size. In order to compute the first y-multiple of
the given number x, we need to first compute x mod y := x - y*Floor(x/y),
once we get this number we divide it by y to know if we should round x
to minimum y-multiple greater than x, or should round x to the maximum
y-multiple smaller than x. If (x mod y)/y < 0.5 we round down, otherwise we round up (the amount (x mod y)/y is always less than one and higher than 0). See the Art of Computer Programming, Vol I. Donald E. Knuth.
- Add `GetClosestMultiple()` method in `RenkoConsolidator.cs`
- Add more unit tests
* Nit change
* Add XML docs
* Address required changes and add more unit tests
* Implement indicator history through a rolling window
* Minor changes and extend unit tests
* Add regression algorithms
* Minor changes
* Update regression algorithms examples
* Move resizing logic from IndicatorBase to RollingWindow
* Add unit tests and other minor changes
* Minor fix
* Add unit tests and other minor changes
* Add unit test
* Fix position group BP calculation
* Fix position group BP calculation
* Extend option startegy buying power unit tests
* Fix option strategy buying power calculation to account for order direction
* Fix bug, add unit tests and nit changes
The bug was raised because if two inputs points with repeated close values were inserted,
and the second one had 0 volume, when the first one is removed from
_oldDataPoints, as the reamaining value of it in _volumePerPrice is
zero, that entry is removed from _volumePerPrice. Therefore, when
the second input point is removed from _oldDataPoints, this entry
is not found in _volumePerPrice. Then the changes made were:
- Modify MarketProfile.Add() method to check every removed data point is
still in _volumePerPrice
- Add unit tests to covert this change
- Nit changes in VolumeProfileTests.cs
* Fix bugs and add more unit tests
- The Fill Forward bars shouldn't be considered in the calculations as
it's not real data.
- If bar inserted is not FF but has zero volume, it could remove a price
value from VolumePerPrice and leave this sorted list empty, then each
time we access that list we need to first check it's not empty
* Enhance ComputeNextValue() and add more unit tests
- Lean engine will automatically add an options underlying if not
present, but in most cases the option chain will select the underlying
too, so let's make sure the configurations match. Previous to this
change 'fill forward' setting could be different causing the
underlying to be duplicated in the data stack
- Adjusting live stack to emit live auxiliary events based on factor files.
Updating existing tests
- Minor improvements for map & factor file provider daily refresh time.
Adding unit tests
* Add ShortButterflyCall and ShortButterflyPut strategies helper factory methods
* Reduce duplication by adding the base OptionStrategyFactoryMethodsBaseAlgorithm algorithm class
* Housekeeping
* Fix bug in Beta statistics
- Beta in Report was calculated using equity points and not daily
performance points, as it's done in Backtest
- Performance points were not being divided by 100, as it's done in
StatisticsBuilder
- Benchmark points were not being converted into a percentage daily
performance of the benchmark, as it's done in StatisticsBuilder
* Improve implementation and add unit tests
* Enhance implementation and add more unit tests
* Enhance implementation
* Nit change
* Nit changes
* Make maintenance margin zero for long options
* Use OptionIntialMargin in OptionMarginModel
* Add naked call and put strategies unit tests
* Minor fix
* Account for premium in option strategies margin
* Minor fixes
* Add OptionInitialMargin class to separate strategies margin and premium
* Minor fix
* Minor fix
* Cleanup, docs and other minor changes
* Minor changes
* Minor changes
* Minor changes
* Address peer review
* Add SetAccountCurrency overload
- Add SetAccountCurrencyOverload to allow the user to set also account
currency quantity
- Add regression and unit tests to cover the changes
* Add regression algos
* Simplifiy SetAccountCurrency implementation
* Minor changes
* Minor changes
* Add support for Null SecurityPositionGroupModel
- Add support for algorithms to set the null security position group
model which will not group securities together but rather return the
single group buying power model. Adding regression algorithms
* Add Null Margin python regression & cleanup
- Add python regression algorithm & minor regression algorithms clean up
* Fix position group HasSufficientBuyingPowerForOrder
Comparing computed delta BP -- which already considers every impacted
group -- with the right available buying power (the remaining margin)
* Minor changes
* Pandas frame include all ticks
- Pandas data framde history response will include all ticks. Updating
existing and adding new tests
* Python pandas converter performance improvement
* Handle liquidating option position with an option strategy
* Handle liquidating option position with an option strategy
* Minor changes
* Minor fix in default margin model margin call order generation
* Add TriggerPrice field when applying a split
If one stock is split in k parts, the new TriggerPrice in an order for that stock should be also scaled by a factor of k/10. It was made:
- Modify `DefaultBrokerageModel.ApplySplit()` to adjust `TriggerPrice` field
- Regression and unit test was added
* Check Limit Price for LimitIfTouched
* Nit change
* MHDB will merge common entry
- The MHDB will merge the market and security common entry holidays,
early closes and late opens
* Normalize & reuse future US holidays
- Normalize & reuse future US holidays
* Update existing unit tests expected stats
* Fix PositionGroupBuyingPowerModel quantity for delta calculation
The model was calculation the order size that required a margin equal to
the given delta. This fix makes it so that it calculates the position
group order quantity required to get the given buying power delta,
taking into account the holdings for the existing position group in the portfolio.
* Fix PositionGroupBuyingPowerModel quantity for delta calculation
* Add unit tests
* Add unit tests
* Add unit tests
* Housekeeping
* Housekeeping
* Adapt unit tests and move messages to Messages class
* Improve quantity calculation for target BP loop
- PositionGroup.Quantity is now always positive.
- Added PositionGroupExtensions.Closes method and use it to check if reducing a position in PositionGroupBuyingPowerModel.GetPositionGroupBuyingPower. This is necessary since now a PositionGroup side is always "long" (see first bullet point).
* Improvements
* Improvements and new PositionGroup unit tests
* Unit tests improvements
- HasSufficientBuyingPowerForOrder test cases were completely updated to
make it accurate in terms of Lean's margin calculation.
- BuyingPowerForPositionGroupCalculation test was fixed in order to get
the correct expected result.
* Fixes for failing tests
* Added additional check to OptionStrategyMarginCallEventsAlgorithm
* Improve documentation comments
* Fix option strategies BuyingPowerForPositionGroupCalculation unit test
* Fix PositionGroupBuyingPowerModel.GetPositionGroupBuyingPower
Also address peer review
* Minor changes
* Update unit tests for new inverse strategies
Also fixed PositionGroupExtensions.WithQuantity to resolve inverse
strategy
* Minor fix
* Allow target/delta to go to the opposite direction of the position group
* Housekeeping
* Handle quantity for target/delta BP request for different reference position group
* Revert removal of PositionGroupBuyingPowerParameters.Direction
* Minor changes
* Peer review
* Minor tweaks on the position group buying power model
* Minor fix
* 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
* Minor fix CrunchDao Symbology
- Minor fix for CrunchDao Symbology. Updating existing tests
* Add missing symbol mapping
- Add IAlgorithm.Ticker(Symbol) functionality which will return the
latest ticker for the requested symbol at the current algorithm time
- SignalExporters will use Ticker to get the current symbol ticker
* Rename SecId GetTicker to Ticker
* Solve bug and add regression test
The bug was raised because, when trying to use C#
MeanVarianceOptimizationPortfolioConstructionModel from a Python
algorithm, there wasn't a constructor that accepted a portfolio optimizer
as a PyObject. Additionally, there wasn't also a Python Wrapper to wrapp
that portfolio optimizer.
- Add PortfolioOptimizerPythonWrapper.cs
- Add constructor in
MeanVarianceOptimizationPortfolioConstructionModel.cs that accepts
portfolio optimizer as a PyObject
- Add regression algorithms to cover the changes
* Improve constructor overload implementation
* Change implementation to follow API pattern
* Enhance implementation and add unit tests
* Enhance implementation and add more unit tests
* Enhance implementation
* Implement Unregister helper method
- Implement Unregister helper method, each indicator which hold a
reference to the consolidators updating it. Adding regression
algorithms
* Fix for QuantBook indicators
* Address reviews
- Custom data universe selection market hours. Adding regression test
asserting the behavior. Updating existing tests due to market hours
change, triggering selection always, even the 4th of July 2018
* Add short call calendar spread strategy and review margin calculation
* Add short Put calendar spread strategy and fixed naked short options margin calculation
* Minor changes
* Minor changes
* Minor changes
* Solve the bug and add unit test
- The bug was raised because if something went wrong trying to register an indicator with a C# or a custom consolidator the exception raised was lost, because the catch sentence didn't return it with another exception
- A unit test was added asserting a exception with a related message was raised each time something went wrong with the consolidator
* Fix bugs and enhance unit tests
* Fix bug
* Handle unsupported orders and add unit tests
- Capture more Tradier Brokerage order limitations
- Add unit tests to cover this changes
* Enhance implementation and add more unit tests
* Enhance implementation and add unit test
* Remove IsMarketOrderGTC condition
* Remove error message MarketOrderIsGtc
* Covered and Protective Call and Put
- Improve covered call and put margin requirements based on IB
- Add missing protective call and puts strategies (inversion of a
covered call). Adding unit tests
* Fixes
* Add missing tests
* Expire Instead of Clear Insights In Base PCM In OnSecuritiesChanged
* Fixes Regression Test
The regression was incorrect because `_removedSymbols` didn't retain the removed symbols from previous `OnSecuritiesChanged` calls, and the algorithm relances once per month. E.g. On day 1, SPY and FB were removed, on day 3 AAPL and IBM were removed and `removedSymbols` would only include AAPL and IBM.
We should hve fixed this problem before with:
```csharp
if (_removedSymbols == null) _removedSymbols = new List<Symbol>();
_removedSymbols.AddRange(changes.RemovedSecurities.Select(x => x.Symbol));
```
However the change to use Expire fixes the issue.
* Removes Unused List of Removed Symbols
* Handle unsupported orders and add unit tests
- Capture more Tradier Brokerage order limitations
- Add unit tests to cover this changes
* Enhance implementation and add more unit tests
* Enhance implementation and add unit test
* Fix potential bug and add more docs
As FeeInBase and FeeInQuote are mutually exclusive, if one was set to true, the other one should be set to false. It was added information about where it's used and how fee currency selection works in Kraken.
* Nit change
* Simplify XML docs
* 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
* Add option strategy position group BPM tests
Tests added for calculating order quantity for a delta buying power
* Add option strategy position group BPM margin calculation tests
* Add option strategy position group BPM margin calculation tests
* Add option strategy position group BPM margin calculation tests
* Add option strategy position group available BPM calculation tests
* Add option strategy position group impact buying power calculation
* Housekeeping
* Unit tests improvements
* Unit tests improvements
* Add more unit tests
* Address peer review
* Add forward data only fill model example
- Add forward data only custom fill model C# & PY example.
- Minor adjustment for 'MarketOrderFillTimeout' to be zero always in
backtesting
* Address reviews
* Add support for brokerage side new orders
- Add support for brokerage side new order events for liquidation cases
* Minor cash delta fix
* Improve account cash logging
* Fix null reference exception for open orders
* Implement ShortableProviderPythonWrapper.cs
- Modify AllShortableSymbolsCoarseSelectionRegressionAlgorithm.cs and ShortableProviderOrdersRejectedRegressionAlgorithm.cs to use ShortableProvider from Security and not from the Brokerage model
- Add SetShortableProvider() overload method in Security.cs to set a custom shortable provider from Python
- Remove AllShortableSymbols() method from LocalDiskShortableProvider.cs
- Remove DefaultShortableProvider class
- Add regresion algorithms in C# to cover the changes done
* Revert "Merge process"
This reverts commit 775a4b8ec1, reversing
changes made to bcc3e790f6.
* Revert "Revert "Merge process""
This reverts commit aa18fb40ee.
* Solve bugs
- Solve bugs in DefaultMarkets, CanUpdateOrder() and CanSubmitOrder() methods from BrokerageModelPythonWrapper.cs
- Add regression algos in both Python and C# to cover the changes
* Catch potential errors and add unit tests
* Add more unit tests
* Nit change
* Enhance implementation, add more unit tests
* Add IndexOptionPriceVariationModel
- Add IndexOption price variation model to handle price based minimum
price variation. Adding unit tests
* Minor improvements for VIX & VIXW
* Refactor settlement mode api
- Add new Scan method on ISettlementModel API. To be used by
futures settlement model mark to market handling
- Use 'Parameters' classes for 'ISettlementModel'
* Address reviews
* Daily future settlement
- Implement daily future settlement. Adding unit & regression tests
* Address reviews
* Assert cash balance every day
* Refactor settlement mode api
- Add new Scan method on ISettlementModel API. To be used by
futures settlement model mark to market handling
- Use 'Parameters' classes for 'ISettlementModel'
* Address reviews
* Fix multiple option strategies liquidation
When holding multiple position groups of the same underlying, reverting
one of the groups was not possible because of the presence of the other
position groups, which caused no matching groups to be formed for the
order.
* Make OptionStrategyPositionGroupResolver not group single position
* Revert make OptionStrategyPositionGroupResolver not group single position
* Implement ShortableProviderPythonWrapper.cs
- Modify AllShortableSymbolsCoarseSelectionRegressionAlgorithm.cs and ShortableProviderOrdersRejectedRegressionAlgorithm.cs to use ShortableProvider from Security and not from the Brokerage model
- Add SetShortableProvider() overload method in Security.cs to set a custom shortable provider from Python
- Remove AllShortableSymbols() method from LocalDiskShortableProvider.cs
- Remove DefaultShortableProvider class
- Add regresion algorithms in C# to cover the changes done
* Revert "Merge process"
This reverts commit 775a4b8ec1, reversing
changes made to bcc3e790f6.
* Revert "Revert "Merge process""
This reverts commit aa18fb40ee.
* Solve bug
- Add new constructor overload in OpenInterestFutureUniverseSelectionModel.cs that accepts future chain symbol selector as PyObject
- Add a private static method in OpenInterestFutureUniverseSelectionModel that converts Python lambda function to Func<DateTime, IEnumerable<Symbol>>
- Add a regression algorithm in Python to cover changes. In these case, add Python version of OpenInterestFuturesRegressionAlgorithm.cs
* Nit changes
* Nit change
* Minor docs tweak
---------
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Implement ShortableProviderPythonWrapper.cs
- Modify AllShortableSymbolsCoarseSelectionRegressionAlgorithm.cs and ShortableProviderOrdersRejectedRegressionAlgorithm.cs to use ShortableProvider from Security and not from the Brokerage model
- Add SetShortableProvider() overload method in Security.cs to set a custom shortable provider from Python
- Remove AllShortableSymbols() method from LocalDiskShortableProvider.cs
- Remove DefaultShortableProvider class
- Add regresion algorithms in C# to cover the changes done
* Implement ShortableProviderPythonWrapper.cs
- Modify AllShortableSymbolsCoarseSelectionRegressionAlgorithm.cs and ShortableProviderOrdersRejectedRegressionAlgorithm.cs to use ShortableProvider from Security and not from the Brokerage model
- Add SetShortableProvider() overload method in Security.cs to set a custom shortable provider from Python
- Remove AllShortableSymbols() method from LocalDiskShortableProvider.cs
- Remove DefaultShortableProvider class
- Add regresion algorithms in C# to cover the changes done
* Solve bugs and nit change
* Address review
---------
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Solve Report Generation Conversion Rate Error bug (#7183)
* Solve bug
Remove if sentence that checked if Portfolio contained securities that
needed a conversion, like Forex, Crypto or Cfd. It didn't take into
account CryptoFutures so when the backtest result used that kind of
security types it never found a conversion for them. Making a git blame
for Report.PortfolioLooper constructor it was found the if sentence was
not needed so it was removed and then different reports were made for
algorithms that used security types different than Forex,Crypto,Cfd and
CryptoFutures to check everything was still working as expected.
* Solve bug
Remove if sentence that checked if Portfolio contained securities that
needed a conversion, like Forex, Crypto or Cfd. It didn't take into
account CryptoFutures so when the backtest result used that kind of
security types it never found a conversion for them. Making a git blame
for Report.PortfolioLooper constructor it was found the if sentence was
not needed so it was removed and then different reports were made for
algorithms that used security types different than Forex,Crypto,Cfd and
CryptoFutures to check everything was still working as expected.
* Missing Python Version of Crypto Future Algorithms - Issue 7128
* Address reviews
---------
Co-authored-by: hungv <hungv@compatibl.com>
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Add dataMappingMode parameter to every history api method overload
* Minor unit tests fixes
* Update regression algorithm stats
* Minor changes
* Minor changes
- Validate cache folder exists before using it
- Avoid duplication fetching factor & map files path
- Adding helper method to check if directory is empty. Adding unit tests
- Create `SecurityDataFilterPythonWrapper.cs`
- Modifiy `Security.cs` to set a data filter, whether is a C#, Python derivative or custom data filter custom
- Add Python and C# regression algorithms to assert the changes
* Add extendedMarket parameter to every history api method overload
* Rename extendedMarketHours parameter
New name is extendedHours as in the History API to standarize parameters naming
* Update generic history overloads to use every matching subscription
* Update regression algorithms stats
* Centralize period-based history error for tick resolution
* Rename extended market hours parameter to extendedMarketHours
* Minor changes
* Minor changes
* Minor unit tests changes
* Minor unit tests changes
* Minor changes
* Minor unit tests changes
* Minor unit tests changes
* Added PyStan Library in DockerfileLeanFoundation
* Add new libraries and unit tests
---------
Co-authored-by: Ivan Radigales Creus <ivanrdgc@gmail.com>
* Implement `OptionExerciseModelPythonWrapper.cs`
- Modifiy `Option.cs` to set the automatic exercise model, even if it's a python custom option model exercise model
- Add `QuantConnect.Orders.OptionExercise` in `AlgorithmImports.py`
- Add regression algorithms in C# and Python showing how to specify a custom option exercise model
* Address required changes
- Remove unnecessary constructor in
´CustomOptionExerciseModelRegressionAlgorithm.cs´
- Change `.Dispose()` in `OptionExerciseModelPythonWrapper.OptionExercise(9` to ´using´ keyword
- Change `Option.SetOptionExerciseModel()` XML docs
* Minor tweaks
* Update CustomOptionExerciseModelRegressionAlgorithm.cs
---------
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Add fillForward parameters to every History method
* Remove conflicting Python history method
* Undo removing conflicting Python history method
* Minor changes
* Minor changes
* Minor changes
* Add fillForward and extendedMarket parameters to history request factory
* Minor changes
* Minor changes
* Minor changes
* Minor changes
* Minor unit tests changes
* Rename fillForward parameter in History API
New name if fillDataForward as in the Add*Security API to standarize
parameters naming
* Rename fillForward parameter
Using the shorter fillForward in every API
* Solve bug
Remove if sentence that checked if Portfolio contained securities that
needed a conversion, like Forex, Crypto or Cfd. It didn't take into
account CryptoFutures so when the backtest result used that kind of
security types it never found a conversion for them. Making a git blame
for Report.PortfolioLooper constructor it was found the if sentence was
not needed so it was removed and then different reports were made for
algorithms that used security types different than Forex,Crypto,Cfd and
CryptoFutures to check everything was still working as expected.
* Solve bug
Remove if sentence that checked if Portfolio contained securities that
needed a conversion, like Forex, Crypto or Cfd. It didn't take into
account CryptoFutures so when the backtest result used that kind of
security types it never found a conversion for them. Making a git blame
for Report.PortfolioLooper constructor it was found the if sentence was
not needed so it was removed and then different reports were made for
algorithms that used security types different than Forex,Crypto,Cfd and
CryptoFutures to check everything was still working as expected.
* Add Collective2SignalExportClass
Add SignalExportTarget interface
* Collective2SignalExport test working
Add SignalExportManager
Add draft of CrunchDAOSignalExport
* Modify SignalExportManager
Instantiate SignalExportManager in QCAlgorithm constructor
Draft of CrunchDAOSignalExport
* Improve SignalExportManager
- Add regression tests SignalExportDemonstrationAlgorithm in C# and
Python
* Improve SignalExportDemonstrationAlgorithm
Address requested changes in Collective2SignalExport, SignalExportManger and SignalExportTargetTests.cs
* Add CrunchDAOSignalExport.cs
Add CrunchDAOSignalExport unit tests in SignalExportTargetTests.cs
* Add NumeraiSignalExport.cs
Modify SignalExportDemonstrationAlgorithm.cs to test NumeraiSignalExport
Add unit test in SignalExportTargetTests to test NumeraiSignalExport
* Address required changes
- Add BaseSignalExport.cs
- Add SignalExportParameters.cs
- Add PortfolioSignalExportDemonstrationAlgorithm.cs/py
- Improve Error handling in SignalExport provider classes
- Collective2SignalExport now gets the correct number of shares for each holding
- SignalExportManager now computes the correct holding percentage of each portfolio target
- SignalExportManager now takes into account if the algorithm is in live mode
- Demonstration algorithms now are more simple
* Address last required changes
- PortfolioSignalExportDemonstrationAlgorithm.cs/py now inherits from SignalExportDemonstrationAlgorithm.cs/py
- Add more unit tests to assert SignalExportManager gets the correct percentage quantity for each holding
- Change Collective2SignalExport, CrunchDAOSignalExport and NumeraiSignalExport Send() method to return true if there was no error while sending the signals and false otherwise
- Nit changes
* Remove exceptions thrown
- Add more unit tests and more test cases
- Enhance BaseSignalExport.Dispose() method
* Add Collective2SignalExportClass
Add SignalExportTarget interface
* Collective2SignalExport test working
Add SignalExportManager
Add draft of CrunchDAOSignalExport
* Modify SignalExportManager
Instantiate SignalExportManager in QCAlgorithm constructor
Draft of CrunchDAOSignalExport
* Improve SignalExportManager
- Add regression tests SignalExportDemonstrationAlgorithm in C# and
Python
* Improve SignalExportDemonstrationAlgorithm
Address requested changes in Collective2SignalExport, SignalExportManger and SignalExportTargetTests.cs
* Add CrunchDAOSignalExport.cs
Add CrunchDAOSignalExport unit tests in SignalExportTargetTests.cs
* Add NumeraiSignalExport.cs
Modify SignalExportDemonstrationAlgorithm.cs to test NumeraiSignalExport
Add unit test in SignalExportTargetTests to test NumeraiSignalExport
* Address required changes
- Add BaseSignalExport.cs
- Add SignalExportParameters.cs
- Add PortfolioSignalExportDemonstrationAlgorithm.cs/py
- Improve Error handling in SignalExport provider classes
- Collective2SignalExport now gets the correct number of shares for each holding
- SignalExportManager now computes the correct holding percentage of each portfolio target
- SignalExportManager now takes into account if the algorithm is in live mode
- Demonstration algorithms now are more simple
* Address last required changes
- PortfolioSignalExportDemonstrationAlgorithm.cs/py now inherits from SignalExportDemonstrationAlgorithm.cs/py
- Add more unit tests to assert SignalExportManager gets the correct percentage quantity for each holding
- Change Collective2SignalExport, CrunchDAOSignalExport and NumeraiSignalExport Send() method to return true if there was no error while sending the signals and false otherwise
- Nit changes
* Remove exceptions thrown
- Add more unit tests and more test cases
- Enhance BaseSignalExport.Dispose() method
* Fix failing regression tests
* Fix failing unit tests
* Nit changes
* Nit change
* Nit change
* Fix failing unit tests
* Changes required
- Break regression algos `SignalExportDemonstrationAlgorithm.cs/py` nad `PortfolioSignalExportDemonstrationAlgorithm.cs/`y` into three ones, one for each signal export provider
- Change SignalExportManager constructor to receive current algorithm as a parameter
- Fix bug in `SignalExportManager.GetPortfolioTargets()`, now it computes the correct percentage for each holding
- Make `BaseSignalExport.DefaultAllowedSecurityTypes` overrdible
- Handle case were `Collective2SignalExport.ConvertPercentageToQuantity()` returns null
- Clean unnecessary code in `Collective2SignalExport()`, `CrunchDAOSignalExport()` and `NumeraiSignalExport()`
* Nit change
* Nit change
* Minor tweaks after review
* Remove indexes from signal exports
* Required changes
- Change EMA indicators period from 200, 300 to 10,100 in regression algorithms
- Remove Indices from regression algorithms
- Add more XML documentation to regression algorithms
- Change `Log.Error` to `_algorithm.Error` in Signal export providers. Besides, fix error message format
- Change default value for `platformId` parameter in `Collective2SignalExport.cs` constructor
- Solve small bugs in SignalExportProvider when verificating the amount of porfolio targets is greater than zero and each portfolio target is allowed
- Handle case when `PortfolioTarget.Percent()` returns null in `Collective2SignalExport.ConvertPercentageToQuantity()`
- Handle error format message from Collective2 API
- Check every ticker signal is between 0 and 1 (inclusive) in `CrunchDAOSignalExport.cs`
- Modifiy `NumeraiSignalExport.cs` constructor to take into account filename given in the arguments
- Fix small bug with the return value of `ConvertTargetsToNumerai()` method in `NumeraiSignalExport.cs`
- Modify `SignalExportManager.cs` to return true when the algorithm being ran is not in live mode
- Remove indices from CrunchDAO unit tests
* Enhance ´CrunchDAOSignalExport.cs´ implementation
---------
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Fix EMA indicator first value calculation
As done by TALib and TradingView, the first EMA value after warmup is
the SMA of the first period.
* Update TSI indicator test data
Data was exported from TradingView
* Update TRIX indicator test data from TradingView
* Update AccumulationDistributionOscillator indicator test data from TradingView
* Update Double EMA indicator test data from TradingView
* Update McClellanSummationIndex indicator test data
* Update SchaffTrendCycle indicator test data
* Update TripleExponentialMovingAverage indicator test data from TradingView
* Update stats for algorithms using EMA
* Update failing unit tests
* Handle position group margin calls
* Minor changes
* Update regression algorithms
* Minor changes
* Minor changes
* Added regression algorithm
* Peer review
* Peer review
* Peer review
* Peer review
* Minor changes
* Minor changes
* Add unit test
* Allow sufficient buying power when closing position group
* Add unit test
* Improve regression algorithms
* Fix ReportCharts color_map bug
- Add ´CryptoFuture´ entry in `color_map` dict using color #E55812
- Make ´ReportCharts.py´ color_map a class attribute
- Change ´ReportChartsTests.cs´ to use color_map dict from ´ReportCharts.py´
- Add unit test that fails every time a new SecurityType is added
* Improve unit test
* Nit change
* Nit change
* Updated MHDB and CME currencies futures expiry functions
Some expiry functions needed to take into consideration the security
holidays
* Add more holidays to CME securities in MHDB
* Update regression test to check number of insights
* Update model to have insight manager ref and cancel insight when signal goes flat
* Update unit tests and regression tests
* Address peer review: using Insights.Clear
* Invalidate option strategies orders when short selling over margin
When shorting an option strategy with margin requirements that cannot be
met, the order should be invalidated. The buying power model is now able
to detect said situation and result in unssuficient buying power.
The OptionsMarginModel now uses the parameters instance values instead
of the security holdings to compute margin requirements. This fixes the
situation when calculation buying power for a first time position with
no holdings.
* Add and fix unit tests
* Update regression algorithms
* Peer review
* Downloader data provider fixes
- Fix stored data time zone, which is expected in data time zone
- Minor logging improvements
- LeanData Parse handles etf universes path. Adding unit test
- LeanDataWrite will only map if there's something to map to
* Fix download data provider synchronization
* Synchronization improvements after more testing
- KeyStringSynchronizer will handle reentrancy. Adding unit tests
- Define a unique Synchronizare for downloading data, since not related
to disk reading & writting
* LeanDataWriter can handle mapping
- Adjust LeanDataWrite so that it can handle symbol mapping if required.
Adding unit tests
* Fix Lean Data path parsing
* Updates Regression Algorithm to Assert the Number of Insights
* Updates HistoricalReturnsAlphaModel to Cancel Insights Not Emit Flat
We expect fewer insights after this change, but no changes to any regression algorithm.
* Updates Regression Algorithm
Assert the new expected number of generated insights.
* Use InsightCollection Clear Method
Replaces old `TrailingStopRiskFrameworkAlgorithm` for `TrailingStopRiskFrameworkRegressionAlgorithm` that inherits from `BaseFrameworkRegressionAlgorithm` as a member of the framework regression tests.
* Update regression test
* Update model to expire insights
* Avoid remove insights
* Update regression test
* Use InsightManager Cancel to Expire All Insights
* Update CompositeRiskManagementModelFrameworkAlgorithm
This regression also depends on `MaximumUnrealizedProfitPercentPerSecurity` and `MaximumDrawdownPercentPerSecurity` but `MaximumDrawdownPercentPerSecurity` doesn't close positions.
---------
Co-authored-by: Alexandre Catarino <AlexCatarino@users.noreply.github.com>
* Remove OnEndOfAlgorithm and update expected trades
* Update models to cancel insights
* Update expected results
There are 3 trades instead of 2 because the PCM does a rebalance
* Remove `Remove` method call
* Update to use the new `Cancel` method
If we use `.astimezone(dt.tzinfo)`, the new time was convering the timezone from local (e.g. PST) to GMT (dt.tzinfo). In this case, we only want to remove the timezone to enable the operation.
* Renames and Updates BaseAlphaModelFrameworkRegressionAlgorithm
The `BaseFrameworkRegressionAlgorithm ` will be used for multiple framework regression tests
* Updates and Renames EmaCrossAlphaModelFrameworkAlgorithm
Adds "Regression" to inform that it's a regression algorithm.
* Updates and Renames MaximumPortfolioDrawdownFrameworkAlgorithm
Adds "Regression" to inform that it's a regression algorithm, and use the model name: `MaximumDrawdownPercentPortfolio`
* Adds New Regression Algorithms
* Adds BaseAlphaModelFrameworkRegressionAlgorithm
`BaseAlphaModelFrameworkRegressionAlgorithm` will be used to validate Alpha Model regression algorithm with the same universe.
- HistoricalReturnsAlphaModelFrameworkAlgorithm
- EmaCrossAlphaModelFrameworkAlgorithm
- MacdAlphaModelFrameworkAlgorithm
- RsiAlphaModelFrameworkAlgorithm
- BasePairsTradingAlphaModelFrameworkAlgorithm
* Addresses Peer-Review
* Fix fill quantity using group order quantity for combo orders
* Add Order's ComboQuantity property
* Add Order's ComboDirection property
* Minor changes and regression algorithms update
* Minor changes
* Update algorithms stats
* Minor changes and regression algorithms update
* Store the full quantity for each combo order leg in Quantity property instead of the ratio
* Minor changes and regression algorithms update
* A few fixes after pair programming
* Handle grouping position reduction
---------
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Improves MinimumVariancePortfolioOptimizer Values Handling
The C# version of the `MinimumVariancePortfolioOptimizer` generated NaN resulting in unit tests failing.
If the solver returns NaN for an item, we set it to zero. if all items are NaN or Zero, we return the initial guess, since the sum cannot be zero.
* Fixes `RiskParityPortfolioConstructionModelTests`
We need to add insights to insight manager before we call `CreateTargets`.
* Adds Unit Test
Asserts that we can remove a consolidator that was previously added.
* AddConsolidator Method Only Wraps Non-C# Consolidators
This behavior was implemented in `QCAlgorithm.RegisterIndicator` to avoid wrapping an object unnecessarily.
- Improve LeanData aggregation helper methods to use shared consolidator based implementation
- Adding Tick to tradeBar aggregation
- Adding more unit tests
- Fix data-queue-handler configuration initialization using paper brokerage
- Fix for downloader data provider request times
- Fix null reference exception in live result handler if algorithm is
null
* Asserts Number of Insights In One PCM Regression Test
If the `EqualWeightingPortfolioConstructionModel` interacts with the `QCAlgorithm.Insights`, the number of elements in the collection should not the sum of emitted insights.
* Refactor Portfolio Construction Models to Use Insight Manager
`PortfolioConstructionModel` will use `QCAlgorithm.Insights" instead of class property `InsightCollection` to manage the insights. It no longer adds insights to the collection, but it removes them if they expire or the securities are removed from the universe.
Updates PCMs that were affected by the change.
* Updates Unit Tests
We need to add the insights to the insight manager before we call `PortfolioConstruction.CreateTargets`
* Minor IndexOption underlying TZ fix
- Fix for option universe chain underlying TZ which might not match the
options one, bug affected IndexOption specifically.
* Update affected regression tests
* Performance Improvements
- Remove Immutable collection from position groups to improve
performance. Adding more tests
- Remove ConcurrentDictionary from PortfolioTargetCollection &
DataManager. Adding more tests
- Add Securities enumerator keys & values cache
* Add test for PortfolioTargetCollection remove by reference
* Apply splits and dividends to volatility models
* Apply splits and dividends to volatility models using history requests
* Add new ScaleRaw data normalization mode
Handling the new mode in the price scale enumerator.
* DataNormalizationMode.ScaledRaw history requests
* Minor changes
* Minor changes
* Disable new normalization mode in AddSecurity methods and other minor changes
* Peer review
* Minor changes
* Peer review
* Minor changes
* Peer review
* Peer review
* Peer review
* Add scaled raw history regression algorithm
* Add more regression algorithms
* Add more regression algorithms
* Add Slice.TryGet unit tests
* Peer review
* Peer review
* Peer review
* Peer review
* Peer review
* Update algorithms stats
* Peer review
* Peer review
* Adds Unit Test For Limit Price Above/Below Open
See `LimitOrderFillsAtOpenWithFavorableGap`
* Fixes Limit Price Above/Below Open
If we place a buy/sell limit order below/above the current market price in TWS it fills immediately, so we model this behavior by filling with the opening price of the first trade bar.
* Updates Regression Tests
The number of trades did not change as expected. The fills are better because orders are filling with the open price when the new condition is met.
* 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
The `LimitFill`, `LimitIfTouchedFill` and `StopMaketFill` methods require `TradeBar` data to test price levels. We create a method to serve these methods as well other methods that will require this information.
Removes `Price > 0` check for `TradeType.Trade` data. Unecessary check, since a tick price cannot be less or equal to zero.
* Adds Unit Tests for Stop Market Fill
These unit tests covers new scenarios:
- Cannot trigger on quote data (QuoteBar or TickRype.Quote);
- Adds missing test for tick data (TickType.Trade)
- Unfavorable gap (see QuantConnect#4545)
* Fixes EquityFillModel StopMarketFill
Use the entire tick history to find the trigger price
Fill price is the stop price, unless there is an unfavorable gap (see #4545).
* Update Regression Tests
All regression tests keep the total trades. The difference are due to the time that the stop market orders are triggered and the prices that are filled. The `StopLossOnOrderEventRegressionAlgorithm` and the `UpdateOrderRegressionAlgorithm` observe the unfavorable gap case.
* Addresses Peer-Review
* Updates Regression Test
New `OrderListHash` because of the change in the fill on open case message.
* remove annualization
* Update python optimizer to best fit in convex problem
* rerun test
* test metric
* Add comment to explain using simple return
* Add unit test on PR
* Removes PythonTools from Solution
Missing removal from #6967.
It results in a runtime error if we use dotnet to list the packages:
`dotnet list ../Lean/QuantConnect.Lean.sln package`
* Update QuantConnect.Lean.sln
---------
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Foundation Update
* Adding more foundation packages
* Update existing libraries
* Further package updates
* Image cleanup
- Update base image to ubuntu 22.04
- Some clean up on dockerfile
- Remove ARM base image
* Test updates
- Minor docker file tweaks
- Update existing python environment tests
* Add more tests & fix Julia
* Remove jupyter-dash
* Remove R from foundation
* Remove Julia
* Remove Tensorforce
* Adds Regression Test
The new regression test asserts that the total trades is 2.
* Fixes Liquidate Existing Holdings Bug
Liquidate existing holdings before open new postions.
* Addresses Peer-Review
* IsOption uses underlyings holidays
- Option assets will use underlyings holidays, early closes and late
opens if their own are not defined
* Update regression algorithms
* Adds Unit Tests
The `LimitFill` method should not fill using `QuoteBar` or `Tick` with `TickType.Quote` type.
Adds missing test for tick data (`TickType.Trade`).
* Fixes EquityFillModel.FillModel
Use `Tick` with `TickType.Trade` or `TradeBar` information to fill limit orders.
* Update Regression Test Expected Statistics
The regression tests changed because of different fills.
The `ExtendedMarketTradingRegressionAlgorithm` has different number of trades because of an extra fill on the 4th order generated by TradeBar with a Low lower than than the QuoteBar.Ask Low:
> 20230222 13:56:24.251 TRACE:: Log: Time: 10/10/2013 12:01:00 OrderID: 4 EventID: 2 Symbol: SPY Status: Filled Quantity: 10 FillQuantity: 10 FillPrice: 143.8998 USD
> asset.Cache.GetData<QuoteBar>().ToString()
"SPY: Bid: O: 144.2457 Bid: H: 144.2629 Bid: **L: 144.2457** Bid: C: 144.2629 Ask: O: 144.2543 Ask: H: 144.2889 Ask: **L: 144.2543** Ask: C: 144.2889 "
> asset.Cache.GetData<TradeBar>().ToString()
"SPY: O: 144.2543 H: 144.4532 **L: 143.4156** C: 144.2716 V: 75423"
* Improves Tick Resolution Unit Test
* Fixes Tick Resolution Case Handling
`master` only considers the latest trade, missing possible fills in the batch of trades.
* Adds Unit Test for Gap
See https://github.com/QuantConnect/Lean/issues/963
* Addresses Fill Optimistic Assumption
If we have a bar that gaps in our favor, we accept the limit price to avoid optimitic fills.
* Fixes Regression Tests
All regression tests with limit orders have worst performance after we remove the optimitic assumption, and use the limit price instead.
* Updates the PearsonCorrelationPairsTradingAlphaModelFrameworkAlgorithm
Change the `PearsonCorrelationPairsTradingAlphaModelFrameworkAlgorithm` logic to show that it doesn't remove the consolidators used in the Alpha Model's indicators.
* Fixes `BasePairsTradingAlphaModel`
The `BasePairsTradingAlphaModel` will create indicators with class constructors and register them to consolidators that will be removed when the security is removed from the universe.
* Addresses Peer-Review
* Update Oanda's Forex and Metals CFDs trading hours in the MHDB
* Fix failing unit tests
* Update regression algorithm statistics
* Fix failing unit tests
* Minor changes
* Fix Issue #6937
Some brokerage models don't check the order type in `CanSubmitOrder`.
As a result, unimplemented order types don't cause `CanSubmitOrder`
to return false as it should.
This commit fixes these issues for:
* `FTXBrokerageModel.cs`
* `InteractiveBrokersBrokerageModel.cs`
* `SamcoBrokerageModel.cs`
* `TradierBrokerageModel.cs`
* `ZerodhaBrokerageModel.cs`
Brokerage implementations can be found at
https://github.com/orgs/QuantConnect/repositories. For example, the
Zerodha Brokerage implementation is available at
https://github.com/QuantConnect/Lean.Brokerages.Zerodha.
Signed-off-by: Abhishek Kumar <abhi.kr.2100@gmail.com>
* Use HashSet instead of an array
Checking if an object is contained within a HashSet is faster than
checking the same in an array.
Signed-off-by: Abhishek Kumar <abhi.kr.2100@gmail.com>
* Minor adjustments and normalization
* Add missing OptionExercise for IB
---------
Signed-off-by: Abhishek Kumar <abhi.kr.2100@gmail.com>
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Fix live trading chart series index
- Fix Series loosing their index when handled by the
LiveTradingResultHandler
- Some clean up for Series.cs
* Fix SeriesSampler loosing Series settings
* Adds NullBuyingPowerModel
The `NullBuyingPowerModel` considers that we have sufficient buying power for all orders.
Adds example using a bull call spread since a equity buy and hold would not show the impact of this model in the position group buing power model.
* Define NullBuyingPowerModel.GetMaintenanceMargin
The `NullBuyingPowerModel.GetMaintenanceMargin` returns a `MaintenanceMargin` of zero. It means the total margin used is always zero and margin calls will not be triggered.
This feature is inspired on the `ConstantBuyingPowerModel`. We don't inherit from that class, because `ConstantBuyingPowerModel.GetInitialMarginRequirement` gives us very small initial margin that leads to a very large quantity if we use `SetHoldings` or `CalculateOrderQuantity`
The calculations of `CloseTimeUtc` are correct and consistent: if the exchange is closed when the insight expires, `CloseTimeUtc` is the next open.
However, the definition of the `Period` was not consistent. Normally, it is defined by the different between `CloseTimeUtc` and `GeneratedTimeUtc`, but when we create an Insight with the Resolution and bar count overload, the period was defined by them:
```csharp
insight.Period = Resolution.ToTimeSpan().Multiply(BarCount);
```
which is incorrect, since it doesn't take the days the exchange is closed into account. The `ComputePeriod` method enforced consistency between the Resolution and bar Count overload and the `DateTime` overload, so the period for this overload was also incorrect.
* Custom data type history request in python
* Potential solutions
* Minor changes
* Use Slice.Get(Type) for getting python custom data history
* Minor changes
* Add unit tests
* Add unit tests
* Udpdate regression algorithms
* Peer review
* Peer review
* Add research regression tests
* Minor changes
* Minor changes
* Minor tweaks
---------
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Fix index option data timezone
- Fix index option data timezone which was 1 hour late than expected
* Update existing index option tests
- Update existing index option tests.
- Disable index option daily resolution support
* Fix future daily price scale factor update
- Fix future daily price scale factor update which was happening 1 day
late due to data and exchange time zone differences.
Adding regression algorithm reproducing and asserting it.
* Address review
* Update unsettled cashbook cash conversion rates
Also moved conversion rate holding from Cash to the CurrencyConversion
instance
* Minor fixes
* Peer review
* Minor fixes
* Minor fixes
* Minor fixes
* add wkhtmltopdf to lean image
* convert html to pdf
* avoid black stripts at bottom of each page
* address reviews
* address review
* address reviews
* self review
* address review
* Fix security cache reset
- Fix security cache reset so it only happens when no universe has it as
a member. Adding regression algorithm reproducing issue
* Avoid non deterministic FillForward behavior
* Fix default future chain universe selection
- Fix default future chain universe selection that should always return
empty, no selection. In some cases it would allos some contracts
though. Adding regression algorithm reproducing issue.
* Address review
* Minor debugging improvements
- Improve exception message if user provides empty/null ticker
- Log margin information on algorithn initialization
- Add unit test asserting option strategy position groups resolve
correctly for existing holdings
* Symbol Lazy SecurityDefinitionSymbolResolver
- Symbol will have a lazy SecurityDefinitionSymbolResolver instance
resolution
* Use any resolution for chain provider
- Use any data resolution available to source symbols for the file based
chain provider. Adding unit test
* Fix selection timezone bug
- Fix universe selection timezone bug. Updating regression algorithms
* Handles Data Subscriptions with One Security Type
Polygon sells data subscriptions for security types separately, so we should not test whether the users have all three subscriptions, Equity, Forex, and Crypto. Users just need the type they will use.
Adds new crypto markets, and unit tests for them. Adapt unit test.
* Fixes ToolBox Downloader
Adds `--api-key` argument.
Closes#6687
* Address reviews
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Expand Index option support
- Adjust APIs so that the same underlying can be used
for different options, adding support for SPX weekly options. Adding
regression tests
* Fix IndexOption.IsStandard
* Add IndexOption test
Fixed this error from happening when running this code:
tf.placeholder() is not compatible with eager execution.
at placeholder
raise RuntimeError("tf.placeholder() is not compatible with "
in array_ops.py: line 3341
at NetTrain
xs = tf.compat.v1.placeholder(tf.float32 in /QuantConnect/backtesting/./cache/algorithm/project/main.py: line 57
* add state to backtesting result packets
* self review
* add state in live results
* set runtime error in algorithm
* set hostname in job packets
* Set state when algorithm is null
* address review
* address reviews
* set runtime error when algorithm is not available during runtime
* Fix backtest progress calculation
* Backtest progress monitor class
* Minor changes
* Lazy calculating the processed days count
* Minor changes
* Minor changes
* Feature combo orders
- Add support for combo orders
* Make fill model wait for all grouped orders to emit fills
* Add ComboFill to model multiple fills for combo orders
* Fill combo limit orders
Add some regression algorithms
* Add fill implementation for combo leg limit orders
* Add IFill as common interface for Fill and ComboFill
* Refactor combo orders removing IGroupOrder interface
Move the group order manager to the base Order class
* Update algorithms
* Handle combo order events atomically
* Refactor brokerage transaction event handler
* Refactor combo fill models
* Process fills in batch
* Combo orders fill model tests
* Combo leg limit orders algorithm
* Regression algorithms cleanup
* Fill and combo fill classes cleanup
* Housekeeping
* Refactor equity fill model to derive from base fill model
* Address review changes request
* Handling the new types of orders in the OrderJsonConverter
* Add regression algorithm to test combo orders update/cancel
* Add regression algorithm to test combo orders update/cancel
* Housekeeping
* Address review changes request
* Minor changes
* Security transaction handler method for setting order request id
* Extend public interface for placing combo orders
* Combo order tickets demo algorithm python version
* Tweaks and updates
* Minor fixes
* Minor changes
* Minor fixes
* Address reviews minor fixes
* Minor fixes
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* CryptoFutures adjustments
- Address reviews of CryptoFutures:
- Add new Slice MarginInterestRates collection
- Add new regression tests asserting funding rate application behaves
the same no matter the resolution
- Add auxiliary data by type into the security cache
- Revert BuyingPowerModel changes
* Make interest rate application time deterministic
* Saves Dividend Payments to Security Holdings
Saves information about dividend payments to `SecurityHoldings`. This information will be used to factor in dividend payments to the `Profit` and `NetProfit`.
Adds `SecurityPortfolioManager.TotalNetProfit` to sum all the `SecurityHoldings.NetProfit`.
Adds regression and unit tests.
* Addresses Peer-Review
Improves Regression Test.
* WIP
* Add base currency cash
* Symbol properties and data processing
* Add basic template algorithm
* Add hourly crypto future algorithm
* Minor fixes after live trading testing
* CoinApiDataQueueHandler CryptoFuture support
* Address reviews
* Fix regression algorithms after update
* Allows Market-On-Close Orders Outside Buffer Period
Market-On-Close orders can be submitted before and after the buffer period from 15:45 to 16:00 (Tested with TWS) meaning that we can submit MOC when the market is closed and, consequently, use daily resolution data.
* Adds Regression Test with Extended Market Hours
- Removes `nextMarketClose > Time` condition since it's unnecessary. If the algorithm Time is greater than the close of that day, `nextMarektClose` refers to the next day.
* Updates Unit Test
Updates `OrderQuantityConversionTest` because the MOC orders are submitted. They are placed at 7 pm and invalid before this pull request.
* Updates Summary of new Regression Tests
* Set fill price to zero in OTM exercise orders.
Improved the OTM exercise orders message.
* Update regression algorithms and unit tests
* Add IsInTheMoney property to OrderEvent
* Update SerializedOrderEvent
* Properly setting the option exercise order price to strike price or zero
* Minor changes
* Minor changes
* Fixes Regression Algorithm Testing No Warm Up Requirement
* Removes Volatility Model Warm Up Requirement
If the volatiliy model is not ready, we will use the Brenner and Subrahmanyam (1988) approximation (BS88).
Lean will not set the volatility model if the user doesn't, since the BS88 can handle the null model case.
* Using IV to calculate Greeks, and remove single-step stochastic approximation
* Correct calculation for theta, vega, rho
* Add calculation from Black Calculator and peer review
* Address peer review and added unit test
* Update some tests and correct vega/eho
* Fix Unit Test and Improve Comments
Fixes `IndexOptionCallITMGreeksExpiryRegressionAlgorithm` since `Vega` was really non-zero.
* Fix regression test and add IV calculation
* refactor and bug fixing on peer review
* refactor and bug fixing on peer review
* for rerun test
* add warning on IV estimation not coveraged and edit speed unit test to not exceed 2s per 1000 iteration
* update logging
* update logging and description
* Add default option pricing models and unit tests
* address review
* Added Fed interest rate as risk-free rate with unit tests and set as default for option greeks calculation, added regression algorithms, addressed peer review
* refactor structure of interest rate
* Skip Saturday and Sunday
* regression test fix
* peer review
* Fixes Interest Rate Provider Logic
* Minor tweaks
* Fix start date
* Minor test tweak
* Update interest rates
* Fix unit tests
* Add minor log
Co-authored-by: Alexandre Catarino <AlexCatarino@users.noreply.github.com>
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Limit exercise in IB brokerage for limit and cash-settled options
* Add regression algorithm
* Assert that index option is automatically exercised in regression algorithm
* Wolverine LEAN integration
* Wolverine Lean integration - adjusting comments and restrict to Equity only
* fix 0.005$ per share fee
* remove PostOnly from Wolverine as its not needed
* AccountType.Margin and also removed check for USD only currency
* fix Market Wolverine -> USA
* change config
* Minor tweaks
Co-authored-by: Mark Virchenko <mark.virchenko@redduck.io>
* Data monitor (FIRST TEST)
* Calculate data request frequency in data monitor
* Detecting universe data usage in data monitor
* Json data monitor report generation
* Data monitor refactor
* Log and store data monitor report
* Data monitor report tests
* Clean up
* Clean up
* Address changes request
* Address changes request
* Wire data monitor only for backtest, not for live or research
* Minor tweaks
* Some minor tweaks
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Refactor multi IDQH frontier
- Fix for multi IDQH frontier support, specially for IB + QC
- Adding new CompositeTimeProvide. Adding unit tests
* Adjust solution to fix new data available event
* Memory Related Performance improvements
- Make sure we cleanup & dipose of python related objects during pandas
data generation.
- Disable memoizing enumerable use while creating pandas data frames,
since we do not require it
- Reduce unrequired object creations
- Replace concurrentCollections for ordinary locks
* Decimal parsing typo fix
* Add python additional paths for research
* Delegate adding additional paths to pythonpath to PythonInitializer
* Add new way to keep algorithm location at the beginning of pythonpath
* Add switch to disable BeginAllowThreads in PythonInitializer
* Add switch to disable BeginAllowThreads in PythonInitializer
* Address changes request
* Adds Support to Visual Studio Code Dev Container
Adds support and documentation to VSCode Dev Container.
* Address Peer Review
- Adds Dockerfile to install QuantConnect Stubs to enable Python autocomplete.
- Adds settings.json to enable Python autocomplete and LF line ending.
- Removes autobuilder task.
- Fixes Research Laucher
* Launcher and Task Impromevents
Fixes line endings issue
Fixes Launcher to point to right config.json file
Improve readme formatting
* Simplify Jupyter Notebook Deployment
- In some rare cases the FillForwardEnumerator was missing to register
the delisting date of an asset because it was the first data it got.
Adding unit test reproducing issue
* Normalize time in universe behavior
- Normalize Option & Future chain universe behavior regarding their
assets time in universe. They will now respect the universe settings
time in universe value. Adding new regression algorithms asserting the
behavior
* Address reviews & cleanup
- Update QLNet library to latest version from 6/2019 -> 11/2021
- Fix evaluation date which was using settlement date. Adding unit tests
reproducing issue
Use `SetEndDate` to set `EndDate` in `QCAlgorithm` constructor. It will ensure that the `EndDate` is independent of the time the algorithm is executed if `SetEndDate` is not called in `Initilaize`.
Some users don't implement `SetEndDate` to run the algorithm to the latest datapoint, but this is not true if we run the algorithm during the day as the latest datapoint will be 24 hours before the execution time while there is data until the current day midnight.
* Adds Additional Condition to Parse SecurityIdentifier Properties
A string can pass the previous conditions and create an invalid `SecurityIdentifier` (e.g. "Sharpe ration"). If it is invalid, the Market is not supported (e.g. "378").
* Adds Unit Test to Pandas Indexing
* Log Only Once if TryParseProperties Cannot Parse
Use cache to increase speed and remove redundant logging
* docs(VIXDualThrustAlpha): `determine` fixup
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* docs(VixDualThrustAlpha): `unsubscribe` fixup
Signed-off-by: Ryan Russell <git@ryanrussell.org>
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* docs(BasicTemplateIndia): `Prperties` -> `Properties`
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* docs: `Intialization` -> `Initialization`
Signed-off-by: Ryan Russell <git@ryanrussell.org>
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* Get history of a given bar type in python
* Separate GetDataFrame in sub methods to avoid dynamic type resolution
* Housekeeping and unit tests update
* Use all requests in python type method history method
* Address changes request
* Reverted some requested changes
* Handle non-unique multi-index error for Ticks in data frame creation
* Update unit tests
* Update unit tests and add comments
* Add regression algorithm
* Fixes PythonData.EndTime
The `EndTime` property of `PythonData` didn't override the base implementation in `BaseData`. Therefore `EndTime` was always set as `Time`.
Fixes Regression Tests
- The C# version of `Bitcoin` class needs to implement `EndTime`-
- Fixes regression tests
* Minor tweaks and rebase
- Add support for python data types just setting EndTime. Adding unit
tests for PythonData
- Fix for DynamicData EndTime property being fetched. Updating unit
tests
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Add algorithm settings to backtest results
* Use algorithm result settings in report generation
* Add unit tests
* Housekeeping
* Changes for live result report
* Housekeeping
* Housekeeping
* Housekeeping
* Add unit tests
* Dynamically set wait time on WS error
- Dynamically adjust wait time on websocket error
* Avoid subscribing multiple times to message events
- Avoid websocket subscription multiple times to message events during
disconnection/connection cycle
* Add Dispose Brokerage WebSocket Subscription Manager
- Add check for live warmup history request, making sure there is at
least room for a single bar between start and end. Avoid sending
start==end when rouded down by the resolution causing some history
providers to fail
- Create SubmitOrderRequest method in algorithm API to reduce
duplication of code and responsability.
- Add order command tests for different failure and success cases
- Fix null reference exception in equity fill model, when there is no
data for an asset.
* docs: `excersizing` -> `exercising`
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* docs: fix `exercising for exercising`
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* docs: `migth` -> `might`
Signed-off-by: Ryan Russell <git@ryanrussell.org>
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* Support extended market hours in AddFuture()
* Support extended market hours in AddFutureContract()
* Add C# regression algorithm
* Add Python regression algorithm
* Add regression algorithm for future contracts
* Add regression algorithm checking market hour ranges
* Fixed future regression algorithms to use extended market hours
* Fixed future regression algorithms to use extended market hours
* Fixed future regression algorithms to use extended market hours
* Fixed AddFutureOptionContractFromFutureChainRegressionAlgorithm to use extended market hours
* Update future market hours to include extended in market hours database
* Fixed AddFutureOptionContractDataStreamingRegressionAlgorithm to use extended market hours
* Fixed AddFutureOptionContractFromFutureChainRegressionAlgorithm to use extended market hours
* Fixed AddFutureContractWithContinuousRegressionAlgorithm to use extended market hours
* Fixed BasicTemplateContinuousFutureAlgorithm to use extended market hours
* Fixed BasicTemplateFuturesAlgorithm to use extended market hours
* Fix BasicTemplateFuturesDailyAlgorithm to use extended market hours
* Fixed BasicTemplateFuturesFrameworkAlgorithm to use extended market hours
* Fixed BasicTemplateFuturesHistoryAlgorithm to use extended market hours
* Fixed ContinuousBackMonthRawFutureRegressionAlgorithm to use extended market hours
* Fixed ContinuousFutureBackMonthRegressionAlgorithm to use extended market hours
* Fixed ContinuousFutureHistoryRegressionAlgorithm to use extended market hours
* Fixed ContinuousFutureLimitIfTouchedOrderRegressionAlgorithm to use extended market hours
* Fixed ContinuousFutureRegressionAlgorithm to use extended market hours
* Fixed DelistedFutureLiquidateRegressionAlgorithm to use extended market hours
* Fixed AutomaticIndicatorWarmupDataTypeRegressionAlgorithm to use extended market hours
* Fixed ConsolidateRegressionAlgorithm to use extended market hours
* Fixed DelistingFutureOptionRegressionAlgorithm to use extended market hours
* Fixed EqualWeightingPortfolioConstructionModelFutureRegressionAlgorithm to use extended market hours
* Fixed FutureContractsExtendedMarketHoursRegressionAlgorithm to use extended market hours
* Fixed FutureMarketOpenAndCloseRegressionAlgorithm to use extended market hours
* Fixed FutureMarketOpenConsolidatorRegressionAlgorithm to use extended market hours
* Fixed FutureOptionBuySellCallIntradayRegressionAlgorithm to use extended market hours
* Fixed FutureOptionCallITMExpiryRegressionAlgorithm to use extended market hours
* Fixed FutureOptionCallITMGreeksExpiryRegressionAlgorithm to use extended market hours
* Fixed FutureOptionCallOTMExpiryRegressionAlgorithm to use extended market hours
* Fixed FutureOptionDailyRegressionAlgorithm to use extended market hours
* Fixed FutureOptionHourlyRegressionAlgorithm to use extended market hours
* Fixed FutureOptionMultipleContractsInDifferentContractMonthsWithSameUnderlyingFutureRegressionAlgorithm to use extended market hours
* Fixed FutureOptionPutITMExpiryRegressionAlgorithm to use extended market hours
* Fixed FutureOptionPutOTMExpiryRegressionAlgorithm to use extended market hours
* Fixed FutureOptionShortCallITMExpiryRegressionAlgorithm to use extended market hours
* Fixed FutureOptionShortCallOTMExpiryRegressionAlgorithm to use extended market hours
* Fixed FutureOptionShortPutITMExpiryRegressionAlgorithm to use extended market hours
* Fixed FutureOptionShortPutOTMExpiryRegressionAlgorithm to use extended market hours
* Fixed FuturesAndFuturesOptionsExpiryTimeAndLiquidationRegressionAlgorithm to use extended market hours
* Fixed FuturesExpiredContractRegression to use extended market hours
* Fixed FutureSharingTickerRegressionAlgorithm to use extended market hours
* Fixed HistoryWithDifferentContinuousContractDepthOffsetsRegressionAlgorithm to use extended market hours
* Fixed HistoryWithDifferentDataMappingModeRegressionAlgorithm to use extended market hours
* Fixed HistoryWithDifferentDataNormalizationModeRegressionAlgorithm to use extended market hours
* Fixed LimitOrdersAreFilledAfterHoursForFuturesRegressionAlgorithm to use extended market hours
* Fixed OpenInterestFuturesRegressionAlgorithm to use extended market hours
* Fixed RegisterIndicatorRegressionAlgorithm to use extended market hours
* Fixed SetHoldingsFutureRegressionAlgorithm to use extended market hours
* Fixed WarmupFutureRegressionAlgorithm to use extended market hours
* Fixed AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm to use extended market hours
* Fixed AlgorithmHistoryTests to use extended market hours for futures
* Fixed AlgorithmTradingTests to use extended market hours for futures
* Fixed BrokerageSetupHandlerTests to use extended market hours for futures
* Fixed TimeRulesTests to use extended market hours for futures
* Fixed FutureOptionMarginBuyingPowerModelTests to use extended market hours for futures
* Fixed FutureMarginBuyingPowerModelTests to use extended market hours for futures
* Fixed FileSystemDataFeedTests to use extended market hours for futures
* Fixed QuantBookHistoryTests to use extended market hours for futures
* Split BasicTemplateContinuousFutureAlgorithm to have an extended market version
* Fixed FutureMarketOpenAndCloseRegressionAlgorithm to use extended market hours
* Split BasicTemplateFuturesAlgorithm to have an extended market version
* Split BasicTemplateFuturesAlgorithm to have an extended market version
* Split BasicTemplateFuturesFrameworkAlgorithm to have an extended market version
* Split BasicTemplateFuturesHistoryAlgorithm to have an extended market version
* Revert AddFutureContractWithContinuousRegressionAlgorithm
* Revert AddFutureOptionContractDataStreamingRegressionAlgorithm and added data
* Revert AddFutureOptionContractFromFutureChainRegressionAlgorithm
* Revert AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm
* Revert ConsolidateRegressionAlgorithm
* Revert Algorithm.CSharp/ContinuousBackMonthRawFutureRegressionAlgorithm.cs
* Revert ContinuousFutureBackMonthRegressionAlgorithm
* Revert ContinuousFutureHistoryRegressionAlgorithm
* Revert ContinuousFutureLimitIfTouchedOrderRegressionAlgorithm
* Revert ContinuousFutureRegressionAlgorithm
* Revert Algorithm.CSharp/DelistedFutureLiquidateRegressionAlgorithm.cs
* Revert EqualWeightingPortfolioConstructionModelFutureRegressionAlgorithm
* Split FutureMarketOpenAndCloseRegressionAlgorithm to have an extended market version
* Split FutureMarketOpenConsolidatorRegressionAlgorithm to have an extended market version
* Revert FutureOptionBuySellCallIntradayRegressionAlgorithm
* Revert FutureOptionCallITMExpiryRegressionAlgorithm
* Revert FutureOptionDailyRegressionAlgorithm
* Revert FutureOptionPutITMExpiryRegressionAlgorithm
* Revert FutureSharingTickerRegressionAlgorithm
* Revert FuturesAndFuturesOptionsExpiryTimeAndLiquidationRegressionAlgorithm
* Revert FuturesExpiredContractRegression
* Revert HistoryWithDifferentContinuousContractDepthOffsetsRegressionAlgorithm
* Revert HistoryWithDifferentDataMappingModeRegressionAlgorithm
* Revert HistoryWithDifferentDataNormalizationModeRegressionAlgorithm
* Revert OpenInterestFuturesRegressionAlgorithm
* Revert RegisterIndicatorRegressionAlgorithm
* Revert SetHoldingsFutureRegressionAlgorithm
* Revert WarmupFutureRegressionAlgorithm
* Revert AutomaticIndicatorWarmupDataTypeRegressionAlgorithm
* Some cleanup
* Address changes request
* Address changes request
* Add more Class III Milk data to fix DelistingFutureOptionDailyRegressionAlgorithm
* refactor(Algorithm): Correct `Intrinino` -> `Intrinio` references
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* refactor(Algorithm): Update `evemts` -> `events`
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* refactor(BubbleAlgorithm): readability improvements
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* refactor(OrderTicketDemoAlgorithm): readability improvements
Signed-off-by: Ryan Russell <git@ryanrussell.org>
Signed-off-by: Ryan Russell <git@ryanrussell.org>
* Fix KeyError when rendering exposure chart in report with some security types
* Update exposure chart colors and add unit tests
* Updated json test file
* handle multiple command files
* remove default useage
* add tests for verify files are read in order
* add comment
* change reuslt file name
* add comment
* liquidate using given symbol values
* remove redundant
* accept ticker, market, security type to build symbol, to be used by CLI commands
* use null leverage
* symbol can be null if ticker, market, security type values are provided
* reject the default value of security type
* cleanup
* cleanup
* check if status is not invalid
* cleanup
* abstraction to remove duplication
* fix name
* address reviews
* use counter
* add test to validate symbol/ticker agrumnets
* remove hardcoded values
* MRP
* Fix bug
* Rename
* Provide virtual `GetPriceRelative` function to override for any variants in future
* SymbolData class within model
* Address peer review
* fix bug
* revise unit test and fix bug in python model
* revise unit test and fix bug in model
* Revise regression statistics
* Revise regression statistics
* Revise regression statistics
* Revise regression statistics
* Revise regression statistics
* Address peer review
* Updated unit tests according to peer review
* Address peer review
* Fix LocalMarketHours.GetMarketClose to get the actual next market close time with extended market hours
The method was not properly considering gaps between regular hours close and extended market open
* Revert some changes to fix errors
* Add performance gh action
- Add new performance github action, running python and csharp benchmark
algorithms
- Adjusting algorithms length so they are not too long or too short
* Checkout master branch benchmark reference
- Fill model will take into account internal configurations, this is
specially relevant for continuous future mapped contracts. Updating
regression algorithms and unit tests.
- Allowing internal configurations to update trade builder information
* Remove suppport for market orders and MOO orders for futures
* Add regression algorithm to assert that limit orders are filled on after hours for futures
* Remove suppport for market orders and MOO orders for futures in DefaultBrokerageModel
* Update regression algorithms stats
* Fixed regression algorithm and clean up
* Add unit tests
* Fix regression algorithms
* Address changes request
* Respect warmup resolution given
- The data feed will respect the warmup resolution given and override
the resolution used by the algorithm when adding a subscription.
Updating regression algorithm to keep previous statistics. Adding new
regression algorithm asserting the desired behavior
* Testing improvements
- Add more unit tests and regresion test
- Add missing data for crypto
- Fix bug with FFed data crossing after the end time of the warmup
request
* Add more Warmup resolution regression algorithms
- Adding more warmup resolution regression algorithms, using
Settings.WarmupResolution and an option selection case
* Add more warmup regression tests
- Adding more warmup regression tests.
- Will no longer skip universe selection subscriptions from warmup
resolution enforcement. Updating regression algorithms data points
* Fix bug with data rounding
- Fix data rounding bug when warmup resolution is set to a different
value than the original configuration. Updating regression algorithms
to assert the expected behavior
* Address reviews
- Revert regression algorithms changes to use Resolution during warmup.
Updating their stats.
- Adding new regression algorithms asserting the behavior warming up
using a timespan and no warmup resolution
- Fix bug where data used to warmup the 'normal' enumerator will make it
through into the warmup time span. Updating tests
* Address reviews
- Add missing comments, explaning warmup algorithms time span
calculations.
- Revert changes in existing `WarmupOptionTimeSpanRegressionAlgorithm`
to reduce diff to minimum
- Adding new warmup unit tests asseting algorithm warmup start time, for
different combinations of bar count, timespan, resolution
* First commit
* Any change
* Add more unit tests
* Nit changes
* Changes requested
* Fix bugs and requested changes
* Requested changes
* More changes
* Check ongoing backtest orders
* Read ongoing backtest does not fail
* nit change
* Fixes for standarized API orders response
- Fixes for a standarized API read orders reponse
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Minor improvements
- Avoid division by zero error in backtesting result handler. Race
condition where the SetAlgorithm implementation would still be running
and we try to loop through the update method
- Improvement nullreference exception message
- Cleanup resolution to timespan extension method
* Address reviews
- Cleanup data config fill forward conditional statement for tick
resolution
* Fix live future and option universe selection daily resolution
- Adding unit test reproducing issue for option and future universe
chain using daily resolution, since was rounding down in UTC TZ the
date might not change and it would re emit the same data point
* Address reviews
- Add more test cases
- Adding locks around RegisteredSecurityDataTypesProvider to allow it to
be used by multiple threads at the same time without exploding
* Minor fixes for mapped futures contract
- Future security was never able to be non tradable
- Skip remove future contracts from live holdings. Adding unit test
reproducing issue and regression algorithm
* Fix removal of continuous futures
- The canonical continuous future would leave behind an OpenInterest
subscription when removed because of a different in the way the
configurations were built, this will now be centralized in a single
method. Adding unit tests reproducing issue
- FillForwarding setting of the continuous future was not being
respected. Updating algorithm reproducing the issue to assert the
behavior failing in master
* Address reviews
- Minor refactors addressing reviews
* Fix result handler live holdings
- Live result handler live holdings will include future assets
associated with continuous futures. Adding unit tests
* Fixed for live holdings price rounding
- Live holdings will use the SPDB minimum price variation for rounding.
Adding unit tests
- Remove thread in charge of sorting and updating the queues weight.
This will be handled by each worker thread instead. Avoid cases where
the work count is so high that the sorting thread in master would not
be able to update all the weights, causing data to be enqueued beyond
the max prefetch limit. Adding benchmark algorithm reproducing issue
- Smaller live warmup history requests, will keep track of the last point
we got from the file based enumerator and start our history enumeration from this point
* Add new Python QCAlgorithm.History() method with all parameters and type
* Add regression algorithms
* Using all parameters in History()
* Use private methods to reuse History() code
* Use private methods to reuse History() code
* Add unit tests for QCAlgorithm.Python.History()
* Add unit tests for QCAlgorithm.Python.History()
* Add unit tests for QCAlgorithm.Python.History()
* Add unit tests for QCAlgorithm.Python.History()
* Add unit tests for QCAlgorithm.Python.History()
* Add unit tests for QCAlgorithm.Python.History()
* Asserting history count
- Similar to the OptionChainUniverse, the future chain universe should
also add it's contracts using the raw data normalization mode. Adding
regression algorithm reproducing issue
- Replace logic to convert TimeSpan based PeriodConsolidator into count
based, by an override of the 'potentialStartTime' in the case we could
be falling into a look ahead consolidated bar end time
- Adding OpenInterestAnnual where the contract maps when any of the back month
contracts of the next year have a higher volume that the current front month.
- Add support for backwards compatible data mapping mode additions
- Updating ES map and factor files. Adding a little daily data too
- During warmup period the algorithms initial time might not be a rounded date
value, so it's important to take into account hours/minutes. Adding
regression algorithm reproducing and asserting issue
* Period timespan consolidation improvements
- If user is trying to consolidate a period providing data of a bigger
period we will now throw an exception. Adding tests
- If both consolidated and given data share the same period, gently
adjust the consolidator into a data count of 1. Adding tests
- Fixing bug in QuoteBarConsolidator period double accounting. Adding unit tests
* Add Period and Count regression algorithm
* Fix QuoteBar NonTimeBased Consolidator Period
- Fix QuoteBar non timebased consolidator period, that was accounting
twice for the initial bar period. Updating unit tests
* Improve QuoteBarConsolidator assertion
- Assert quote bar consolidated time and endtime in unit tests
- Add error log at OptionSymbol.IsOptionContractExpired in the case we
detect an unexpected expiration time. That could be related to
Symbol.ID.Date being incorrect
* Fix option price and greeks always beign zero on the expiration date
* Fix option price and greeks always beign zero on the expiration date
* Updated documentation
* Style and performace changes
* Address changes request
* Fix QL.Settings.includeReferenceDateEvents not being set on every thread
* Updated code documentation
* Add indicator for allowed option styles to QL option price models
* Add and update option price model tests
* Update option price models methods sumary to indicate allowed option styles
* Add regression algorithms for option price models for different option styles
* Update OptionPriceModel regression algorithms to use Lean local data
* Add Python regression algorithms for option price models for different option styles
* Update OptionPriceModel regression algorithms to assert that greeks are valid
* Address changes request
* Address changes request
* Update OptionPriceModel regression algorithms to check both call and put contracts
* Update OptionPriceModel regression algorithms to use correct test data
* Update OptionPriceModel regression algorithms to throw in OnData
* Address changes request
* Update OptionPriceModel regression algorithms to assert greeks are not all zero
* Live T-1 selection warmup
- Only use BaseDataCollection class
- Reuse collection enumerator
- Remove FuturesChainUniverseSubscriptionEnumeratorFactory
- Universe selection will use Cache providers
- Add null reference check
- Add more tests
- Fixes for warmup fill forwarding. Add more tests
* Address reviews. Add missing comments
* Refactor chain providers
- ChainProviders will use quote, open interest and trade information,
which ever is first. Updating regression algorithm changing contract
being added.
- Add base BacktestingChainProvider for shared logic, reducing
duplication.
- ChainProviders will now use the given IDataCacheProvider and
IMapFileProvider
- If Providers are called for a date the exchange is closed they will
search for the previous available date where the exchange is open.
Adding unit tests.
* Address reviews. Logging improvements
* use research-object-store-name key from config while creating object store for research notebooks
* initial removal
* remove reference
* move test to private repo containing downloaders
Since there is `UpdateStopPrice`, `UpdateLimitPrice`, `UpdateQuantity` and `UpdateTag` method to make it easier to update the `OrderTicket`, we include `UpdateTriggerPrice` to cover the `LimitIfTouched` case.
Also, updated the docs or the arguments for these methods.
Updates LimitIfTouchedRegressionAlgorithm:
- Adds `UpdateTriggerPrice` call that rounds down the `TriggerPrice`.
* use research-object-store-name key from config while creating object store for research notebooks
* remove bitfinex files
* remove redundant ref
* move test to private repo
* Warmup minor fixes
- Result handler fix
- Centralize and normalize status update during warmup
* Address reviews
* Minor adjustments
* Add console message during warmup period
* Fix warmup percentage update
* Overload PandasConverter.GetIndicatorDataFrame to accept a Python dict
* Shared implementation code for PandasConverter.GetIndicatorDataFrame overloads
* Added documentation for private shared methods used by PandasConverter.GetIndicatorDataFrame
* Added unit tests for PandasConverter.GetIndicatorDataFrame
* Added unit tests for PandasConverter.GetIndicatorDataFrame Dictionary overload
* Address change requests
* Address change requests
* Reproduce TrailingStopRiskManagementModel bug with test case
* Fix TrailingStopRiskManagementModel to make it relative to max price
* Adapted old TrailingStopRiskManagementModel test to new implementation
* Fix TrailingStopRiskManagementModel Python version
* Fixed TrailingStopRiskFrameworkAlgorithm regression tests data
* Handling both long and short positions in TrailingStopRiskManagementModel
* Traking holdings value instead of unrealized profit in TrailingStopRiskManagementModel
* Checking for position side change in TrailingStopRiskManagementModel
* Handling immediate liquidation in TrailingStopRiskManagementModel
* First commit
* Add unit test
* Change implementation
* Add unit tests
* Nit change
* nit change
* Remove unnecessary methods
* Add more unit tests
* Revert "Add more unit tests"
This reverts commit 1ba2ab7454.
* Add more unit tests
* Add more unit tests
* Improve Implementation
* Change unit tests
* Remove unit tests
Remove unit tests from AlgorithmRegisterIndicatorTests.cs
* Coarse fine flag improvement
- Coarse will check global data folder for fine existance if it's
different than the given path to check
* Update readme.md
- Minor fix for FuncPeriodSpecification so it always uses the same
DateTime to assert the given function. Improve documentation and
exception message being thrown
* Add missing stablecoins
* Fix bugs
* Remove MIMUSD stablecoin pair
That pair is already in the SPDB
* Add more stablecoins pairs
- Add SUSD and IDRT
* Fix bug
* Requested changes
The algorithm posted in the GH was failing because when finding a conversion between currencies BTC to USD, it wasn't taking into account BTCUSDT and that USD = USDT because is a stablecoin
* Solve bugs
* Nit changes and more tests
* Requested changes
* Nit changes
* Requested changes
* Nit change
* Allow DataWriter to merge existing ticks if desired
- Optionally allow lean data writer to merge new ticks with existing
- Adjust ZipStreamWriter
- Fix bug in compression lib that was leaving files open. Reproduced by
added tests.
* Address reviews
- Define new WritePolicy to configure the behavior of the LeanDataWriter
regarding how it should handle writing to a file: merge, overwrite,
append
* make public safe to expose test properties
* extract ib files
* remove dependencies
* refactor to use ib reference as string
* remove un-used dependencies
* remove redundant refrences
* Added checking if algorithm is stopped in initialize method
* Quit on initialize adjusment
- Minor adjustments to solution. Adding more regression algorithms
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Update Tick.cs Time parsing
* Adjust equity tick millisecond read
* Fix tick sub millisecond precision
- DateTime.AddMilliseconds will rount to the nearest integer. So instead
use AddTicks
* Avoid sporadic test failure
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* set price currency for open orders from brokerage setup handler, remove setters from brokerage
* order already has price currency being set by brokerage transcation handler
* remove as overwritten by BrokerageSetupHandler.GetOpenOrders
* refactor because can't use internal setters in private repos
* refactor, use ctor to set attributes
* remove redundant broker dependency
(cherry picked from commit 57b071eb174ca9fe857021ebffa7a546834e86f7)
* check limit price for limit order instead for checking price
* add price agrument for MarketOrder
* remove, not required anymore
* AddUnrequestedSecurity should not return null
* assert string in not null cases
- Fully reset the security cache when it's finally removed from the algorithm.
Adding regression algorithm reproducing issue
- Updating regression algorithms which would trade based on data
previously available
* Warm up EmaCrossAlphaModel
Warm Up EmaCrossAlphaModel indicators
* Fix regression test bug
When using the default `EmaCrossAlphaModel()` the period of both indicators to be ready is bigger than the difference between the start date and the end date of the algorithm. Then, as the algorithm didn't warm up the data both indicators of EmaCrossAlpha never were ready, but now as the model warms up the data both indicators are ready so we get different statistics
* Requested change
* Fix unit tests
As there wasn't items in `AddedSecurities`, when trying to remove the items in ´RemovedSecurities´ there was nothing to remove because there was never a security in `_symbolDataBySymbol`. That's why, in order to test, the behavior of `EmaCrossAlphaModel` when removing a security we need to first add one to then remove it.
* Requested changes in Python
- Requested changes in Python
- Nit changes
* Nit change
* Requested Changes
* Add RemoveConsolidators() method in Python version
* Add requested History overload
* Add more regression tests
* Revert "Add more regression tests"
This reverts commit 71b279e917.
* Add more regression tests
* 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
* Make continuous futures untradable
- To match live trading behavior. Adjust continuous futures securities
to be untradable
* Set ContinuousFuture as non tradable
- Set continuous futures as non tradable. Update regression algorithms
- Fixes for symbol capacity calculation
`WarmUpIndicator` for Python indicators doesn't return the indicator anymore after #6027. So all overloads should return `void`.
Fixes `SmaCrossUniverseSelectionAlgorithm` [C# and Py].
* Added NYSELIFFE exchange support to Interactive Brokers brokerage.
* Fixed unit test AddSecurityWithSymbol by adding market hours for Equity-nyseliffe-[*], Index-nyseliffe-[*], Option-nyseliffe-[*].
* Added NYSELIFFE exchange support to Interactive Brokers brokerage.
* Fixed unit test AddSecurityWithSymbol by adding market hours for Equity-nyseliffe-[*], Index-nyseliffe-[*], Option-nyseliffe-[*].
* Added NYSELIFFE exchange support to Interactive Brokers brokerage.
* Fixed unit test AddSecurityWithSymbol by adding market hours for Equity-nyseliffe-[*], Index-nyseliffe-[*], Option-nyseliffe-[*].
* - Added NYSELIFFE futures to Futures.cs
- Added method GetGoodFriday() to calculate Good Friday to FuturesExpiryUtilityFunctions.cs.
- Added unit tests for GetGoodFriday().
- Added NYSELIFFE futures expiries to FuturesExpiryFunctions.cs which uses GetGoodFriday() instead of hardcoding the date of Good Friday in the market-hours-database.json.
- Added unit tests for NYSELIFFE futures expiry.
- Added NYSELIFFE to Exchange.cs
- Removed Equity-nyseliffe-[*] and Index-nyseliffe-[*] from market-hours-database.json
- Updated Option-nyseliffe-[*] to FutureOption-nyseliffe-[*] on market-hours-database.json
- Added the supported NYSELIFFE futureoptions to symbol-properties-database.csv.
* Removed blanks after India tuple
* Added the dates for 2022 and 2023 to the market-hours-database.json.
Removed "FutureOption-nyseliffe-[]" from market-hours-database.json.
Added to FuturesOptionsSymbolMappings.cs:
{ "YG", "OYG" },
{ "ZG", "OZG" },
{ "ZI", "OZI" }
* Minor tweaks for nyseliffe FOPs
Co-authored-by: Chris Coetzee <chris@polidata.ai>
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Deprecate breakpoints
Drop Watchlist
Remove breakpoints from lean
Prep install of NetCoreDbg
Cleanup
* Install NetCoreDbg
* Update Research Images with Newer Jupyter
* Binance.US base changes
* biniance exchange info update
* Binance US uses same fee rates as main Binance
* binance us brokerage model tests
* use base implementation of GetBuyingPowerModel method
* add gdax exchange info downloader
* add downloader method to program]
* fetch currency description
* change definition to include headers
* use extension method to make request
* remove log from test
* replace WebRequest
* cleanup
* use relevant name
* implement IExchangeInfoDownloader for bitfinex, initial commit
* add default values
* use default market value
* use correct attribute for lotsize
* don't skip missing values
* handle multiple downloaders
* add gdax and bitfinex exchange downloader
* follow LEAN data directory structure
* update SPDB
* order tickers
* order tickers
* add exchange info downloader test template
* delete files
* update SPDB
* use currency mapping
* update bitfinex symbols
* update currency mapping
* sort result after old currency symbols are used
* use market of the respective brokerage
* no more unknown symbol
* change minimum order size value
* direct conversion possible
* update bitfinex symbols
* change user-agent
* add test for indirect conversion
* update stats
* remove un-used
* use utc time for slice sync
* use utc time
* refactor
* add regression test
* use utc time
* use utc time
* make utctime required parameter
* add utcTime in slice creation
* assert warm up complete
* check if algorithm is still warmingup
* use exchange tz
`CashBuyingPowerModel`, which reflected on `AlphaStreamBrokerageModel`, a margin-only brokerage.
It also didn't consider the account type, so `InteractiveBrokersBrokerageModel` was using the margin model even if `AccountType.Cash` was selected.
Removes `GetBuyingPowerModel` method from other Brokerage Models when their cases are covered by `DefaultBrokerageModel`
Fixes some typoes in `TradierBrokerageModel`
Fixes unit and regression tests. For the regression tests, we have explicitly set the brokerage model.
- The BrokerTransactionHandler will also adjust virtual positions for
margin accounts when fees are in base currency and the asset is a
crypto or forex pair. Adding new regression tests reproducing issue
* extract binance brokerage
* remove binance tools from main toolbox app
* modify OrderTestParameters constructor
* fix BinanceBrokerage ref config.json
* update symbol properties
* move BinanceFeeModel tests to the right place
* 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
* Update MHDB and SPDB
Update MHDB and SPDB with micro futures
* Fix bugs
* Add more FutureExpiryFunctions
* Requested changes
* Nit changes
* Nit changes
- Fix some future values in SPDB
- Test LastFriday() method
- Apparently Micro CHF/USD Futures(MSF) refers to the micro of Swiss Franc Futures (6S). The same happens with Micro JPY/USD (MJY) Futures and Japanese Yen Futures (6J)
* Fix bugs
* Micro futures MultipleFactor
* Fix some futures MultipleFactor
* Adding unit tests reproducing issue.
* Fix a couple of minor bugs
- IsMarketOpen will work correctly when used with daily and hourly
resolution.
- slice.Get will work correctly with python custom data
- ExtendedDictionary will be able to dinamically access methods,
required for python and private C# data types
* Refactor solution. Add more tests
* Remove unrequired import statement
* WIP
* Fix fees in base currency not being subtracted
- Fix fees in base currency not being subtracted from the quote currency
for crypto cash accounts. Updating regression tests to assert
portfolio, cashbook state and holdings state.
* Fix unit test race condition
* Use GC server mode for tests
* Fix daily auxiliary data points emission time
- Due to fillforwarding, in some cases with daily resolution symbol
change events (generically any auxiliary data) would arrive late.
Updating regression test to reproduce the issue. Adding unit test
- Some refactoring and logging improvements
* Address reviews
* Remove old xml docs param
* change BinanceBrokerageModel
* supply spot vs margin endpoint as parameter
* wip
* send margin order for margin account
* "NEW" means that the order has been accepted by the Binance engine.
* fix cash balance
* use JsonConverters for account parsing
* unit tests
* fixup
* lazy connect
* fix connection
* allow api client to be null if DQH only
* make method private
* more unit tests
* fix Dispose
* fix tests
* fix IsConnected condition
* run test as additional
* add some comments
* improve unit tests
* improve null checks
* tidy up the code
* Refactor `GetFilePath()`
Add also useful methods to use with this one
* Nit changes
* Requested changes
* Requested changes
* Restore SaveString()
* Nit changes
* Address self review
* Test improvements
* Adjust example KerasNeuralNetworkAlgorithm
* Minor tweak for KerasNeuralNetworkAlgorithm.py
Co-authored-by: Martin-Molinero <martin@quantconnect.com>
* Binance fees deducted from fill quantity accordengly
- For Binance cash accounts while buying, if fees are from the base
currency of leans virtual position, we need to deduct the fee from the
fill quantity, else we can end with a position bigger that it actually
is and not be able to liquidate
* Refactor solution
- Refactor solution into a more generic approach solving fees in base
currency at the BrokerageTransactionHandler level, covering all
brokerages that require it. Adding regression algorithm reproducing
issue.
- Update Bitfinex and Binance fee models to correctly reflact reality
* Log fill quantity adjusment once
* Add support for live price scaling
- Add support for live trading price scaling for continuous futures.
Adding unit tests
* Move live price scale application. Updating unit tests
- Live trading application of price scaling will happen before fill
forwarding and updating securities real time price. Updating unit
tests to reproduce issue
- GetLastKnownPrices will no longer guess which resolution to use but
rely on other methods implementation/
- Updating basic template future algorithms to warmup contracts and
assert it
- Minor improvements for FunSecurityInitializer and FuncSecuritySeeder
* Always reuse aggregator instance if any
- When fetching a IDataAggregator instance from the composer, do not
enfore type name on existing instances
* Fix unit tests
* add data
(cherry picked from commit 814011d89e5316d150f88ffca5f48d8d5f0ea7d9)
* update market hours for index
(cherry picked from commit edac40732c120eb84d27de00594b59eebb4983f5)
* add index algorithms
(cherry picked from commit b22d27b4fa98172c435f7c26de4a3a297c49a6b7)
* update statistics
* add cash
* Add india market
* add leverage for index
* can subscribe to index
* update format
* fix wrong cash
* fix ticker names
* update data
* update ticker and stats
* update docs
* specify enpoint url of ftx api (can be FTX pr FTX.US)
* more metadata for ftxus
* tidy up code
* tests
* more tests
* fix tests
* fix us fee rates
* add account tier
* update symbol props
* typo
* typo-2
* update symbol properties
* use FTXUS fee model
* minor tweaks
* 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>
- Zip entries will be sourced from cache provider
- Option underlying will use SubscriptionDataSource to fetch it's data.
Fixing bug where it would let through an old data point, or miss
sending data through.
* Add india market data
* use local data for algo
* Add India market regression algo
* update india market data
* Update readme
* add python algo for BasicTemplateIndiaAlgorithm
* Add India data regression python algo
* data india data files
* update tickers
* Fix algo template
* remove data
* fix stats
* update stats
* remove unused data
- Live subscription enumerator will clone the underlying data set when
live mapping is being done. To avoid issues where IDQH implementations
could reuse a data point with same configurations. Adjusting unit test
to reproduce issue
* Fix typo
* Fix TryGetValue to return false if key is not found
* Revert "Fix TryGetValue to return false if key is not found"
This reverts commit b85b7b579a.
* Update documentation for TryGetValue
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonVirtualEnvironmentTests.AssertVirtualEnvironment"
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonVirtualEnvironmentTests.AssertVirtualEnvironment"
# Run Python Package Tests
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests" --blame-hang-timeout 120seconds --blame-crash
# Run StableBaselines Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.StableBaselinesTest" --blame-hang-timeout 120seconds --blame-crash
# Run AxPlatform Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.AxPlatformTest" --blame-hang-timeout 120seconds --blame-crash
# Run TensorlyTest Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.TensorlyTest" --blame-hang-timeout 120seconds --blame-crash
# Run NeuralTangents, Ignite Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.NeuralTangentsTest|IgniteTest" --blame-hang-timeout 120seconds --blame-crash
# Run TensorflowTest
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.TensorflowTest" --blame-hang-timeout 120seconds --blame-crash
# Run TensorflowProbability
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.TensorflowProbabilityTest" --blame-hang-timeout 120seconds --blame-crash
# Run Hvplot Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.HvplotTest" --blame-hang-timeout 120seconds --blame-crash
# Run Stellargraph Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.StellargraphTest" --blame-hang-timeout 120seconds --blame-crash
# Run Keras Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.KerasTest" --blame-hang-timeout 120seconds --blame-crash
# Run Scikeras Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.ScikerasTest" --blame-hang-timeout 120seconds --blame-crash
# Run Transformers
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.Transformers|XTransformers" --blame-hang-timeout 120seconds --blame-crash
@@ -4,6 +4,8 @@ This document contains information regarding ways to use Visual Studio Code to w
- Using Lean CLI -> A great tool for working with your algorithms locally, while still being able to deploy to the cloud and have access to Lean data. It is also able to run algorithms locally through our official docker images **Recommended for algorithm development.
- Using a Lean Dev container -> A docker environment with all dependencies pre-installed to allow seamless Lean development across platforms. Great for open source contributors.
- Locally installing all dependencies to run Lean with Visual Studio Code on your OS.
<br />
@@ -12,32 +14,63 @@ This document contains information regarding ways to use Visual Studio Code to w
<h2>Option 1: Lean CLI</h2>
To use Lean CLI follow the instructions for installation and tutorial for usage in our [documentation](https://www.quantconnect.com/docs/v2/lean-cli/getting-started/lean-cli)
To use Lean CLI follow the instructions for installation and tutorial for usage in our [documentation](https://www.quantconnect.com/docs/v2/lean-cli/key-concepts/getting-started)
<br />
<h2>Option 2: Install Dependencies Locally</h2>
<h2>Option 2: Lean Development Container</h2>
1. Install [.Net 5](https://dotnet.microsoft.com/download) for the project
Before anything we need to ensure a few things have been done for either option:
2.(Optional) Get [Python 3.6.8](https://www.python.org/downloads/release/python-368/) for running Python algorithms
-Follow Python instructions [here](https://github.com/QuantConnect/Lean/tree/master/Algorithm.Python#installing-python-36) for your platform
1.Get [Visual Studio Code](https://code.visualstudio.com/download)
2. Get [Docker](https://docs.docker.com/get-docker/):
- Follow the instructions for your Operating System
- New to Docker? Try [docker getting-started](https://docs.docker.com/get-started/)
3. Pull Lean’s latest research image from a terminal
-`docker pull quantconnect/research:latest`
4. Get Lean into VS Code
- Download the repo or clone it using: `git clone [https://github.com/QuantConnect/Lean](https://github.com/QuantConnect/Lean)`
- Open the folder using VS Code
5. Open Development Container
- In VS Code, either:
- Select "Reopen in Container" from pop up box.
OR
- Ctrl+Shift+P (Command Palette) and select "Remote-Containers: Rebuild and Reopen in Container"
You should now be in the development container, give VS Code a moment to prepare and you will be ready to go!
If you would like to mount any additional local files to your container, checkout [devcontainer.json "mounts" section](https://containers.dev/implementors/json_reference/) for an example! Upon any mount changes you must rebuild the container using Command Palette as in step 5.
<br />
<h2>Option 3: Install Dependencies Locally</h2>
1. Install [.NET 6](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) for the project
2. (Optional) Get [Python 3.8.13](https://www.python.org/downloads/release/python-3813/) for running Python algorithms
- Follow Python instructions [here](https://github.com/QuantConnect/Lean/tree/master/Algorithm.Python#installing-python-38) for your platform
3. Get [Visual Studio Code](https://code.visualstudio.com/download)
- Get the Extension [C#](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) for C# Debugging
- Get the Extension [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) for Python Debugging
4. Get Lean into VS Code
- Download the repo or clone it using: _git clone [https://github.com/QuantConnect/Lean](https://github.com/QuantConnect/Lean)_
- Download the repo or clone it using: `git clone [https://github.com/QuantConnect/Lean](https://github.com/QuantConnect/Lean)`
- Open the folder using VS Code
Your environment is prepared and ready to run lean
Your environment is prepared and ready to run Lean.
<br />
<h1>How to use Lean</h1>
This section will cover configuring, building, launching and debugging lean. This is only applicable to option 2 from above. This does not apply to Lean CLI, please refer to [CLI documentation](https://www.quantconnect.com/docs/v2/lean-cli/getting-started/lean-cli)
This section will cover configuring, building, launching and debugging lean. This is only applicable to option 2 from above. This does not apply to Lean CLI, please refer to [CLI documentation](https://www.quantconnect.com/docs/v2/lean-cli/key-concepts/getting-started)
<br />
@@ -73,7 +106,6 @@ In VS Code run build task (Ctrl+Shift+B or "Terminal" dropdown); there are a few
- __Build__ - basic build task, just builds Lean once
- __Rebuild__ - rebuild task, completely rebuilds the project. Use if having issues with debugging symbols being loaded for your algorithms.
- __Autobuilder__ - Starts a script that builds then waits for files to change and rebuilds appropriately
- __Clean__ - deletes out all project build files
<br />
@@ -95,7 +127,7 @@ Python algorithms require a little extra work in order to be able to debug them.
First in order to debug a Python algorithm in VS Code we must make the following change to our configuration (Launcher\config.json) under the comment debugging configuration:
"debugging": true,
"debugging-method": "PTVSD",
"debugging-method": "DebugPy",
In setting this we are telling Lean to expect a debugger connection using ‘Python Tools for Visual Studio Debugger’. Once this is set Lean will stop upon initialization and await a connection to the debugger via port 5678.
Here we will cover some common issues with setting this up. This section will expand as we get user feedback!
-Autocomplete and reference finding with omnisharp can sometimes bug, if this occurs use the command palette to restart omnisharp. (Ctrl+Shift+P "OmniSharp: Restart OmniSharp")
-The "project file cannot be loaded" and "nuget packages not found" errors occurs when the project files are open by another process in the host. Closing all applications and/or restarting the computer solve the issue.
- Autocomplete and reference finding with omnisharp can sometimes be buggy, if this occurs use the command palette to restart omnisharp. (Ctrl+Shift+P "OmniSharp: Restart OmniSharp")
- Any error messages about building in VSCode that point to comments in JSON. Either select **ignore** or follow steps described [here](https://stackoverflow.com/questions/47834825/in-vs-code-disable-error-comments-are-not-permitted-in-json) to remove the errors entirely.
thrownewException($"This algorithm intends to add a single security at a time but added: {changes.AddedSecurities.Count}{Environment.NewLine}{securities}");
/// Order fill event handler. On an order fill update the resulting information is passed to this method.
/// </summary>
/// <param name="orderEvent">Order event details containing details of the evemts</param>
/// <param name="orderEvent">Order event details containing details of the events</param>
/// <remarks>This method can be called asynchronously and so should only be used by seasoned C# experts. Ensure you use proper locks on thread-unsafe objects</remarks>
/// Order fill event handler. On an order fill update the resulting information is passed to this method.
/// </summary>
/// <param name="orderEvent">Order event details containing details of the evemts</param>
/// <param name="orderEvent">Order event details containing details of the events</param>
/// <remarks>This method can be called asynchronously and so should only be used by seasoned C# experts. Ensure you use proper locks on thread-unsafe objects</remarks>
/// Order fill event handler. On an order fill update the resulting information is passed to this method.
/// </summary>
/// <param name="orderEvent">Order event details containing details of the evemts</param>
/// <param name="orderEvent">Order event details containing details of the events</param>
/// <remarks>This method can be called asynchronously and so should only be used by seasoned C# experts. Ensure you use proper locks on thread-unsafe objects</remarks>
/// Order fill event handler. On an order fill update the resulting information is passed to this method.
/// </summary>
/// <param name="orderEvent">Order event details containing details of the evemts</param>
/// <param name="orderEvent">Order event details containing details of the events</param>
/// <remarks>This method can be called asynchronously and so should only be used by seasoned C# experts. Ensure you use proper locks on thread-unsafe objects</remarks>
/// Order fill event handler. On an order fill update the resulting information is passed to this method.
/// </summary>
/// <param name="orderEvent">Order event details containing details of the evemts</param>
/// <param name="orderEvent">Order event details containing details of the events</param>
/// <remarks>This method can be called asynchronously and so should only be used by seasoned C# experts. Ensure you use proper locks on thread-unsafe objects</remarks>
/// Order fill event handler. On an order fill update the resulting information is passed to this method.
/// </summary>
/// <param name="orderEvent">Order event details containing details of the evemts</param>
/// <param name="orderEvent">Order event details containing details of the events</param>
/// <remarks>This method can be called asynchronously and so should only be used by seasoned C# experts. Ensure you use proper locks on thread-unsafe objects</remarks>
/// Order fill event handler. On an order fill update the resulting information is passed to this method.
/// </summary>
/// <param name="orderEvent">Order event details containing details of the evemts</param>
/// <param name="orderEvent">Order event details containing details of the events</param>
/// <remarks>This method can be called asynchronously and so should only be used by seasoned C# experts. Ensure you use proper locks on thread-unsafe objects</remarks>
/// Order fill event handler. On an order fill update the resulting information is passed to this method.
/// </summary>
/// <param name="orderEvent">Order event details containing details of the evemts</param>
/// <param name="orderEvent">Order event details containing details of the events</param>
/// <remarks>This method can be called asynchronously and so should only be used by seasoned C# experts. Ensure you use proper locks on thread-unsafe objects</remarks>
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.