-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathBaseMarketBot.cs
More file actions
48 lines (32 loc) · 1.28 KB
/
BaseMarketBot.cs
File metadata and controls
48 lines (32 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Binance.Net.Objects.Models.Spot;
using BinanceBot.Market.Domain;
using NLog;
namespace BinanceBot.Market;
/// <summary>
/// Base Market Bot
/// </summary>
/// <typeparam name="TStrategy"></typeparam>
public abstract class BaseMarketBot<TStrategy> :
IMarketBot, IDisposable
where TStrategy : class, IMarketStrategy
{
protected readonly Logger Logger;
protected readonly TStrategy MarketStrategy;
protected BaseMarketBot(MarketSymbol symbol, TStrategy marketStrategy, Logger logger)
{
Symbol = symbol ?? throw new ArgumentNullException(nameof(symbol));
MarketStrategy = marketStrategy ?? throw new ArgumentNullException(nameof(marketStrategy));
Logger = logger ?? LogManager.GetCurrentClassLogger();
}
public MarketSymbol Symbol { get; }
public abstract Task RunAsync();
public abstract void Stop();
public abstract Task ValidateServerTimeAsync();
public abstract Task<IEnumerable<BinanceOrder>> GetOpenedOrdersAsync(string symbol);
public abstract Task CancelOrdersAsync(IEnumerable<BinanceOrder> orders);
public abstract Task<BinancePlacedOrder> CreateOrderAsync(CreateOrderRequest order);
public abstract void Dispose();
}