53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
using Newtonsoft.Json;
|
|
using YLErp.BLL.EodSettlement;
|
|
|
|
namespace YLErp.Modules.EodModule.QueryModule
|
|
{
|
|
[TestClass]
|
|
public class TestEodTradePositionApiService
|
|
{
|
|
[TestMethod]
|
|
public void TestInfoAll()
|
|
{
|
|
var req = new EodSettleInfoRequest
|
|
{
|
|
ValueDate = new DateTime(2022, 1, 4)
|
|
};
|
|
var context = new EodSettleInfoQueryContext(OptUserInfo.SystemUser);
|
|
|
|
var positionResult = new EodTradePositionApiService(context).GetEodPositions(req);
|
|
var closeResult = new EodCloseInfoQueryService(context).GetEodCloseInfoList(req.ValueDate);
|
|
|
|
var clientIds = context.GetClientIds();
|
|
|
|
var balanceResult = ClientBalanceUtility.GetClientBanlances(
|
|
clientIdList: clientIds,
|
|
startDate: DateTime.MinValue,
|
|
endDate: req.ValueDate,
|
|
IsGetOuterMarginGap: false,
|
|
IsClientBalanceGap: false,
|
|
ParentFlag: false,
|
|
clientDataSource: context);
|
|
|
|
var result = new
|
|
{
|
|
positionResult.OptionPositions,
|
|
positionResult.SwapPositions,
|
|
positionResult.ForwardPositions,
|
|
CloseInfos = closeResult,
|
|
AccountInfos = balanceResult
|
|
};
|
|
|
|
//var result = new { d = 1.2222222255555555555 };
|
|
|
|
var serializeSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
|
serializeSettings.Converters ??= new List<JsonConverter>();
|
|
serializeSettings.Converters.Add(new DoubleJsonWriteConverter(2, 8));
|
|
|
|
var json = JsonConvert.SerializeObject(result, serializeSettings);
|
|
|
|
Assert.IsNotNull(json);
|
|
}
|
|
}
|
|
}
|