diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index 5847918..bc2f09c 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -21,7 +21,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v2 with: - dotnet-version: 6.0.x + dotnet-version: 7.0.x - name: Add github nuget source run: dotnet nuget add source "https://nuget.pkg.github.com/trakx/index.json" --name "github" --username "trakx-bot" --password ${{secrets.TRAKX_BOT_READONLY_PAT}} --store-password-in-clear-text diff --git a/.github/workflows/publish.nuget.yml b/.github/workflows/publish.nuget.yml index 9b9f418..e2e9c51 100644 --- a/.github/workflows/publish.nuget.yml +++ b/.github/workflows/publish.nuget.yml @@ -43,16 +43,14 @@ jobs: - name: Bump version id: bumpVersion - uses: trakx/bump-version-action@v8 + uses: trakx/bump-version-action/get-tag@v9.1.1 with: semverIncrementLevel: ${{github.event.inputs.semverIncrementLevel}} - releaseBranches: master - githubToken: ${{secrets.GITHUB_TOKEN}} - name: Setup .NET Core uses: actions/setup-dotnet@v2 with: - dotnet-version: 6.0.x + dotnet-version: 7.0.x - name: Add github nuget source run: dotnet nuget add source "https://nuget.pkg.github.com/trakx/index.json" --name "github" --username "trakx-bot" --password ${{secrets.TRAKX_BOT_READONLY_PAT}} --store-password-in-clear-text @@ -88,8 +86,9 @@ jobs: for f in ./nuget/*.symbols.nupkg; do echo "pushing $f file.." && dotnet nuget push $f --api-key ${{secrets.GITHUB_TOKEN}} \ --source "https://nuget.pkg.github.com/trakx/index.json"; done - - name: push version tag - uses: anothrNick/github-tag-action@1.38.0 - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - CUSTOM_TAG: v${{steps.bumpVersion.outputs.fullVersion}} + - name: Push version tag + id: pushTag + uses: trakx/bump-version-action/push-tag@v9.1.1 + with: + tag: v${{steps.bumpVersion.outputs.fullVersion}} + githubToken: ${{secrets.GITHUB_TOKEN}} diff --git a/README.md b/README.md index 1f1f28a..c06e58e 100644 --- a/README.md +++ b/README.md @@ -47,11 +47,6 @@ In order to be able to run some integration tests, you should create a `.env` fi CryptoCompareApiConfiguration__ApiKey=******** ``` -## AWS Parameters -In order to be able to run some integration tests you should ensure that you have access to the following AWS parameters : -```awsParams -/Trakx/CryptoCompare/ApiClient/CryptoCompareApiConfiguration/ApiKey -``` ## Basic usage ````csharp @@ -80,3 +75,9 @@ Console.WriteLine(eth.Data.General.Name); [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjoancaron%2Fcryptocompare-api.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjoancaron%2Fcryptocompare-api?ref=badge_large) + +## AWS Parameters +In order to be able to run some integration tests, you should ensure that you have access to the AWS parameters starting in `/CiCd`. In order for the applications in this solution to run correctly on AWS, please ensure that variables starting in `/[environment]` are defined for all 3 environments \( _Production_, _Staging_, _Development_ \) : +```awsParams +/[environment]/Trakx/CryptoCompare/ApiClient/CryptoCompareApiConfiguration/ApiKey +``` \ No newline at end of file diff --git a/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/ReadmeDocumentationUpdater.cs b/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/ReadmeDocumentationUpdater.cs index fc726e8..1af7e10 100644 --- a/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/ReadmeDocumentationUpdater.cs +++ b/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/ReadmeDocumentationUpdater.cs @@ -1,4 +1,4 @@ -using Trakx.Utils.Testing.ReadmeUpdater; +using Trakx.Common.Testing.Documentation.ReadmeUpdater; using Xunit.Abstractions; namespace Trakx.CryptoCompare.ApiClient.Tests.Integration diff --git a/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/Rest/Clients/CryptoCompareClientTestsBase.cs b/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/Rest/Clients/CryptoCompareClientTestsBase.cs index 098efad..a4cd66f 100644 --- a/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/Rest/Clients/CryptoCompareClientTestsBase.cs +++ b/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/Rest/Clients/CryptoCompareClientTestsBase.cs @@ -1,7 +1,7 @@ using System; using Microsoft.Extensions.DependencyInjection; +using Trakx.Common.Testing.Configuration; using Trakx.CryptoCompare.ApiClient.Rest; -using Trakx.Utils.Testing; using Xunit; namespace Trakx.CryptoCompare.ApiClient.Tests.Integration.Rest.Clients @@ -29,7 +29,7 @@ public class CryptoCompareApiFixture : IDisposable public ICryptoCompareClient CryptoCompareClient { get; } public CryptoCompareApiFixture() { - var configuration = ConfigurationHelper.GetConfigurationFromEnv(); + var configuration = EnvConfigurationHelper.GetConfigurationFromEnv(); var services = new ServiceCollection(); services.AddCryptoCompareClient(configuration); var provider = services.BuildServiceProvider(); diff --git a/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/Rest/Core/ThrottledHttpClientHandlerTests.cs b/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/Rest/Core/ThrottledHttpClientHandlerTests.cs index 2ae2bea..17336aa 100644 --- a/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/Rest/Core/ThrottledHttpClientHandlerTests.cs +++ b/src/Trakx.CryptoCompare.ApiClient.Tests/Integration/Rest/Core/ThrottledHttpClientHandlerTests.cs @@ -1,9 +1,8 @@ using System.Diagnostics; using System.Linq; using System.Threading.Tasks; -using Microsoft.Extensions.Options; +using Trakx.Common.Testing.Configuration; using Trakx.CryptoCompare.ApiClient.Rest; -using Trakx.Utils.Testing; using Xunit; namespace Trakx.CryptoCompare.ApiClient.Tests.Integration.Rest.Core @@ -16,7 +15,7 @@ public async Task WaitsBetweenQueries() var throttleDelayMs = 200; var queriesCount = 5; - var configuration = ConfigurationHelper.GetConfigurationFromEnv() + var configuration = EnvConfigurationHelper.GetConfigurationFromEnv() with { ThrottleDelayMs = throttleDelayMs }; diff --git a/src/Trakx.CryptoCompare.ApiClient.Tests/Trakx.CryptoCompare.ApiClient.Tests.csproj b/src/Trakx.CryptoCompare.ApiClient.Tests/Trakx.CryptoCompare.ApiClient.Tests.csproj index 562606c..df69253 100644 --- a/src/Trakx.CryptoCompare.ApiClient.Tests/Trakx.CryptoCompare.ApiClient.Tests.csproj +++ b/src/Trakx.CryptoCompare.ApiClient.Tests/Trakx.CryptoCompare.ApiClient.Tests.csproj @@ -1,43 +1,40 @@  - - net6.0 + + net7.0 + false + - false - + - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + - - - - - + \ No newline at end of file diff --git a/src/Trakx.CryptoCompare.ApiClient.Websocket.Tests/Integration/CryptoCompareWebsocketHandlerTests.cs b/src/Trakx.CryptoCompare.ApiClient.Websocket.Tests/Integration/CryptoCompareWebsocketHandlerTests.cs index d7e98c9..b08a544 100644 --- a/src/Trakx.CryptoCompare.ApiClient.Websocket.Tests/Integration/CryptoCompareWebsocketHandlerTests.cs +++ b/src/Trakx.CryptoCompare.ApiClient.Websocket.Tests/Integration/CryptoCompareWebsocketHandlerTests.cs @@ -1,15 +1,14 @@ using FluentAssertions; using Microsoft.Extensions.DependencyInjection; using System; +using System.Globalization; using System.Linq; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Threading.Tasks; +using Trakx.Common.Testing.Configuration; using Trakx.CryptoCompare.ApiClient.Websocket.Extensions; using Trakx.CryptoCompare.ApiClient.Websocket.Model; -using Trakx.Utils.Testing; -using Trakx.Websocket; -using Trakx.Websocket.Interfaces; using Trakx.Websocket.Model; using Xunit; @@ -34,7 +33,7 @@ public IServiceProvider CreateServiceProvider() BufferSize = 4096, MaxSubscriptionsPerScope = 100 }; - var configuration = ConfigurationHelper.GetConfigurationFromEnv() + var configuration = EnvConfigurationHelper.GetConfigurationFromEnv() with { WebSocketBaseUrl = "wss://streamer.cryptocompare.com/v2?api_key=", }; serviceCollection.AddCryptoCompareWebsockets(configuration, websocketConfiguration); @@ -68,7 +67,8 @@ public async Task Should_be_able_to_get_full_top_tier_volume_subscriptions() var result = await GetResult(CryptoCompareSubscriptionFactory.GetFullTopTierVolumeSubscriptionStr("btc")) .ConfigureAwait(false); result!.Symbol.Should().Be("BTC"); - decimal.Parse(result.Volume).Should().BeGreaterThan(0); + decimal.TryParse(result.Volume, CultureInfo.InvariantCulture, out decimal volume); + volume.Should().BeGreaterThan(0); } [Fact] diff --git a/src/Trakx.CryptoCompare.ApiClient.Websocket.Tests/Trakx.CryptoCompare.ApiClient.Websocket.Tests.csproj b/src/Trakx.CryptoCompare.ApiClient.Websocket.Tests/Trakx.CryptoCompare.ApiClient.Websocket.Tests.csproj index ebf1016..affbc88 100644 --- a/src/Trakx.CryptoCompare.ApiClient.Websocket.Tests/Trakx.CryptoCompare.ApiClient.Websocket.Tests.csproj +++ b/src/Trakx.CryptoCompare.ApiClient.Websocket.Tests/Trakx.CryptoCompare.ApiClient.Websocket.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 false @@ -9,24 +9,27 @@ - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Ohlc.cs b/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Ohlc.cs index 1745c57..8d94a17 100644 --- a/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Ohlc.cs +++ b/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Ohlc.cs @@ -1,5 +1,5 @@ using System.Text.Json.Serialization; -using Trakx.Utils.Serialization.Converters; +using Trakx.Common.Serialization.Converters; namespace Trakx.CryptoCompare.ApiClient.Websocket.Model; @@ -7,8 +7,8 @@ public class Ohlc : InboundMessageBase { #nullable disable [JsonPropertyName("MARKET")] public string Market { get; set; } - [JsonPropertyName("FROMSYMBOL")] public string FromSymbol { get; set; } - [JsonPropertyName("TOSYMBOL")] public string ToSymbol { get; set; } + [JsonPropertyName("FROMSYMBOL")] public string BaseSymbol { get; set; } + [JsonPropertyName("TOSYMBOL")] public string QuoteSymbol { get; set; } [JsonPropertyName("TS"), JsonConverter(typeof(ULongOrStringConverter))] public ulong TimeStamp { get; set; } [JsonPropertyName("UNIT")] public string Unit { get; set; } [JsonPropertyName("ACTION")] public string Action { get; set; } diff --git a/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Ticker.cs b/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Ticker.cs index d6d43c8..dec6b3f 100644 --- a/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Ticker.cs +++ b/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Ticker.cs @@ -1,5 +1,5 @@ using System.Text.Json.Serialization; -using Trakx.Utils.Serialization.Converters; +using Trakx.Common.Serialization.Converters; namespace Trakx.CryptoCompare.ApiClient.Websocket.Model; @@ -7,8 +7,8 @@ public class Ticker : InboundMessageBase { #nullable disable [JsonPropertyName("MARKET")] public string Market { get; set; } - [JsonPropertyName("FROMSYMBOL")] public string FromSymbol { get; set; } - [JsonPropertyName("TOSYMBOL")] public string ToSymbol { get; set; } + [JsonPropertyName("FROMSYMBOL")] public string BaseSymbol { get; set; } + [JsonPropertyName("TOSYMBOL")] public string QuoteSymbol { get; set; } [JsonPropertyName("FLAGS"), JsonConverter(typeof(ULongOrStringConverter))] public ulong Flags { get; set; } diff --git a/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Trade.cs b/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Trade.cs index 111483d..28963a2 100644 --- a/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Trade.cs +++ b/src/Trakx.CryptoCompare.ApiClient.Websocket/Model/Trade.cs @@ -1,5 +1,5 @@ using System.Text.Json.Serialization; -using Trakx.Utils.Serialization.Converters; +using Trakx.Common.Serialization.Converters; namespace Trakx.CryptoCompare.ApiClient.Websocket.Model; @@ -7,8 +7,8 @@ public class Trade : InboundMessageBase { #nullable disable [JsonPropertyName("M")] public string Market { get; set; } - [JsonPropertyName("FSYM")] public string FromSymbol { get; set; } - [JsonPropertyName("TSYM")] public string ToSymbol { get; set; } + [JsonPropertyName("FSYM")] public string BaseSymbol { get; set; } + [JsonPropertyName("TSYM")] public string QuoteSymbol { get; set; } [JsonPropertyName("F"), JsonConverter(typeof(ULongOrStringConverter))] public ulong Flags { get; set; } [JsonPropertyName("ID")] public string Id { get; set; } [JsonPropertyName("TS"), JsonConverter(typeof(ULongOrStringConverter))] public ulong TimeStamp { get; set; } diff --git a/src/Trakx.CryptoCompare.ApiClient.Websocket/Trakx.CryptoCompare.ApiClient.Websocket.csproj b/src/Trakx.CryptoCompare.ApiClient.Websocket/Trakx.CryptoCompare.ApiClient.Websocket.csproj index cb536fd..181f1ba 100644 --- a/src/Trakx.CryptoCompare.ApiClient.Websocket/Trakx.CryptoCompare.ApiClient.Websocket.csproj +++ b/src/Trakx.CryptoCompare.ApiClient.Websocket/Trakx.CryptoCompare.ApiClient.Websocket.csproj @@ -1,15 +1,15 @@  - net6.0 + net7.0 - - + + diff --git a/src/Trakx.CryptoCompare.ApiClient/CryptoCompareApiConfiguration.cs b/src/Trakx.CryptoCompare.ApiClient/CryptoCompareApiConfiguration.cs index 0bb23eb..daf9ce4 100644 --- a/src/Trakx.CryptoCompare.ApiClient/CryptoCompareApiConfiguration.cs +++ b/src/Trakx.CryptoCompare.ApiClient/CryptoCompareApiConfiguration.cs @@ -1,6 +1,6 @@ using System; using System.Text.Json.Serialization; -using Trakx.Utils.Attributes; +using Trakx.Common.Attributes; namespace Trakx.CryptoCompare.ApiClient { diff --git a/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/AggregatedData.cs b/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/AggregatedData.cs index 58fbde7..8f30f6e 100644 --- a/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/AggregatedData.cs +++ b/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/AggregatedData.cs @@ -10,7 +10,7 @@ public class AggregatedData public string Flags { get; set; } [JsonProperty("FROMSYMBOL")] - public string FromSymbol { get; set; } + public string BaseSymbol { get; set; } [JsonProperty("HIGH24HOUR")] public double? High24Hour { get; set; } @@ -41,7 +41,7 @@ public class AggregatedData public double? Price { get; set; } [JsonProperty("TOSYMBOL")] - public string ToSymbol { get; set; } + public string QuoteSymbol { get; set; } [JsonProperty("TYPE")] public string Type { get; set; } diff --git a/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/CoinFullAggregatedDataDisplay.cs b/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/CoinFullAggregatedDataDisplay.cs index 96a6deb..cd046e4 100644 --- a/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/CoinFullAggregatedDataDisplay.cs +++ b/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/CoinFullAggregatedDataDisplay.cs @@ -18,7 +18,7 @@ public class CoinFullAggregatedDataDisplay public string ChangePCTDay { get; set; } [JsonProperty("FROMSYMBOL")] - public string FromSymbol { get; set; } + public string BaseSymbol { get; set; } [JsonProperty("HIGH24HOUR")] public string High24Hour { get; set; } @@ -66,7 +66,7 @@ public class CoinFullAggregatedDataDisplay public string Supply { get; set; } [JsonProperty("TOSYMBOL")] - public string ToSymbol { get; set; } + public string QuoteSymbol { get; set; } [JsonProperty("TOTALVOLUME24H")] public string TotalVolume24H { get; set; } diff --git a/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/Sub.cs b/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/Sub.cs index b5957c1..88c95de 100644 --- a/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/Sub.cs +++ b/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/Sub.cs @@ -4,12 +4,12 @@ namespace Trakx.CryptoCompare.ApiClient.Rest.Models.Responses { - public struct Sub : IEquatable + public readonly struct Sub : IEquatable { public bool Equals(Sub other) => string.Equals(this.Exchange, other.Exchange) - && string.Equals(this.FromSymbol, other.FromSymbol) - && this.SubId == other.SubId - && string.Equals(this.ToSymbol, other.ToSymbol); + && string.Equals(this.BaseSymbol, other.BaseSymbol) + && this.SubId == other.SubId + && string.Equals(this.QuoteSymbol, other.QuoteSymbol); public override bool Equals(object obj) { @@ -25,9 +25,9 @@ public override int GetHashCode() unchecked { var hashCode = this.Exchange.GetHashCode(); - hashCode = (hashCode * 397) ^ this.FromSymbol.GetHashCode(); + hashCode = (hashCode * 397) ^ this.BaseSymbol.GetHashCode(); hashCode = (hashCode * 397) ^ (int)this.SubId; - hashCode = (hashCode * 397) ^ this.ToSymbol.GetHashCode(); + hashCode = (hashCode * 397) ^ this.QuoteSymbol.GetHashCode(); return hashCode; } } @@ -38,22 +38,22 @@ public Sub([NotNull] string exchange, [NotNull] string fromSymbol, SubId subId, Check.NotNullOrWhiteSpace(fromSymbol, nameof(fromSymbol)); Check.NotNullOrWhiteSpace(toSymbol, nameof(toSymbol)); this.Exchange = exchange; - this.FromSymbol = fromSymbol; + this.BaseSymbol = fromSymbol; this.SubId = subId; - this.ToSymbol = toSymbol; + this.QuoteSymbol = toSymbol; } public string Exchange { get; } - public string FromSymbol { get; } + public string BaseSymbol { get; } public SubId SubId { get; } - public string ToSymbol { get; } + public string QuoteSymbol { get; } public override string ToString() { - return $"{this.SubId:D}~{this.Exchange}~{this.FromSymbol}~{this.ToSymbol}"; + return $"{this.SubId:D}~{this.Exchange}~{this.BaseSymbol}~{this.QuoteSymbol}"; } } } diff --git a/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/TopInfo.cs b/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/TopInfo.cs index 9927332..a8034cd 100644 --- a/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/TopInfo.cs +++ b/src/Trakx.CryptoCompare.ApiClient/Rest/Models/Responses/TopInfo.cs @@ -5,9 +5,9 @@ public class TopInfo #nullable disable public string Exchange { get; set; } - public string FromSymbol { get; set; } + public string BaseSymbol { get; set; } - public string ToSymbol { get; set; } + public string QuoteSymbol { get; set; } public decimal Volume24H { get; set; } diff --git a/src/Trakx.CryptoCompare.ApiClient/ServiceConfiguration.cs b/src/Trakx.CryptoCompare.ApiClient/ServiceConfiguration.cs index faf90a7..c08033e 100644 --- a/src/Trakx.CryptoCompare.ApiClient/ServiceConfiguration.cs +++ b/src/Trakx.CryptoCompare.ApiClient/ServiceConfiguration.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; using Trakx.CryptoCompare.ApiClient.Rest; namespace Trakx.CryptoCompare.ApiClient diff --git a/src/Trakx.CryptoCompare.ApiClient/Trakx.CryptoCompare.ApiClient.csproj b/src/Trakx.CryptoCompare.ApiClient/Trakx.CryptoCompare.ApiClient.csproj index 7f7776c..867983d 100644 --- a/src/Trakx.CryptoCompare.ApiClient/Trakx.CryptoCompare.ApiClient.csproj +++ b/src/Trakx.CryptoCompare.ApiClient/Trakx.CryptoCompare.ApiClient.csproj @@ -1,19 +1,17 @@  - net6.0 + net7.0 - + - - - +