diff --git a/NasdaqDataLink.cs b/NasdaqDataLink.cs
index 3ac0281..8f27f34 100644
--- a/NasdaqDataLink.cs
+++ b/NasdaqDataLink.cs
@@ -52,6 +52,13 @@ protected string ValueColumnName
set => SetValueColumnName(value);
}
+ ///
+ /// Additional filters to apply on API call.
+ ///
+ protected Dictionary AdditionalFilters = new();
+
+ private string _getAdditionalProperties => string.Join('&', AdditionalFilters.Select(kvp => $"{kvp.Key}={kvp.Value}"));
+
///
/// Static constructor for the class
///
@@ -96,6 +103,38 @@ protected NasdaqDataLink(string valueColumnName)
SetValueColumnName(valueColumnName);
}
+ ///
+ /// Constructor for creating customized instance which doesn't use close, price, settle or value as its value item.
+ ///
+ /// Collection of property name-value pairs to be passed on the API call
+ protected NasdaqDataLink(Dictionary filterDict)
+ {
+ AddFilter(filterDict);
+ }
+
+ ///
+ /// Constructor for creating customized instance which doesn't use close, price, settle or value as its value item.
+ ///
+ /// The name of the column we want to use as reference, the Value property
+ /// Collection of property name-value pairs to be passed on the API call
+ protected NasdaqDataLink(string valueColumnName, Dictionary filterDict)
+ : this(filterDict)
+ {
+ SetValueColumnName(valueColumnName);
+ }
+
+ ///
+ /// To add additional filter when doing data API call.
+ ///
+ /// Collection of property name-value pairs to be passed on the API call
+ private void AddFilter(Dictionary filterDict)
+ {
+ foreach (var (key, value) in filterDict)
+ {
+ AdditionalFilters.Add(key, value);
+ }
+ }
+
///
/// Flag indicating whether or not the Nasdaq Data Link auth code has been set yet
///
@@ -115,6 +154,11 @@ public static bool IsAuthCodeSet
public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
{
var source = $"https://data.nasdaq.com/api/v3/datatables/{config.Symbol.Value}.csv?api_key={_authCode}";
+ var additionalProperties = _getAdditionalProperties;
+ if (!string.IsNullOrEmpty(additionalProperties))
+ {
+ source += $"&{additionalProperties}";
+ }
return new SubscriptionDataSource(source, SubscriptionTransportMedium.RemoteFile) { Sort = true };
}