Skip to content

Commit

Permalink
Updated deps, create json options once per exchange instance, editorc…
Browse files Browse the repository at this point in the history
…onfig fix.
  • Loading branch information
bvandevliet committed Jan 14, 2025
1 parent e538462 commit a65d489
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ csharp_prefer_static_local_function = true
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async

# Code-block preferences
csharp_prefer_braces = true:warning
csharp_prefer_simple_using_statement = false:warning
csharp_prefer_braces = when_multiline:warning
csharp_prefer_simple_using_statement = true:warning
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_top_level_statements = false:warning
Expand Down
19 changes: 7 additions & 12 deletions TraderEngine.API/Exchanges/BitvavoExchange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@ public class BitvavoExchange : IExchange
public ILogger<IExchange> Logger => _logger;

public string QuoteSymbol { get; } = "EUR";

public decimal MinOrderSizeInQuote { get; } = 5;

public decimal MakerFee { get; } = .0015m;

public decimal TakerFee { get; } = .0025m;

public string ApiKey { get; set; } = string.Empty;

public string ApiSecret { get; set; } = string.Empty;

private readonly JsonSerializerOptions _jsonOptions = new()
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};

public BitvavoExchange(
ILogger<BitvavoExchange> logger,
IMapper mapper,
Expand Down Expand Up @@ -75,13 +76,7 @@ private HttpRequestMessage CreateRequestMsg(HttpMethod method, string requestPat

if (null != body)
{
var jsonOptions = new JsonSerializerOptions
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};

payload = JsonSerializer.Serialize(body, body.GetType(), jsonOptions);
payload = JsonSerializer.Serialize(body, body.GetType(), _jsonOptions);

request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
}
Expand Down
2 changes: 1 addition & 1 deletion TraderEngine.API/TraderEngine.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="AnyClone" Version="1.1.6" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
32 changes: 16 additions & 16 deletions TraderEngine.API/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"Swashbuckle.AspNetCore": {
"type": "Direct",
"requested": "[7.0.0, )",
"resolved": "7.0.0",
"contentHash": "aF6oCgMy8CC17cSbILAw9J4UVhqOE+0Z11V8JstA+pIrXcY8ZbNL3ayHOWKZm0NdHMS6RI1k5sFVfMkpZOobvw==",
"requested": "[7.2.0, )",
"resolved": "7.2.0",
"contentHash": "vJv19UpWm6OOgnS9QLDnWARNVasXUfj8SFvlG7UVALm4nBnfwRnEky7C0veSDqMUmBeMPC6Ec3d6G1ts/J04Uw==",
"dependencies": {
"Microsoft.Extensions.ApiDescription.Server": "6.0.5",
"Swashbuckle.AspNetCore.Swagger": "7.0.0",
"Swashbuckle.AspNetCore.SwaggerGen": "7.0.0",
"Swashbuckle.AspNetCore.SwaggerUI": "7.0.0"
"Swashbuckle.AspNetCore.Swagger": "7.2.0",
"Swashbuckle.AspNetCore.SwaggerGen": "7.2.0",
"Swashbuckle.AspNetCore.SwaggerUI": "7.2.0"
}
},
"AutoMapper": {
Expand Down Expand Up @@ -198,29 +198,29 @@
},
"Skender.Stock.Indicators": {
"type": "Transitive",
"resolved": "2.5.1",
"contentHash": "ubdZuL0A9TIapgf8WeLP4S5ds4AOXccDjCZWUaKVqSCTyZ3VCc22KpZnv2udpNkCGcp22B+CdV+w2Id/6jkcbA=="
"resolved": "2.6.1",
"contentHash": "aa8OK7e21F2n90Pvimuc4wY2vsjSF3kMZI6P+oq8ulgaRmSGMKOx15Qf5LmAoQQWhioTtkU58IXlfM2hlsiXGg=="
},
"Swashbuckle.AspNetCore.Swagger": {
"type": "Transitive",
"resolved": "7.0.0",
"contentHash": "Y2QnwZkuszoIYpz069xqDU0h/rklVedE4a0NOdb8HSDTcXCmsi7Zm2RGdJccde5MojHmEhDmZggCO1wgpfZ2IA==",
"resolved": "7.2.0",
"contentHash": "y27fNDfIh1vGhJjXYynLcZjl7DLOW1bSO2MDsY9wB4Zm1fdxpPsuBSiR4U+0acWlAqLmnuOPKr/OeOgwRUkBlw==",
"dependencies": {
"Microsoft.OpenApi": "1.6.22"
}
},
"Swashbuckle.AspNetCore.SwaggerGen": {
"type": "Transitive",
"resolved": "7.0.0",
"contentHash": "f/urqk9zkb5ZXc3ljLNP++JgYe2HTlA4WaIaO1DLRQLRFh3HXIZakFfMfTWX1T8NVqeMyJF7MzETN4HsokxNuQ==",
"resolved": "7.2.0",
"contentHash": "pMrTxGVuXM7t4wqft5CNNU8A0++Yw5kTLmYhB6tbEcyBfO8xEF/Y8pkJhO6BZ/2MYONrRYoQTfPFJqu8fOf5WQ==",
"dependencies": {
"Swashbuckle.AspNetCore.Swagger": "7.0.0"
"Swashbuckle.AspNetCore.Swagger": "7.2.0"
}
},
"Swashbuckle.AspNetCore.SwaggerUI": {
"type": "Transitive",
"resolved": "7.0.0",
"contentHash": "rJJony+jsxvpfJM9ZGVxjp0DVpalZv8cAhiMSLW6L2hgUWb7k5qPVuzQHWXtkT8lrG1hQ8vWeR+HUwgCQm9J3A=="
"resolved": "7.2.0",
"contentHash": "hgrXeKzyp5OGN8qVvL7A+vhmU7mDJTfGpiMBRL66IcfLOyna8UTLtn3cC3CghamXpRDufcc9ciklTszUGEQK0w=="
},
"System.Diagnostics.DiagnosticSource": {
"type": "Transitive",
Expand All @@ -238,7 +238,7 @@
"Microsoft.Extensions.Options": "[9.0.0, )",
"MySqlConnector": "[2.4.0, )",
"Polly.Contrib.WaitAndRetry": "[1.1.1, )",
"Skender.Stock.Indicators": "[2.5.1, )"
"Skender.Stock.Indicators": "[2.6.1, )"
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions TraderEngine.APITests/TraderEngine.APITests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PackageReference Include="MSTest.TestAdapter" Version="3.7.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.7.1" />
<PackageReference Include="coverlet.collector" Version="6.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion TraderEngine.CLI/TraderEngine.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MailKit" Version="4.8.0" />
<PackageReference Include="MailKit" Version="4.9.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
</ItemGroup>

Expand Down
33 changes: 15 additions & 18 deletions TraderEngine.CLI/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"net8.0": {
"MailKit": {
"type": "Direct",
"requested": "[4.8.0, )",
"resolved": "4.8.0",
"contentHash": "zZ1UoM4FUnSFUJ9fTl5CEEaejR0DNP6+FDt1OfXnjg4igZntcir1tg/8Ufd6WY5vrpmvToAjluYqjVM24A+5lA==",
"requested": "[4.9.0, )",
"resolved": "4.9.0",
"contentHash": "wRUVzYXRWbjdUixwtSp7ivVHPhWw17h+BvwIVaouBike68B56Xk9b5+QRT39EK/QN8XF7MtOgt9caHvUaCvhIQ==",
"dependencies": {
"MimeKit": "4.8.0",
"MimeKit": "4.9.0",
"System.Formats.Asn1": "8.0.1"
}
},
Expand Down Expand Up @@ -52,8 +52,8 @@
},
"BouncyCastle.Cryptography": {
"type": "Transitive",
"resolved": "2.4.0",
"contentHash": "SwXsAV3sMvAU/Nn31pbjhWurYSjJ+/giI/0n6tCrYoupEK34iIHCuk3STAd9fx8yudM85KkLSVdn951vTng/vQ=="
"resolved": "2.5.0",
"contentHash": "rc7vRCq/KD3GtIwSgRtjanGaBwTb9nLenFDZnEcauWlssuuEoxcbMfWA3QWWho6QDMSOSkWjs657McdHzEtEcw=="
},
"Dapper": {
"type": "Transitive",
Expand Down Expand Up @@ -339,12 +339,12 @@
},
"MimeKit": {
"type": "Transitive",
"resolved": "4.8.0",
"contentHash": "U24wp4LKED+sBRzyrWICE+3bSwptsTrPOcCIXbW5zfeThCNzQx5NCo8Wus+Rmi+EUkQrCwlI/3sVfejeq9tuxQ==",
"resolved": "4.9.0",
"contentHash": "DZXXMZzmAABDxFhOSMb6SE8KKxcRd/sk1E6aJTUE5ys2FWOQhznYV2Gl3klaaSfqKn27hQ32haqquH1J8Z6kJw==",
"dependencies": {
"BouncyCastle.Cryptography": "2.4.0",
"BouncyCastle.Cryptography": "2.5.0",
"System.Formats.Asn1": "8.0.1",
"System.Security.Cryptography.Pkcs": "8.0.0"
"System.Security.Cryptography.Pkcs": "8.0.1"
}
},
"MySqlConnector": {
Expand Down Expand Up @@ -376,8 +376,8 @@
},
"Skender.Stock.Indicators": {
"type": "Transitive",
"resolved": "2.5.1",
"contentHash": "ubdZuL0A9TIapgf8WeLP4S5ds4AOXccDjCZWUaKVqSCTyZ3VCc22KpZnv2udpNkCGcp22B+CdV+w2Id/6jkcbA=="
"resolved": "2.6.1",
"contentHash": "aa8OK7e21F2n90Pvimuc4wY2vsjSF3kMZI6P+oq8ulgaRmSGMKOx15Qf5LmAoQQWhioTtkU58IXlfM2hlsiXGg=="
},
"System.Diagnostics.DiagnosticSource": {
"type": "Transitive",
Expand All @@ -401,11 +401,8 @@
},
"System.Security.Cryptography.Pkcs": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "ULmp3xoOwNYjOYp4JZ2NK/6NdTgiN1GQXzVVN1njQ7LOZ0d0B9vyMnhyqbIi9Qw4JXj1JgCsitkTShboHRx7Eg==",
"dependencies": {
"System.Formats.Asn1": "8.0.0"
}
"resolved": "8.0.1",
"contentHash": "CoCRHFym33aUSf/NtWSVSZa99dkd0Hm7OCZUxORBjRB16LNhIEOf8THPqzIYlvKM0nNDAPTRBa1FxEECrgaxxA=="
},
"System.Text.Encodings.Web": {
"type": "Transitive",
Expand All @@ -432,7 +429,7 @@
"Microsoft.Extensions.Options": "[9.0.0, )",
"MySqlConnector": "[2.4.0, )",
"Polly.Contrib.WaitAndRetry": "[1.1.1, )",
"Skender.Stock.Indicators": "[2.5.1, )"
"Skender.Stock.Indicators": "[2.6.1, )"
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions TraderEngine.CLITests/TraderEngine.CLITests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PackageReference Include="MSTest.TestAdapter" Version="3.7.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.7.1" />
<PackageReference Include="coverlet.collector" Version="6.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion TraderEngine.Common/TraderEngine.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
<PackageReference Include="MySqlConnector" Version="2.4.0" />
<PackageReference Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
<PackageReference Include="Skender.Stock.Indicators" Version="2.5.1" />
<PackageReference Include="Skender.Stock.Indicators" Version="2.6.1" />
</ItemGroup>

</Project>

0 comments on commit a65d489

Please sign in to comment.