Skip to content

Commit 07845bf

Browse files
committed
Update CryptoExchange.Net version to 8.5.0, added SetOptions on clients, added setting of DefaultProxyCredentials to CredentialCache.DefaultCredentials on the DI http client, improved websocket disconnect detection, updated dotnet versions to 9.0
1 parent c34f22b commit 07845bf

File tree

12 files changed

+62
-8
lines changed

12 files changed

+62
-8
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup .NET
1717
uses: actions/setup-dotnet@v1
1818
with:
19-
dotnet-version: 8.0.x
19+
dotnet-version: 9.0.x
2020
- name: Set GitHub package source
2121
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"
2222
- name: Restore dependencies

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup .NET
1515
uses: actions/setup-dotnet@v1
1616
with:
17-
dotnet-version: 8.0.x
17+
dotnet-version: 9.0.x
1818
- name: Set GitHub package source
1919
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"
2020
- name: Restore dependencies

HTX.Net.UnitTests/HTX.Net.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

HTX.Net.UnitTests/TestImplementations/TestSocket.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace HTX.Net.UnitTests.TestImplementations
1111
{
12-
public class TestSocket: IWebsocket
12+
public class TestSocket : IWebsocket
1313
{
1414
public bool CanConnect { get; set; } = true;
1515
public bool Connected { get; set; }
@@ -120,5 +120,7 @@ public Task ReconnectAsync()
120120
{
121121
throw new NotImplementedException();
122122
}
123+
124+
public void UpdateProxy(ApiProxy proxy) => throw new NotImplementedException();
123125
}
124126
}

HTX.Net/Clients/HTXRestClient.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using HTX.Net.Interfaces.Clients.UsdtFuturesApi;
77
using HTX.Net.Clients.UsdtFutures;
88
using Microsoft.Extensions.Options;
9+
using CryptoExchange.Net.Objects.Options;
910

1011
namespace HTX.Net.Clients
1112
{
@@ -49,6 +50,14 @@ public HTXRestClient(HttpClient? httpClient, ILoggerFactory? loggerFactory, IOpt
4950
#endregion
5051

5152
#region methods
53+
54+
/// <inheritdoc />
55+
public void SetOptions(UpdateOptions options)
56+
{
57+
SpotApi.SetOptions(options);
58+
UsdtFuturesApi.SetOptions(options);
59+
}
60+
5261
/// <summary>
5362
/// Set the default options to be used when creating new clients
5463
/// </summary>

HTX.Net/Clients/HTXSocketClient.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using CryptoExchange.Net.Clients;
2+
using CryptoExchange.Net.Objects.Options;
23
using HTX.Net.Clients.SpotApi;
34
using HTX.Net.Clients.UsdtFutures;
45
using HTX.Net.Interfaces.Clients;
@@ -45,6 +46,14 @@ public HTXSocketClient(IOptions<HTXSocketOptions> options, ILoggerFactory? logge
4546
#endregion
4647

4748
#region methods
49+
50+
/// <inheritdoc />
51+
public void SetOptions(UpdateOptions options)
52+
{
53+
SpotApi.SetOptions(options);
54+
UsdtFuturesApi.SetOptions(options);
55+
}
56+
4857
/// <summary>
4958
/// Set the default options to be used when creating new clients
5059
/// </summary>

HTX.Net/ExtensionMethods/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ private static IServiceCollection AddHTXCore(
110110
try
111111
{
112112
handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
113+
handler.DefaultProxyCredentials = CredentialCache.DefaultCredentials;
113114
}
114115
catch (PlatformNotSupportedException)
115116
{ }

HTX.Net/HTX.Net.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<PrivateAssets>all</PrivateAssets>
4949
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5050
</PackageReference>
51-
<PackageReference Include="CryptoExchange.Net" Version="8.4.4" />
51+
<PackageReference Include="CryptoExchange.Net" Version="8.5.0" />
5252
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
5353
<PrivateAssets>all</PrivateAssets>
5454
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

HTX.Net/HTX.Net.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
<param name="loggerFactory">The logger factory</param>
2828
<param name="httpClient">Http client for this client</param>
2929
</member>
30+
<member name="M:HTX.Net.Clients.HTXRestClient.SetOptions(CryptoExchange.Net.Objects.Options.UpdateOptions)">
31+
<inheritdoc />
32+
</member>
3033
<member name="M:HTX.Net.Clients.HTXRestClient.SetDefaultOptions(System.Action{HTX.Net.Objects.Options.HTXRestOptions})">
3134
<summary>
3235
Set the default options to be used when creating new clients
@@ -58,6 +61,9 @@
5861
<param name="loggerFactory">The logger factory</param>
5962
<param name="options">Option configuration</param>
6063
</member>
64+
<member name="M:HTX.Net.Clients.HTXSocketClient.SetOptions(CryptoExchange.Net.Objects.Options.UpdateOptions)">
65+
<inheritdoc />
66+
</member>
6167
<member name="M:HTX.Net.Clients.HTXSocketClient.SetDefaultOptions(System.Action{HTX.Net.Objects.Options.HTXSocketOptions})">
6268
<summary>
6369
Set the default options to be used when creating new clients
@@ -3495,6 +3501,12 @@
34953501
Usdt futures endpoints
34963502
</summary>
34973503
</member>
3504+
<member name="M:HTX.Net.Interfaces.Clients.IHTXRestClient.SetOptions(CryptoExchange.Net.Objects.Options.UpdateOptions)">
3505+
<summary>
3506+
Update specific options
3507+
</summary>
3508+
<param name="options">Options to update. Only specific options are changable after the client has been created</param>
3509+
</member>
34983510
<member name="M:HTX.Net.Interfaces.Clients.IHTXRestClient.SetApiCredentials(CryptoExchange.Net.Authentication.ApiCredentials)">
34993511
<summary>
35003512
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 @@
35163528
Usdt futures streams
35173529
</summary>
35183530
</member>
3531+
<member name="M:HTX.Net.Interfaces.Clients.IHTXSocketClient.SetOptions(CryptoExchange.Net.Objects.Options.UpdateOptions)">
3532+
<summary>
3533+
Update specific options
3534+
</summary>
3535+
<param name="options">Options to update. Only specific options are changable after the client has been created</param>
3536+
</member>
35193537
<member name="M:HTX.Net.Interfaces.Clients.IHTXSocketClient.SetApiCredentials(CryptoExchange.Net.Authentication.ApiCredentials)">
35203538
<summary>
35213539
Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options.

HTX.Net/Interfaces/Clients/IHTXRestClient.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using HTX.Net.Interfaces.Clients.SpotApi;
1+
using CryptoExchange.Net.Objects.Options;
2+
using HTX.Net.Interfaces.Clients.SpotApi;
23
using HTX.Net.Interfaces.Clients.UsdtFuturesApi;
34

45
namespace HTX.Net.Interfaces.Clients
@@ -17,6 +18,12 @@ public interface IHTXRestClient : IRestClient
1718
/// </summary>
1819
IHTXRestClientUsdtFuturesApi UsdtFuturesApi { get; }
1920

21+
/// <summary>
22+
/// Update specific options
23+
/// </summary>
24+
/// <param name="options">Options to update. Only specific options are changable after the client has been created</param>
25+
void SetOptions(UpdateOptions options);
26+
2027
/// <summary>
2128
/// Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options.
2229
/// </summary>

HTX.Net/Interfaces/Clients/IHTXSocketClient.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using HTX.Net.Interfaces.Clients.SpotApi;
1+
using CryptoExchange.Net.Objects.Options;
2+
using HTX.Net.Interfaces.Clients.SpotApi;
23
using HTX.Net.Interfaces.Clients.UsdtFuturesApi;
34

45
namespace HTX.Net.Interfaces.Clients
@@ -17,6 +18,12 @@ public interface IHTXSocketClient : ISocketClient
1718
/// </summary>
1819
public IHTXSocketClientUsdtFuturesApi UsdtFuturesApi { get; }
1920

21+
/// <summary>
22+
/// Update specific options
23+
/// </summary>
24+
/// <param name="options">Options to update. Only specific options are changable after the client has been created</param>
25+
void SetOptions(UpdateOptions options);
26+
2027
/// <summary>
2128
/// Set the API credentials for this client. All Api clients in this client will use the new credentials, regardless of earlier set options.
2229
/// </summary>

HTX.Net/Objects/Options/HTXSocketOptions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public class HTXSocketOptions : SocketExchangeOptions<HTXEnvironment>
1313
internal static HTXSocketOptions Default { get; set; } = new HTXSocketOptions
1414
{
1515
Environment = HTXEnvironment.Live,
16-
SocketSubscriptionsCombineTarget = 10
16+
SocketSubscriptionsCombineTarget = 10,
17+
SocketNoDataTimeout = TimeSpan.FromSeconds(30)
1718
};
1819

1920
/// <summary>

0 commit comments

Comments
 (0)