从山证v2.3.0拷贝

This commit is contained in:
吴方海
2024-05-09 14:06:26 +08:00
parent 566ff33259
commit f9d8a256a6
4471 changed files with 1203456 additions and 9 deletions
@@ -0,0 +1,25 @@
namespace YLErp.Modules.ToolsModule
{
public class EodExchangeOptionPriceService : YLBaseService
{
public EodExchangeOptionPriceService(OptUserInfo userInfo) : base(userInfo)
{
}
/// <summary>
/// 获取完结盈亏
/// </summary>
public double GetEndPnl(DateTime endDate, DateTime? startDate = null)
{
if (startDate == null)
{
startDate = endDate;
}
var query = from db in DbContext.Exchange_Option_Trade
where db.ExerciseDate <= endDate && db.ExerciseDate >= startDate.Value
select (db.ExercisePrice - db.TradePrice) * (db.TradeType == "多头" ? 1 : -1);
return query.Any() ? query.Sum() : 0;
}
}
}