2020-10-13 15:10:26 +02:00
|
|
|
using System;
|
|
|
|
|
using MtApi.Monitors.Triggers;
|
2016-09-09 19:10:10 +03:00
|
|
|
|
|
|
|
|
namespace MtApi.Monitors
|
|
|
|
|
{
|
|
|
|
|
public class TimerTradeMonitor : TradeMonitor
|
|
|
|
|
{
|
2020-10-13 15:10:26 +02:00
|
|
|
private readonly TimeElapsedTrigger _timeElapsedTrigger;
|
2016-09-09 19:10:10 +03:00
|
|
|
public double Interval
|
|
|
|
|
{
|
2020-10-13 15:10:26 +02:00
|
|
|
get => _timeElapsedTrigger.Interval.TotalMilliseconds;
|
|
|
|
|
set => _timeElapsedTrigger.Interval = TimeSpan.FromMilliseconds(value);
|
2016-09-09 19:10:10 +03:00
|
|
|
}
|
|
|
|
|
|
2020-10-13 15:10:26 +02:00
|
|
|
public TimerTradeMonitor(MtApiClient apiClient)
|
|
|
|
|
: this(apiClient, new TimeElapsedTrigger(TimeSpan.FromSeconds(10)))
|
2016-09-09 19:10:10 +03:00
|
|
|
{
|
2020-10-13 15:36:59 +02:00
|
|
|
SyncTrigger = true; //Sync-Trigger set to true, to have the same behavior as before
|
2020-10-13 15:10:26 +02:00
|
|
|
}
|
|
|
|
|
public TimerTradeMonitor(MtApiClient apiClient, TimeElapsedTrigger timeElapsedTrigger)
|
|
|
|
|
: base(apiClient, timeElapsedTrigger)
|
2016-09-09 19:10:10 +03:00
|
|
|
{
|
2020-10-13 15:10:26 +02:00
|
|
|
_timeElapsedTrigger = timeElapsedTrigger;
|
2016-09-09 19:10:10 +03:00
|
|
|
}
|
|
|
|
|
}
|
2020-10-13 15:10:26 +02:00
|
|
|
}
|