Skip to content

Commit

Permalink
Improve implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Marinovsky committed Jan 2, 2024
1 parent fdfa80d commit cee4ab5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Engine/Setup/BrokerageSetupHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ protected bool LoadExistingHoldingsAndOrders(IBrokerage brokerage, IAlgorithm al

// verify existing holding security type
Security security;
if (!algorithm.Securities.TryGetValue(holding.Symbol, out security) && !AddUnrequestedSecurity(algorithm, holding.Symbol, holding.Type, out security))
if (!GetOrAddUnrequestedSecurity(algorithm, holding.Symbol, holding.Type, out security))
{
continue;
}
Expand Down Expand Up @@ -459,7 +459,7 @@ protected bool LoadExistingHoldingsAndOrders(IBrokerage brokerage, IAlgorithm al
return true;
}

private bool AddUnrequestedSecurity(IAlgorithm algorithm, Symbol symbol, SecurityType securityType, out Security security)
private bool GetOrAddUnrequestedSecurity(IAlgorithm algorithm, Symbol symbol, SecurityType securityType, out Security security)
{
if (!algorithm.Securities.TryGetValue(symbol, out security))
{
Expand Down Expand Up @@ -523,7 +523,7 @@ protected void GetOpenOrders(IAlgorithm algorithm, IResultHandler resultHandler,
{
// verify existing holding security type
Security security;
if (!algorithm.Securities.TryGetValue(order.Symbol, out security) && !AddUnrequestedSecurity(algorithm, order.Symbol, order.SecurityType, out security))
if (!GetOrAddUnrequestedSecurity(algorithm, order.Symbol, order.SecurityType, out security))
{
continue;
}
Expand Down

0 comments on commit cee4ab5

Please sign in to comment.