d1278b26ee
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
76 lines
2.5 KiB
C#
76 lines
2.5 KiB
C#
using Xunit;
|
|
using QuantEngine.Core.Domain;
|
|
|
|
namespace QuantEngine.Core.Tests
|
|
{
|
|
public class SellPriceSanityCheckerTests
|
|
{
|
|
[Fact]
|
|
public void CheckSellPriceSanity_ValidPrice_Passes()
|
|
{
|
|
var res = SellPriceSanityChecker.CheckSellPriceSanity(
|
|
sellLimitPrice: 100000,
|
|
stopLossPrice: 95000,
|
|
prevClose: 100000,
|
|
ticker: "005930"
|
|
);
|
|
|
|
Assert.Equal("PASS", res.SellPriceSanityStatus);
|
|
Assert.True(res.HtsAllowed);
|
|
Assert.False(res.ShadowLedger);
|
|
Assert.Empty(res.SellPriceSanityIssues);
|
|
}
|
|
|
|
[Fact]
|
|
public void CheckSellPriceSanity_PriceInversion_Fails()
|
|
{
|
|
// sell < stop -> inversion
|
|
var res = SellPriceSanityChecker.CheckSellPriceSanity(
|
|
sellLimitPrice: 90000,
|
|
stopLossPrice: 95000,
|
|
prevClose: 100000,
|
|
ticker: "005930"
|
|
);
|
|
|
|
Assert.Equal("INVALID_PRICE_INVERSION", res.SellPriceSanityStatus);
|
|
Assert.False(res.HtsAllowed);
|
|
Assert.True(res.ShadowLedger);
|
|
Assert.Contains("INVALID_PRICE_INVERSION", res.SellPriceSanityIssues[0]);
|
|
}
|
|
|
|
[Fact]
|
|
public void CheckSellPriceSanity_UnrealisticPrice_Fails()
|
|
{
|
|
// sell > prevClose * 1.30 -> unrealistic
|
|
var res = SellPriceSanityChecker.CheckSellPriceSanity(
|
|
sellLimitPrice: 140000,
|
|
stopLossPrice: 95000,
|
|
prevClose: 100000,
|
|
ticker: "005930"
|
|
);
|
|
|
|
Assert.Equal("INVALID_UNREALISTIC_PRICE", res.SellPriceSanityStatus);
|
|
Assert.False(res.HtsAllowed);
|
|
Assert.True(res.ShadowLedger);
|
|
Assert.Contains("INVALID_UNREALISTIC_PRICE", res.SellPriceSanityIssues[0]);
|
|
}
|
|
|
|
[Fact]
|
|
public void CheckSellPriceSanity_InvalidTick_Fails()
|
|
{
|
|
// 100005 % 100 != 0 (10만 원대 호가단위 100) -> invalid tick
|
|
var res = SellPriceSanityChecker.CheckSellPriceSanity(
|
|
sellLimitPrice: 100005,
|
|
stopLossPrice: 95000,
|
|
prevClose: 100000,
|
|
ticker: "005930"
|
|
);
|
|
|
|
Assert.Equal("INVALID_TICK", res.SellPriceSanityStatus);
|
|
Assert.False(res.HtsAllowed);
|
|
Assert.True(res.ShadowLedger);
|
|
Assert.Contains("INVALID_TICK", res.SellPriceSanityIssues[0]);
|
|
}
|
|
}
|
|
}
|