klhztrader/KLHZ.Trader.Core/Common/BotModeSwitcher.cs

46 lines
1.0 KiB
C#

namespace KLHZ.Trader.Core.Common
{
public static class BotModeSwitcher
{
private readonly static object _locker = new();
private static bool _canSell = true;
private static bool _canPurchase = true;
public static bool CanSell()
{
lock (_locker)
return _canSell;
}
public static bool CanPurchase()
{
lock (_locker)
return _canPurchase;
}
public static void StopSelling()
{
lock (_locker)
_canSell = false;
}
public static void StopPurchase()
{
lock (_locker)
_canPurchase = false;
}
public static void StartSelling()
{
lock (_locker)
_canSell = true;
}
public static void StartPurchase()
{
lock (_locker)
_canPurchase = true;
}
}
}