Skip to content

Commit

Permalink
Update CryptoExchange.Net version to 8.5.0, added setting of DefaultP…
Browse files Browse the repository at this point in the history
…roxyCredentials to CredentialCache.DefaultCredentials on the DI http client, updated dotnet versions to 9.0
  • Loading branch information
JKorf committed Dec 23, 2024
1 parent 24efb61 commit 8a83a9f
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CoinEx.Net.UnitTests/CoinEx.Net.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ApplicationIcon />
<StartupObject />
</PropertyGroup>
Expand Down
14 changes: 13 additions & 1 deletion CoinEx.Net/Clients/FuturesApi/CoinExSocketClientFuturesApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,19 @@ internal partial class CoinExSocketClientFuturesApi : SocketApiClient, ICoinExSo
internal CoinExSocketClientFuturesApi(ILogger logger, CoinExSocketOptions options)
: base(logger, options.Environment.SocketBaseAddress, options, options.FuturesOptions)
{
RegisterPeriodicQuery("Ping", TimeSpan.FromMinutes(1), q => (new CoinExQuery("server.ping", new Dictionary<string, object>())), null);
RegisterPeriodicQuery(
"Ping",
TimeSpan.FromSeconds(30),
q => new CoinExQuery("server.ping", new Dictionary<string, object>()) { RequestTimeout = TimeSpan.FromSeconds(5) },
(connection, result) =>
{
if (result.Error?.Message.Equals("Query timeout") == true)
{
// Ping timeout, reconnect
_logger.LogWarning("[Sckt {SocketId}] Ping response timeout, reconnecting", connection.SocketId);
_ = connection.TriggerReconnectAsync();
}
});
}
#endregion

Expand Down
14 changes: 13 additions & 1 deletion CoinEx.Net/Clients/SpotApiV2/CoinExSocketClientSpotApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,19 @@ internal partial class CoinExSocketClientSpotApi : SocketApiClient, ICoinExSocke
internal CoinExSocketClientSpotApi(ILogger logger, CoinExSocketOptions options)
: base(logger, options.Environment.SocketBaseAddress, options, options.SpotOptions)
{
RegisterPeriodicQuery("Ping", TimeSpan.FromMinutes(1), q => (new CoinExQuery("server.ping", new Dictionary<string, object>())), null);
RegisterPeriodicQuery(
"Ping",
TimeSpan.FromSeconds(30),
q => new CoinExQuery("server.ping", new Dictionary<string, object>()) { RequestTimeout = TimeSpan.FromSeconds(5) },
(connection, result) =>
{
if (result.Error?.Message.Equals("Query timeout") == true)
{
// Ping timeout, reconnect
_logger.LogWarning("[Sckt {SocketId}] Ping response timeout, reconnecting", connection.SocketId);
_ = connection.TriggerReconnectAsync();
}
});
}
#endregion

Expand Down
4 changes: 1 addition & 3 deletions CoinEx.Net/CoinEx.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Crc32.NET" Version="1.2.0" />
<PackageReference Include="CryptoExchange.Net" Version="8.5.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\CryptoExchange.Net\CryptoExchange.Net\CryptoExchange.Net.csproj" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions CoinEx.Net/CoinEx.Net.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions CoinEx.Net/ExtensionMethods/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private static IServiceCollection AddCoinExCore(
try
{
handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
handler.DefaultProxyCredentials = CredentialCache.DefaultCredentials;
}
catch (PlatformNotSupportedException)
{ }
Expand Down
2 changes: 1 addition & 1 deletion CoinEx.Net/Interfaces/Clients/ICoinExRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface ICoinExRestClient : IRestClient
/// <summary>
/// Update specific options
/// </summary>
/// <param name="options"></param>
/// <param name="options">Options to update. Only specific options are changable after the client has been created</param>
void SetOptions(UpdateOptions options);

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion CoinEx.Net/Interfaces/Clients/ICoinExSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface ICoinExSocketClient : ISocketClient
/// <summary>
/// Update specific options
/// </summary>
/// <param name="options"></param>
/// <param name="options">Options to update. Only specific options are changable after the client has been created</param>
void SetOptions(UpdateOptions options);

/// <summary>
Expand Down

0 comments on commit 8a83a9f

Please sign in to comment.