Add funding rate watcher (#2)

* Add FundingRate interfaces and worker

* Add build on PR

* Remove zip

* Specify the solution path

* Add build for worker too

* Set up StatisticService.cs for funding rate

* Add Fundingrate alerts

* Send alert when big funding rate change + add SlashCommands.cs for fundingrate

* Remove fixtures

* Refact names

* Renames
This commit is contained in:
Oda
2024-07-19 08:31:09 +07:00
committed by GitHub
parent 545c9d8e4a
commit 029ba5f40e
41 changed files with 914 additions and 304 deletions

View File

@@ -6,8 +6,15 @@ namespace Managing.Infrastructure.Tests;
public class TradaoTests
{
private readonly TradaoService _tradaoService;
public TradaoTests()
{
_tradaoService = new TradaoService();
}
[Fact]
public async void Should_return_best_trader()
public async void Should_return_best_trader()
{
var service = new TradaoService();
var details = await service.GetBestTrader();
@@ -21,4 +28,39 @@ public class TradaoTests
var details = (await service.GetBadTrader()).FindBadTrader();
Assert.NotNull(details);
}
}
[Fact]
public async void Should_return_funding_rates()
{
var service = new TradaoService();
var details = await service.GetFundingRates();
Assert.NotNull(details);
}
[Fact]
public void GetApy_WithPositiveRate_ReturnsExpectedPositiveApy()
{
var result = _tradaoService.GetApy("0.0055");
Assert.True(result > 48m);
}
[Fact]
public void GetApy_WithNegativeRate_ReturnsPositiveApy()
{
var result = _tradaoService.GetApy("-0.00834530");
Assert.True(result < -73m);
}
[Fact]
public void GetApy_WithZeroRate_ReturnsZeroApy()
{
var result = _tradaoService.GetApy("0");
Assert.Equal(0m, result);
}
[Fact]
public void GetApy_WithInvalidFormat_ThrowsFormatException()
{
Assert.Throws<FormatException>(() => _tradaoService.GetApy("invalid"));
}
}