diff --git a/examples/ExchangeSharpWinForms/ExchangeSharpWinForms.csproj b/examples/ExchangeSharpWinForms/ExchangeSharpWinForms.csproj index 5ac68abc3..980b84ccd 100644 --- a/examples/ExchangeSharpWinForms/ExchangeSharpWinForms.csproj +++ b/examples/ExchangeSharpWinForms/ExchangeSharpWinForms.csproj @@ -2,7 +2,7 @@ {571623F9-1652-4669-8E17-A6FAD1426181} WinExe - net472 + net6.0-windows true ExchangeSharpWinForms ExchangeSharpWinForms @@ -21,9 +21,7 @@ - - Form - + MainForm.cs diff --git a/src/ExchangeSharp.Forms/ExchangeSharp.Forms.csproj b/src/ExchangeSharp.Forms/ExchangeSharp.Forms.csproj index 1be8a2132..f6be83ea7 100644 --- a/src/ExchangeSharp.Forms/ExchangeSharp.Forms.csproj +++ b/src/ExchangeSharp.Forms/ExchangeSharp.Forms.csproj @@ -1,10 +1,11 @@  - net472 + net6.0-windows HAS_WINDOWS_FORMS en 8 + true @@ -19,6 +20,10 @@ + + + + diff --git a/src/ExchangeSharp.Forms/Forms/PlotForm.Designer.cs b/src/ExchangeSharp.Forms/Forms/PlotForm.Designer.cs index 97fe6ebfb..39f8aad15 100644 --- a/src/ExchangeSharp.Forms/Forms/PlotForm.Designer.cs +++ b/src/ExchangeSharp.Forms/Forms/PlotForm.Designer.cs @@ -1,4 +1,4 @@ -#if HAS_WINDOWS_FORMS +#if HAS_WINDOWS_FORMS namespace ExchangeSharp { diff --git a/src/ExchangeSharp.Forms/Forms/PlotForm.cs b/src/ExchangeSharp.Forms/Forms/PlotForm.cs index 8a1f7add9..5ebc81e2c 100644 --- a/src/ExchangeSharp.Forms/Forms/PlotForm.cs +++ b/src/ExchangeSharp.Forms/Forms/PlotForm.cs @@ -1,4 +1,4 @@ -/* +/* MIT LICENSE Copyright 2017 Digital Ruby, LLC - http://www.digitalruby.com diff --git a/src/ExchangeSharp/API/Common/BaseAPI.cs b/src/ExchangeSharp/API/Common/BaseAPI.cs index f5f46fcf0..f11123674 100644 --- a/src/ExchangeSharp/API/Common/BaseAPI.cs +++ b/src/ExchangeSharp/API/Common/BaseAPI.cs @@ -11,6 +11,7 @@ The above copyright notice and this permission notice shall be included in all c */ #nullable enable using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; @@ -176,10 +177,17 @@ public IAPIRequestMaker RequestMaker /// public System.Security.SecureString? Passphrase { get; set; } + private static readonly ConcurrentDictionary rateLimiters = new ConcurrentDictionary(); + private RateGate rateGate; /// /// Rate limiter - set this to a new limit if you are seeing your ip get blocked by the API + /// One rate limiter is created per type of api /// - public RateGate RateLimit { get; set; } = new RateGate(5, TimeSpan.FromSeconds(15.0d)); + public RateGate RateLimit + { + get => rateGate ??= rateLimiters.GetOrAdd(GetType(), v => new RateGate(5, TimeSpan.FromSeconds(15.0d))); + set => rateLimiters[GetType()] = rateGate = value; + } /// /// Default request method diff --git a/src/ExchangeSharp/API/Exchanges/_Base/ExchangeName.cs b/src/ExchangeSharp/API/Exchanges/_Base/ExchangeName.cs index 117069ba5..059248a7d 100644 --- a/src/ExchangeSharp/API/Exchanges/_Base/ExchangeName.cs +++ b/src/ExchangeSharp/API/Exchanges/_Base/ExchangeName.cs @@ -47,7 +47,7 @@ internal static Type GetExchangeType(string exchangeName) try { // make sure we have a valid type for the name - Type type = Type.GetType($"ExchangeSharp.Exchange{exchangeName}API"); + Type type = Type.GetType($"ExchangeSharp.Exchange{exchangeName}API", true, true); // we had better have a type sub-classing from ExchangeAPI if (type is null || !type.IsSubclassOf(exchangeApiType)) diff --git a/src/ExchangeSharpConsole/ExchangeSharpConsole.csproj b/src/ExchangeSharpConsole/ExchangeSharpConsole.csproj index bc8bc23cf..6583ea109 100644 --- a/src/ExchangeSharpConsole/ExchangeSharpConsole.csproj +++ b/src/ExchangeSharpConsole/ExchangeSharpConsole.csproj @@ -3,7 +3,7 @@ Exe exchange-sharp - netcoreapp3.1 + net6.0 en 8 0.9.1