33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using KLHZ.Trader.Core.Contracts.Common.Enums;
|
|
|
|
namespace KLHZ.Trader.Core.Exchange.Models.Trading
|
|
{
|
|
public readonly struct Stops
|
|
{
|
|
public readonly decimal LongStopLossShift;
|
|
public readonly decimal LongTakeProfitShift;
|
|
public readonly decimal ShortStopLossShift;
|
|
public readonly decimal ShortTakeProfitShift;
|
|
|
|
public Stops(decimal longStopLossShift, decimal longTakeProfitShift, decimal shortStopLossShift, decimal shortTakeProfitShift)
|
|
{
|
|
LongStopLossShift = longStopLossShift;
|
|
LongTakeProfitShift = longTakeProfitShift;
|
|
ShortStopLossShift = shortStopLossShift;
|
|
ShortTakeProfitShift = shortTakeProfitShift;
|
|
}
|
|
|
|
public (decimal takeProfit, decimal stopLoss) GetStops(PositionType positionType)
|
|
{
|
|
if (positionType == PositionType.Short)
|
|
{
|
|
return (ShortTakeProfitShift, ShortStopLossShift);
|
|
}
|
|
else
|
|
{
|
|
return (LongTakeProfitShift, LongStopLossShift);
|
|
}
|
|
}
|
|
}
|
|
}
|