diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index cafaa72..e156742 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Set GitHub package source run: dotnet nuget add source --username JKorf --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/JKorf/index.json" - name: Restore dependencies diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0e18e3e..67110fd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Set GitHub package source run: dotnet nuget add source --username JKorf --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/JKorf/index.json" - name: Restore dependencies diff --git a/HTX.Net.UnitTests/HTX.Net.UnitTests.csproj b/HTX.Net.UnitTests/HTX.Net.UnitTests.csproj index 5fc3012..fa2e4e1 100644 --- a/HTX.Net.UnitTests/HTX.Net.UnitTests.csproj +++ b/HTX.Net.UnitTests/HTX.Net.UnitTests.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 diff --git a/HTX.Net.UnitTests/TestImplementations/TestSocket.cs b/HTX.Net.UnitTests/TestImplementations/TestSocket.cs index 9a14bca..7baf56c 100644 --- a/HTX.Net.UnitTests/TestImplementations/TestSocket.cs +++ b/HTX.Net.UnitTests/TestImplementations/TestSocket.cs @@ -9,7 +9,7 @@ namespace HTX.Net.UnitTests.TestImplementations { - public class TestSocket: IWebsocket + public class TestSocket : IWebsocket { public bool CanConnect { get; set; } = true; public bool Connected { get; set; } @@ -120,5 +120,7 @@ public Task ReconnectAsync() { throw new NotImplementedException(); } + + public void UpdateProxy(ApiProxy proxy) => throw new NotImplementedException(); } } diff --git a/HTX.Net/Clients/HTXRestClient.cs b/HTX.Net/Clients/HTXRestClient.cs index 4856e73..33a0ac8 100644 --- a/HTX.Net/Clients/HTXRestClient.cs +++ b/HTX.Net/Clients/HTXRestClient.cs @@ -6,6 +6,7 @@ using HTX.Net.Interfaces.Clients.UsdtFuturesApi; using HTX.Net.Clients.UsdtFutures; using Microsoft.Extensions.Options; +using CryptoExchange.Net.Objects.Options; namespace HTX.Net.Clients { @@ -49,6 +50,14 @@ public HTXRestClient(HttpClient? httpClient, ILoggerFactory? loggerFactory, IOpt #endregion #region methods + + /// + public void SetOptions(UpdateOptions options) + { + SpotApi.SetOptions(options); + UsdtFuturesApi.SetOptions(options); + } + /// /// Set the default options to be used when creating new clients /// diff --git a/HTX.Net/Clients/HTXSocketClient.cs b/HTX.Net/Clients/HTXSocketClient.cs index e90afa0..f656339 100644 --- a/HTX.Net/Clients/HTXSocketClient.cs +++ b/HTX.Net/Clients/HTXSocketClient.cs @@ -1,4 +1,5 @@ using CryptoExchange.Net.Clients; +using CryptoExchange.Net.Objects.Options; using HTX.Net.Clients.SpotApi; using HTX.Net.Clients.UsdtFutures; using HTX.Net.Interfaces.Clients; @@ -45,6 +46,14 @@ public HTXSocketClient(IOptions options, ILoggerFactory? logge #endregion #region methods + + /// + public void SetOptions(UpdateOptions options) + { + SpotApi.SetOptions(options); + UsdtFuturesApi.SetOptions(options); + } + /// /// Set the default options to be used when creating new clients /// diff --git a/HTX.Net/ExtensionMethods/ServiceCollectionExtensions.cs b/HTX.Net/ExtensionMethods/ServiceCollectionExtensions.cs index 948c4f5..ee2e9c8 100644 --- a/HTX.Net/ExtensionMethods/ServiceCollectionExtensions.cs +++ b/HTX.Net/ExtensionMethods/ServiceCollectionExtensions.cs @@ -110,6 +110,7 @@ private static IServiceCollection AddHTXCore( try { handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; + handler.DefaultProxyCredentials = CredentialCache.DefaultCredentials; } catch (PlatformNotSupportedException) { } diff --git a/HTX.Net/HTX.Net.csproj b/HTX.Net/HTX.Net.csproj index ebe2d4f..c4c42e0 100644 --- a/HTX.Net/HTX.Net.csproj +++ b/HTX.Net/HTX.Net.csproj @@ -48,7 +48,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/HTX.Net/HTX.Net.xml b/HTX.Net/HTX.Net.xml index 1f8ddb8..8893368 100644 --- a/HTX.Net/HTX.Net.xml +++ b/HTX.Net/HTX.Net.xml @@ -27,6 +27,9 @@ The logger factory Http client for this client + + + Set the default options to be used when creating new clients @@ -58,6 +61,9 @@ The logger factory Option configuration + + + Set the default options to be used when creating new clients @@ -3495,6 +3501,12 @@ Usdt futures endpoints + + + Update specific options + + Options to update. Only specific options are changable after the client has been created + Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options. @@ -3516,6 +3528,12 @@ Usdt futures streams + + + Update specific options + + Options to update. Only specific options are changable after the client has been created + Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options. diff --git a/HTX.Net/Interfaces/Clients/IHTXRestClient.cs b/HTX.Net/Interfaces/Clients/IHTXRestClient.cs index cf83f85..bce013f 100644 --- a/HTX.Net/Interfaces/Clients/IHTXRestClient.cs +++ b/HTX.Net/Interfaces/Clients/IHTXRestClient.cs @@ -1,4 +1,5 @@ -using HTX.Net.Interfaces.Clients.SpotApi; +using CryptoExchange.Net.Objects.Options; +using HTX.Net.Interfaces.Clients.SpotApi; using HTX.Net.Interfaces.Clients.UsdtFuturesApi; namespace HTX.Net.Interfaces.Clients @@ -17,6 +18,12 @@ public interface IHTXRestClient : IRestClient /// IHTXRestClientUsdtFuturesApi UsdtFuturesApi { get; } + /// + /// Update specific options + /// + /// Options to update. Only specific options are changable after the client has been created + void SetOptions(UpdateOptions options); + /// /// Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options. /// diff --git a/HTX.Net/Interfaces/Clients/IHTXSocketClient.cs b/HTX.Net/Interfaces/Clients/IHTXSocketClient.cs index dfc42f2..ca8793a 100644 --- a/HTX.Net/Interfaces/Clients/IHTXSocketClient.cs +++ b/HTX.Net/Interfaces/Clients/IHTXSocketClient.cs @@ -1,4 +1,5 @@ -using HTX.Net.Interfaces.Clients.SpotApi; +using CryptoExchange.Net.Objects.Options; +using HTX.Net.Interfaces.Clients.SpotApi; using HTX.Net.Interfaces.Clients.UsdtFuturesApi; namespace HTX.Net.Interfaces.Clients @@ -17,6 +18,12 @@ public interface IHTXSocketClient : ISocketClient /// public IHTXSocketClientUsdtFuturesApi UsdtFuturesApi { get; } + /// + /// Update specific options + /// + /// Options to update. Only specific options are changable after the client has been created + void SetOptions(UpdateOptions options); + /// /// Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options. /// diff --git a/HTX.Net/Objects/Options/HTXSocketOptions.cs b/HTX.Net/Objects/Options/HTXSocketOptions.cs index e02c9ab..6124cc3 100644 --- a/HTX.Net/Objects/Options/HTXSocketOptions.cs +++ b/HTX.Net/Objects/Options/HTXSocketOptions.cs @@ -13,7 +13,8 @@ public class HTXSocketOptions : SocketExchangeOptions internal static HTXSocketOptions Default { get; set; } = new HTXSocketOptions { Environment = HTXEnvironment.Live, - SocketSubscriptionsCombineTarget = 10 + SocketSubscriptionsCombineTarget = 10, + SocketNoDataTimeout = TimeSpan.FromSeconds(30) }; ///