Skip to content

Commit

Permalink
Simplified configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbarbez committed Mar 23, 2022
1 parent a301d5c commit 97f7118
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
29 changes: 4 additions & 25 deletions BarbezDotEu.AlphaVantage/AlphaVantageConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,22 @@ public class AlphaVantageConfiguration
/// <summary>
/// Gets the maximum number of calls allowed per day.
/// </summary>
public string MaxCallsPerDay { get; }
public long MaxCallsPerDay { get; }

/// <summary>
/// Gets the fully-qualified URL to use to search for symbols, including the API key. However, omits the actual search symbol.
/// </summary>
public string SymbolSearchUrl { get; }

/// <summary>
/// Constructs a new <see cref="AlphaVantageConfiguration"/> using given parameters.
/// </summary>
/// <param name="maxCallsPerDay">The max. number of calls per day before API calls become rate limited by Alpha Vantage.</param>
/// <param name="symbolSearchUrl">The fully-qualified URL to use to search for symbols, including the API key. However, omit the actual search symbol.</param>
public AlphaVantageConfiguration(string maxCallsPerDay, string symbolSearchUrl)
{
MaxCallsPerDay = maxCallsPerDay;
SymbolSearchUrl = symbolSearchUrl;
}

/// <summary>
/// Constructs a new <see cref="AlphaVantageConfiguration"/> using given parameters.
/// </summary>
/// <param name="maxCallsPerDay">The max. number of calls per day before API calls become rate limited by Alpha Vantage.</param>
/// <param name="symbolSearchUrl">The fully-qualified URL to use to search for symbols, including the API key. However, omit the actual search symbol.</param>
public AlphaVantageConfiguration(long maxCallsPerDay, string symbolSearchUrl)
{
MaxCallsPerDay = maxCallsPerDay.ToString();
SymbolSearchUrl = symbolSearchUrl;
}

/// <summary>
/// Constructs a new <see cref="AlphaVantageConfiguration"/> using all-default settings.
/// </summary>
/// <param name="apiKey">The API key (to be requested via Alpha Vantage's website prior to using this library).</param>
public AlphaVantageConfiguration(string apiKey)
/// <param name="maxCallsPerDay">The maximum number of calls allowed per day.</param>
public AlphaVantageConfiguration(string apiKey, long maxCallsPerDay)
{
MaxCallsPerDay = $"500";
SymbolSearchUrl = $"https://www.alphavantage.co/query?function=SYMBOL_SEARCH&apikey={apiKey}&keywords=";
MaxCallsPerDay = maxCallsPerDay;
}
}
}
4 changes: 2 additions & 2 deletions BarbezDotEu.AlphaVantage/BarbezDotEu.AlphaVantage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Product>BarbezDotEu.AlphaVantage</Product>
<PackageId>BarbezDotEu.AlphaVantage</PackageId>
<Copyright>©2022 Hannes Barbez</Copyright>
<Version>4.0.2</Version>
<Version>5.0.0</Version>
<Description>An unofficial, modern, very much work-in-progress client for Alpha Vantage APIs.</Description>
<PackageTags>basic;polite;alpha;vantage;AlphaVantage;integration;third-party integration;provider;barbez</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand All @@ -21,6 +21,6 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BarbezDotEu.Provider" Version="3.0.4" />
<PackageReference Include="BarbezDotEu.Provider" Version="5.0.0" />
</ItemGroup>
</Project>

0 comments on commit 97f7118

Please sign in to comment.