5c5201944a
* 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
QuantConnect Testing
Before starting any testing, follow the installation instructions to get LEAN running C# algorithms in your machine. For any Python related tests please ensure you have followed the setup as described here.
If the above installation, build, and initial run was successful than we can move forward to testing.
Visual Studio:
Locating Tests
- Open Visual Studios
- Open Test Explorer ("Test" > "Test Explorer")
- The list should populate itself as it reads all the tests it found during the build process. If not, press "Run All Tests" and let VS find all of the tests.
- From here select the tests you would like to run and begin running them.
Failed Test Logs
- On a failed test, check the test for information by clicking on the desired test and selecting "Open Additional Output"
- This will show the stack trace and where the code failed to meet the testing requirements.
Common Problems
Having .NetFramework issues with testing?
- Install NUnit3TestAdapter for VS
Missing dependencies for Python Algorithm?
- Use pip or conda to install the module.