Skip to content

Commit

Permalink
MaximumOrderQuantity Error Log Expansion (QuantConnect#5741)
Browse files Browse the repository at this point in the history
* Add more details to the log to improve insight into bugs

* Keep string formatting invariant
  • Loading branch information
C-SELLERS authored Jul 6, 2021
1 parent 7bcaaf8 commit 64b95b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Common/Securities/BuyingPowerModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ public virtual GetMaximumOrderQuantityResult GetMaximumOrderQuantityForTargetBuy
var message = "GetMaximumOrderQuantityForTargetBuyingPower failed to converge to target order margin " +
Invariant($"{absFinalOrderMargin * sign}. Current order margin is {absOrderMargin * sign}. Order quantity {absOrderQuantity * sign}. ") +
Invariant($"Lot size is {parameters.Security.SymbolProperties.LotSize}. Order fees {orderFees}. Security symbol ") +
$"{parameters.Security.Symbol}. Margin unit {absUnitMargin}.";
Invariant($"{parameters.Security.Symbol}. Margin per unit {absUnitMargin}. Target Percentage {parameters.TargetBuyingPower * 100}. ") +
Invariant($"Current Margin {currentSignedUsedMargin}; Target Margin {signedTargetFinalMarginValue}; TPV {totalPortfolioValue}");
throw new ArgumentException(message);
}
lastOrderQuantity = absOrderQuantity;
Expand Down

0 comments on commit 64b95b2

Please sign in to comment.