-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathExchangeApiFactory.cs
33 lines (30 loc) · 1.04 KB
/
ExchangeApiFactory.cs
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
using DevelopmentInProgress.TradeView.Api.Binance;
using DevelopmentInProgress.TradeView.Api.Kucoin;
using DevelopmentInProgress.TradeView.Core.Enums;
using DevelopmentInProgress.TradeView.Core.Interfaces;
using System;
using System.Collections.Generic;
namespace DevelopmentInProgress.TradeView.Service
{
public class ExchangeApiFactory : IExchangeApiFactory
{
public IExchangeApi GetExchangeApi(Exchange exchange)
{
return exchange switch
{
Exchange.Binance => new BinanceExchangeApi(),
Exchange.Kucoin => new KucoinExchangeApi(),
_ => throw new NotImplementedException(),
};
}
public Dictionary<Exchange, IExchangeApi> GetExchanges()
{
var exchanges = new Dictionary<Exchange, IExchangeApi>
{
{ Exchange.Binance, GetExchangeApi(Exchange.Binance) },
{ Exchange.Kucoin, GetExchangeApi(Exchange.Kucoin) }
};
return exchanges;
}
}
}