Skip to content

Commit

Permalink
Refactor validation to check buying power only for non-ComboLeg updat…
Browse files Browse the repository at this point in the history
…e orders
  • Loading branch information
JosueNina committed Jan 29, 2025
1 parent 5507c2f commit 71dbab6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Algorithm.CSharp/ComboLegLimitOrderAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public override void OnEndOfAlgorithm()
{"Estimated Strategy Capacity", "$58000.00"},
{"Lowest Capacity Asset", "GOOCV W78ZERHAOVVQ|GOOCV VP83T1ZUHROL"},
{"Portfolio Turnover", "30.22%"},
{"OrderListHash", "1c2fd5b4c3bd8568bf19e64697d7d1b8"}
{"OrderListHash", "ab6171073cd96df46fd9d7bce62f5594"}
};
}
}
11 changes: 7 additions & 4 deletions Engine/TransactionHandlers/BrokerageTransactionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -948,11 +948,14 @@ private OrderResponse HandleUpdateOrderRequest(UpdateOrderRequest request)

ticket.SetOrder(order);

// check to see if we have enough money to place the order
var validationResult = ValidateSufficientBuyingPowerForOrders(order, request);
if (validationResult != null)
// If the order is not part of a ComboLegLimit update, validate sufficient buying power
if (order.Type != OrderType.ComboLegLimit)
{
return validationResult;
var validationResult = ValidateSufficientBuyingPowerForOrders(order, request);
if (validationResult != null)
{
return validationResult;
}
}

bool orderUpdated;
Expand Down

0 comments on commit 71dbab6

Please sign in to comment.