从山证v2.3.0拷贝
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user