docker files fixes from liaqat
This commit is contained in:
39
src/Managing.Application/Bots/SimpleBot.cs
Normal file
39
src/Managing.Application/Bots/SimpleBot.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Managing.Domain.Bots;
|
||||
using Managing.Domain.Workflows;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Managing.Application.Bots
|
||||
{
|
||||
public class SimpleBot : Bot
|
||||
{
|
||||
public readonly ILogger<TradingBot> Logger;
|
||||
private readonly Workflow _workflow;
|
||||
|
||||
public SimpleBot(string name, ILogger<TradingBot> logger, Workflow workflow) : base(name)
|
||||
{
|
||||
Logger = logger;
|
||||
_workflow = workflow;
|
||||
Interval = 100;
|
||||
Start();
|
||||
}
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
Task.Run(() => InitWorker(Run));
|
||||
|
||||
base.Start();
|
||||
}
|
||||
|
||||
public async Task Run()
|
||||
{
|
||||
await Task.Run(
|
||||
async () =>
|
||||
{
|
||||
Logger.LogInformation(Identifier);
|
||||
Logger.LogInformation(DateTime.Now.ToString());
|
||||
await _workflow.Execute();
|
||||
Logger.LogInformation("__________________________________________________");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user