Skip to content

Commit bc646c9

Browse files
authored
Use proper extended dictionary types for public properties (#9119)
1 parent 857a950 commit bc646c9

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

Algorithm/QCAlgorithm.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
using Newtonsoft.Json;
5959
using QuantConnect.Securities.Index;
6060
using QuantConnect.Api;
61+
using Common.Util;
6162

6263
namespace QuantConnect.Algorithm
6364
{
@@ -271,7 +272,7 @@ public SecurityManager Securities
271272
/// a security that is currently selected by the universe or has holdings or open orders.
272273
/// </summary>
273274
[DocumentationAttribute(SecuritiesAndPortfolio)]
274-
public IReadOnlyDictionary<Symbol, Security> ActiveSecurities => UniverseManager.ActiveSecurities;
275+
public ReadOnlyExtendedDictionary<Symbol, Security> ActiveSecurities => UniverseManager.ActiveSecurities;
275276

276277
/// <summary>
277278
/// Portfolio object provieds easy access to the underlying security-holding properties; summed together in a way to make them useful.
@@ -914,7 +915,7 @@ public decimal GetParameter(string name, decimal defaultValue)
914915
/// Gets a read-only dictionary with all current parameters
915916
/// </summary>
916917
[DocumentationAttribute(ParameterAndOptimization)]
917-
public IReadOnlyDictionary<string, string> GetParameters()
918+
public ReadOnlyExtendedDictionary<string, string> GetParameters()
918919
{
919920
return _parameters.ToReadOnlyExtendedDictionary();
920921
}

AlgorithmFactory/Python/Wrappers/AlgorithmPythonWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ public void OnEndOfTimeStep()
682682
/// <summary>
683683
/// Gets a read-only dictionary with all current parameters
684684
/// </summary>
685-
public IReadOnlyDictionary<string, string> GetParameters() => _baseAlgorithm.GetParameters();
685+
public ReadOnlyExtendedDictionary<string, string> GetParameters() => _baseAlgorithm.GetParameters();
686686

687687
/// <summary>
688688
/// Gets the parameter with the specified name. If a parameter with the specified name does not exist,

Common/Interfaces/IAlgorithm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ InsightManager Insights
430430
/// <summary>
431431
/// Gets a read-only dictionary with all current parameters
432432
/// </summary>
433-
IReadOnlyDictionary<string, string> GetParameters();
433+
ReadOnlyExtendedDictionary<string, string> GetParameters();
434434

435435
/// <summary>
436436
/// Gets the parameter with the specified name. If a parameter with the specified name does not exist,

Common/Securities/UniverseManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class UniverseManager : BaseExtendedDictionary<Symbol, Universe, Concurre
4141
/// Read-only dictionary containing all active securities. An active security is
4242
/// a security that is currently selected by the universe or has holdings or open orders.
4343
/// </summary>
44-
public IReadOnlyDictionary<Symbol, Security> ActiveSecurities => this
44+
public ReadOnlyExtendedDictionary<Symbol, Security> ActiveSecurities => this
4545
.SelectMany(ukvp => ukvp.Value.Members.Select(mkvp => mkvp.Value))
4646
.DistinctBy(s => s.Symbol)
4747
.ToReadOnlyExtendedDictionary(s => s.Symbol);
@@ -153,4 +153,4 @@ protected virtual void OnCollectionChanged(UniverseManagerChanged e)
153153
CollectionChanged?.Invoke(this, e);
154154
}
155155
}
156-
}
156+
}

0 commit comments

Comments
 (0)