Skip to content

Commit

Permalink
Upgrade dependencies and prepare for build using .NET SDK 9.0 for fut…
Browse files Browse the repository at this point in the history
…ure releases
  • Loading branch information
OlegRa committed Nov 15, 2024
1 parent 2eb2db8 commit 2a790c1
Show file tree
Hide file tree
Showing 20 changed files with 1,011 additions and 518 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="RichardSzalay.MockHttp" Version="7.0.0" />
Expand All @@ -24,10 +24,10 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
<PackageReference Include="System.IO.Pipelines" Version="8.0.0" />
<PackageReference Include="System.Threading.Channels" Version="9.0.0" />
<PackageReference Include="System.IO.Pipelines" Version="9.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly" Version="8.4.2" />
<PackageReference Include="Polly" Version="8.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
17 changes: 10 additions & 7 deletions Alpaca.Markets.Extensions/Alpaca.Markets.Extensions.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net462;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net462;net8.0</TargetFrameworks>
<AssemblyOriginatorKeyFile>..\Alpaca.Markets.snk</AssemblyOriginatorKeyFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down Expand Up @@ -49,11 +49,14 @@
<PropertyGroup>
<EnableStrictModeForCompatibleFrameworksInPackage>true</EnableStrictModeForCompatibleFrameworksInPackage>
<!--<GenerateCompatibilitySuppressionFile>true</GenerateCompatibilitySuppressionFile>-->
<PackageValidationBaselineVersion>7.0.0</PackageValidationBaselineVersion>
<PackageValidationBaselineVersion>7.1.0</PackageValidationBaselineVersion>
<EnableStrictModeForCompatibleTfms>true</EnableStrictModeForCompatibleTfms>
<EnablePackageValidation>true</EnablePackageValidation>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
</PropertyGroup>

<PropertyGroup Condition="($(TargetFramework.StartsWith('net8')))">
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
Expand Down Expand Up @@ -98,18 +101,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.8" PrivateAssets="compile;contentfiles;build;analyzers" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" PrivateAssets="compile;contentfiles;build;analyzers" />
<PackageReference Include="System.Threading.Channels" Version="8.0.0" PrivateAssets="compile;contentfiles;build;analyzers" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="9.0.0" PrivateAssets="compile;contentfiles;build;analyzers" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" PrivateAssets="compile;contentfiles;build;analyzers" />
<PackageReference Include="System.Threading.Channels" Version="9.0.0" PrivateAssets="compile;contentfiles;build;analyzers" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" PrivateAssets="compile;contentfiles;build;analyzers" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="!($(TargetFramework.StartsWith('net6')))">
<PackageReference Include="Portable.System.DateTimeOnly" Version="8.0.1" PrivateAssets="compile;contentfiles;build;analyzers" />
<ItemGroup Condition="!($(TargetFramework.StartsWith('net8')))">
<PackageReference Include="Portable.System.DateTimeOnly" Version="8.0.2" PrivateAssets="compile;contentfiles;build;analyzers" />
</ItemGroup>

<Import Project="..\Portable.Helpers\Portable.Helpers.projitems" Label="Shared" />
Expand Down
14 changes: 7 additions & 7 deletions Alpaca.Markets.Extensions/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
Expand All @@ -12,7 +12,7 @@
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Alpaca.Markets.Extensions.CalendarExtensions</Target>
<Left>lib/net6.0/Alpaca.Markets.Extensions.dll</Left>
<Right>lib/net6.0/Alpaca.Markets.Extensions.dll</Right>
<Right>lib/netstandard2.1/Alpaca.Markets.Extensions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
Expand Down Expand Up @@ -68,35 +68,35 @@
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Alpaca.Markets.Extensions.AlpacaTradingClientExtensions.GetCalendarForSingleDayAsync(Alpaca.Markets.IAlpacaTradingClient,System.DateTime,System.Threading.CancellationToken)</Target>
<Left>lib/net6.0/Alpaca.Markets.Extensions.dll</Left>
<Right>lib/net6.0/Alpaca.Markets.Extensions.dll</Right>
<Right>lib/netstandard2.1/Alpaca.Markets.Extensions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Alpaca.Markets.Extensions.HistoricalBarsClientExtensions.GetAverageDailyTradeVolumeAsync``1(Alpaca.Markets.IHistoricalBarsClient{``0},System.String,Alpaca.Markets.IInclusiveTimeInterval)</Target>
<Left>lib/net6.0/Alpaca.Markets.Extensions.dll</Left>
<Right>lib/net6.0/Alpaca.Markets.Extensions.dll</Right>
<Right>lib/netstandard2.1/Alpaca.Markets.Extensions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Alpaca.Markets.Extensions.HistoricalBarsClientExtensions.GetAverageDailyTradeVolumeAsync``1(Alpaca.Markets.IHistoricalBarsClient{``0},System.String,Alpaca.Markets.IInclusiveTimeInterval,System.Threading.CancellationToken)</Target>
<Left>lib/net6.0/Alpaca.Markets.Extensions.dll</Left>
<Right>lib/net6.0/Alpaca.Markets.Extensions.dll</Right>
<Right>lib/netstandard2.1/Alpaca.Markets.Extensions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Alpaca.Markets.Extensions.HistoricalBarsClientExtensions.GetAverageDailyTradeVolumeAsync``1(Alpaca.Markets.IHistoricalBarsClient{``0},System.String,System.DateTime,System.DateTime)</Target>
<Left>lib/net6.0/Alpaca.Markets.Extensions.dll</Left>
<Right>lib/net6.0/Alpaca.Markets.Extensions.dll</Right>
<Right>lib/netstandard2.1/Alpaca.Markets.Extensions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Alpaca.Markets.Extensions.HistoricalBarsClientExtensions.GetAverageDailyTradeVolumeAsync``1(Alpaca.Markets.IHistoricalBarsClient{``0},System.String,System.DateTime,System.DateTime,System.Threading.CancellationToken)</Target>
<Left>lib/net6.0/Alpaca.Markets.Extensions.dll</Left>
<Right>lib/net6.0/Alpaca.Markets.Extensions.dll</Right>
<Right>lib/netstandard2.1/Alpaca.Markets.Extensions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,18 @@ public Task<AuthStatus> ConnectAndAuthenticateAsync(
CancellationToken cancellationToken = default) =>
runWithReconnection(() => Client.ConnectAndAuthenticateAsync(cancellationToken));

public Task DisconnectAsync(
public async Task DisconnectAsync(
CancellationToken cancellationToken = default)
{
Client.SocketClosed -= handleSocketClosed;

#if NET8_0_OR_GREATER
await _cancellationTokenSource.CancelAsync().ConfigureAwait(false);
#else
_cancellationTokenSource.Cancel();
#endif

return Client.DisconnectAsync(cancellationToken);
await Client.DisconnectAsync(cancellationToken).ConfigureAwait(false);
}

public event Action<AuthStatus>? Connected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ public static ValueTask<IDisposableAlpacaDataSubscription<IOrderBook>> Subscribe
client.EnsureNotNull().GetOrderBookSubscription(symbols.EnsureNotNull()),
client);

private static IAlpacaDataSubscription<IOrderBook> getOrderBookSubscription(
private static AlpacaDataSubscriptionContainer<IOrderBook> getOrderBookSubscription(
IAlpacaCryptoStreamingClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetOrderBookSubscription, symbols);

private static IAlpacaDataSubscription<TItem> getSubscription<TItem>(
private static AlpacaDataSubscriptionContainer<TItem> getSubscription<TItem>(
Func<String, IAlpacaDataSubscription<TItem>> selector,
IEnumerable<String> symbols) =>
new AlpacaDataSubscriptionContainer<TItem>(symbols.Select(selector));
new(symbols.Select(selector));
}
Original file line number Diff line number Diff line change
Expand Up @@ -489,28 +489,28 @@ public static ValueTask<IDisposableAlpacaDataSubscription<ILimitUpLimitDown>> Su
client.EnsureNotNull().GetLimitUpLimitDownSubscription(symbols.EnsureNotNull()),
client.EnsureNotNull());

private static IAlpacaDataSubscription<IStatus> getStatusSubscription(
private static AlpacaDataSubscriptionContainer<IStatus> getStatusSubscription(
IAlpacaDataStreamingClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetStatusSubscription, symbols);

private static IAlpacaDataSubscription<ILimitUpLimitDown> getLimitUpLimitDownSubscription(
private static AlpacaDataSubscriptionContainer<ILimitUpLimitDown> getLimitUpLimitDownSubscription(
IAlpacaDataStreamingClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetLimitUpLimitDownSubscription, symbols);

private static IAlpacaDataSubscription<ITrade> getCancellationSubscription(
private static AlpacaDataSubscriptionContainer<ITrade> getCancellationSubscription(
IAlpacaDataStreamingClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetCancellationSubscription, symbols);

private static IAlpacaDataSubscription<ICorrection> getCorrectionSubscription(
private static AlpacaDataSubscriptionContainer<ICorrection> getCorrectionSubscription(
IAlpacaDataStreamingClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetCorrectionSubscription, symbols);

private static IAlpacaDataSubscription<TItem> getSubscription<TItem>(
private static AlpacaDataSubscriptionContainer<TItem> getSubscription<TItem>(
Func<String, IAlpacaDataSubscription<TItem>> selector,
IEnumerable<String> symbols) =>
new AlpacaDataSubscriptionContainer<TItem>(symbols.Select(selector));
new(symbols.Select(selector));
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ public static ValueTask<IDisposableAlpacaDataSubscription<INewsArticle>> Subscri
client.EnsureNotNull().GetNewsSubscription(symbols.EnsureNotNull()),
client.EnsureNotNull());

private static IAlpacaDataSubscription<INewsArticle> getNewsSubscription(
private static AlpacaDataSubscriptionContainer<INewsArticle> getNewsSubscription(
IAlpacaNewsStreamingClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetNewsSubscription, symbols);

private static IAlpacaDataSubscription<TItem> getSubscription<TItem>(
private static AlpacaDataSubscriptionContainer<TItem> getSubscription<TItem>(
Func<String, IAlpacaDataSubscription<TItem>> selector,
IEnumerable<String> symbols) =>
new AlpacaDataSubscriptionContainer<TItem>(symbols.Select(selector));
new(symbols.Select(selector));
}
Original file line number Diff line number Diff line change
Expand Up @@ -610,33 +610,33 @@ public static ValueTask<IDisposableAlpacaDataSubscription<IBar>> SubscribeUpdate
client.EnsureNotNull().GetUpdatedBarSubscription(symbols.EnsureNotNull()),
client.EnsureNotNull());

private static IAlpacaDataSubscription<ITrade> getTradeSubscription(
private static AlpacaDataSubscriptionContainer<ITrade> getTradeSubscription(
IStreamingDataClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetTradeSubscription, symbols);

private static IAlpacaDataSubscription<IQuote> getQuoteSubscription(
private static AlpacaDataSubscriptionContainer<IQuote> getQuoteSubscription(
IStreamingDataClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetQuoteSubscription, symbols);

private static IAlpacaDataSubscription<IBar> getMinuteBarSubscription(
private static AlpacaDataSubscriptionContainer<IBar> getMinuteBarSubscription(
IStreamingDataClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetMinuteBarSubscription, symbols);

private static IAlpacaDataSubscription<IBar> getDailyBarSubscription(
private static AlpacaDataSubscriptionContainer<IBar> getDailyBarSubscription(
IStreamingDataClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetDailyBarSubscription, symbols);

private static IAlpacaDataSubscription<IBar> getUpdatedBarSubscription(
private static AlpacaDataSubscriptionContainer<IBar> getUpdatedBarSubscription(
IStreamingDataClient client,
IEnumerable<String> symbols) =>
getSubscription(client.GetUpdatedBarSubscription, symbols);

private static IAlpacaDataSubscription<TItem> getSubscription<TItem>(
private static AlpacaDataSubscriptionContainer<TItem> getSubscription<TItem>(
Func<String, IAlpacaDataSubscription<TItem>> selector,
IEnumerable<String> symbols) =>
new AlpacaDataSubscriptionContainer<TItem>(symbols.Select(selector));
new(symbols.Select(selector));
}
Loading

0 comments on commit 2a790c1

Please sign in to comment.