Skip to content

Commit

Permalink
Address requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Marinovsky committed Dec 23, 2024
1 parent 06f58a1 commit 1c04484
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ namespace QuantConnect.Algorithm.CSharp
/// </summary>
public class IndexSecurityIsNotTradableRegressionAlgorithm: IndexSecurityCanBeTradableRegressionAlgorithm
{
public override bool IsTradable { get; set; } = false;
public override bool IsTradable { get; set; }
}
}
9 changes: 5 additions & 4 deletions Common/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3824,14 +3824,15 @@ public static void ProcessSecurityChanges(this IAlgorithm algorithm, SecurityCha
{
foreach (var security in securityChanges.AddedSecurities)
{
if (security.Type == SecurityType.Index && !security.ManualSetIsTradable)
// uses TryAdd, so don't need to worry about duplicates here
algorithm.Securities.Add(security);

if (security.Type == SecurityType.Index && !(security as Securities.Index.Index).ManualSetIsTradable)
{
continue;
}
security.IsTradable = true;

// uses TryAdd, so don't need to worry about duplicates here
algorithm.Securities.Add(security);
security.IsTradable = true;
}

var activeSecurities = algorithm.UniverseManager.ActiveSecurities;
Expand Down
5 changes: 5 additions & 0 deletions Common/Securities/Index/Index.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public override bool IsTradable {
}
}

/// <summary>
/// Field to check if the user has manually set IsTradable field to true
/// </summary>
internal bool ManualSetIsTradable { get; set; }

/// <summary>
/// Constructor for the INDEX security
/// </summary>
Expand Down
5 changes: 0 additions & 5 deletions Common/Securities/Security.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ public class Security : DynamicObject, ISecurityPrice
/// <remarks>Just use a list + lock, not concurrent bag, avoid garbage it creates for features we don't need here. See https://github.com/dotnet/runtime/issues/23103</remarks>
private readonly List<SubscriptionDataConfig> _subscriptionsBag;

/// <summary>
/// Field to check if the user has manually set IsTradable field to true
/// </summary>
internal bool ManualSetIsTradable { get; set; }

/// <summary>
/// This securities <see cref="IShortableProvider"/>
/// </summary>
Expand Down

0 comments on commit 1c04484

Please sign in to comment.