test(dotnet): add 32 xUnit tests for domain calculators (WBS-10.2)
Deploy to Production / Build Release Package (push) Failing after 17s
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 5s
Deploy to Production / Deploy to Production Server (push) Has been skipped
Deploy to Production / Post-Deployment Checks (push) Has been skipped
Snapshot Admin Deployment / build-and-deploy (push) Failing after 38s
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 2m19s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
Deploy to Production / Build Release Package (push) Failing after 17s
WBS-9.3 - NULL Policy CI Gate / NULL Policy Validation (push) Failing after 5s
Deploy to Production / Deploy to Production Server (push) Has been skipped
Deploy to Production / Post-Deployment Checks (push) Has been skipped
Snapshot Admin Deployment / build-and-deploy (push) Failing after 38s
Quant Engine CI/CD Pipeline / validate-core (push) Failing after 2m19s
Quant Engine CI/CD Pipeline / validate-ui-and-storage (push) Has been skipped
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using Xunit;
|
||||
using QuantEngine.Core.Domain;
|
||||
|
||||
namespace QuantEngine.Core.Tests
|
||||
{
|
||||
public class ProfitLockCalculatorTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(-5.0, "NORMAL")]
|
||||
[InlineData(5.0, "BREAKEVEN_RATCHET")]
|
||||
[InlineData(15.0, "PROFIT_LOCK_10")]
|
||||
[InlineData(25.0, "PROFIT_LOCK_20")]
|
||||
[InlineData(35.0, "PROFIT_LOCK_30")]
|
||||
[InlineData(45.0, "APEX_TRAILING")]
|
||||
[InlineData(65.0, "APEX_SUPER")]
|
||||
public void ClassifyProfitLockStage_ProfitPcts_ReturnExpectedStage(double profitPct, string expectedStage)
|
||||
{
|
||||
string res = ProfitLockCalculator.ClassifyProfitLockStage(profitPct);
|
||||
Assert.Equal(expectedStage, res);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ComputeTrailingStop_ApexSuper_AppliesCorrectMultiplierAndTpAction()
|
||||
{
|
||||
var res = ProfitLockCalculator.ComputeTrailingStop(
|
||||
profitPct: 65.0,
|
||||
highestClose: 100000,
|
||||
atr20: 3000,
|
||||
ratchetStop: 90000,
|
||||
averageCost: 80000
|
||||
);
|
||||
|
||||
Assert.Equal("APEX_SUPER", res.RatchetStage);
|
||||
Assert.Equal("강제 10% 익절 권고", res.TpLadderAction);
|
||||
Assert.True(res.ApexSuperActive);
|
||||
// 100000 - 1.2 * 3000 = 100000 - 3600 = 96400
|
||||
// NormalizeTick(96400) = 96400 (tick = 100)
|
||||
Assert.Equal(96400, res.AutoTrailingStop);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user