5 Commits

Author SHA1 Message Date
Martin Molinero 936af7df7b Refactor BuyingPowerModel
- Remove unrequired `GetBuyingPower`
- Making `BuyingPowerModel.GetMaintenanceMarginRequirement` protected
instead of public
- Adding `GetMaximumOrderQuantityForDeltaBuyingPower` to replace
public `GetMaintenanceMarginRequirement` and improve API experience for
consumers like the `DefaultMarginCallModel`
- Adding new unit tests
2020-02-04 18:41:15 -03:00
Stefano Raggi 3d1ab08b44 Move Portfolio.ScanForMarginCall to IMarginCallModel.GetMarginCallOrders
The logic for margin calls was previously split between SecurityPortfolioManager.ScanForMarginCall and IMarginCallModel methods, now it is entirely contained within margin call model implementations.

One of the margin call model tests was also testing against the Null model, it has been updated to use the DefaultMarginCallModel.
2018-01-31 11:47:35 +01:00
Stefano Raggi 89357ef7aa Disable margin calls in live mode and refactor margin call models
This PR reverts and replaces PR #674 because it caused issue #678.
The margin call model has been refactored and now contains both methods for margin call order handling (generation and execution).

Disabling margin calls is now much simpler:
Portfolio.MarginCallModel = MarginCallModel.Null;

List of changes:
- Added a new IMarginCallModel interface
- Renamed MarginCallModel to DefaultMarginCallModel
- Refactored margin call models by moving the GenerateMarginCallOrder method from ISecurityMarginModel to IMarginCallModel
- Disabled margin calls by default for live trading in BrokerageSetupHandler initialization
2017-01-06 17:50:38 +01:00
Stefano Raggi adc50af3c8 Revert commit 517ba7d 2017-01-06 15:39:38 +01:00
Stefano Raggi 517ba7db90 Added IMarginCallModel interface
- Renamed MarginCallModel to DefaultMarginCallModel
- Private null implementation exposed as MarginCallModel.Null
2017-01-05 19:03:08 +01:00