-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated examples Updated CryptoExchange.Net to v8.1.0 Moved FormatSymbol to CoinExExchange class Added support Side setting on SharedTrade model Added CoinExTrackerFactory Added overload to Create method on CoinExOrderBookFactory support SharedSymbol parameter
- Loading branch information
Showing
24 changed files
with
444 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using CoinEx.Net.Clients; | ||
using CoinEx.Net.Interfaces; | ||
using CoinEx.Net.Interfaces.Clients; | ||
using CryptoExchange.Net.SharedApis; | ||
using CryptoExchange.Net.Trackers.Trades; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using System; | ||
|
||
namespace CoinEx.Net | ||
{ | ||
/// <inheritdoc /> | ||
public class CoinExTrackerFactory : ICoinExTrackerFactory | ||
{ | ||
private readonly IServiceProvider? _serviceProvider; | ||
|
||
/// <summary> | ||
/// ctor | ||
/// </summary> | ||
public CoinExTrackerFactory() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// ctor | ||
/// </summary> | ||
/// <param name="serviceProvider">Service provider for resolving logging and clients</param> | ||
public CoinExTrackerFactory(IServiceProvider serviceProvider) | ||
{ | ||
_serviceProvider = serviceProvider; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public ITradeTracker CreateTradeTracker(SharedSymbol symbol, int? limit = null, TimeSpan? period = null) | ||
{ | ||
var restClient = _serviceProvider?.GetRequiredService<ICoinExRestClient>() ?? new CoinExRestClient(); | ||
var socketClient = _serviceProvider?.GetRequiredService<ICoinExSocketClient>() ?? new CoinExSocketClient(); | ||
|
||
IRecentTradeRestClient sharedRestClient; | ||
ITradeSocketClient sharedSocketClient; | ||
if (symbol.TradingMode == TradingMode.Spot) | ||
{ | ||
sharedRestClient = restClient.SpotApiV2.SharedClient; | ||
sharedSocketClient = socketClient.SpotApiV2.SharedClient; | ||
} | ||
else | ||
{ | ||
sharedRestClient = restClient.FuturesApi.SharedClient; | ||
sharedSocketClient = socketClient.FuturesApi.SharedClient; | ||
} | ||
|
||
return new TradeTracker( | ||
_serviceProvider?.GetRequiredService<ILoggerFactory>().CreateLogger(restClient.Exchange), | ||
sharedRestClient, | ||
null, | ||
sharedSocketClient, | ||
symbol, | ||
limit, | ||
period | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using CryptoExchange.Net.SharedApis; | ||
using CryptoExchange.Net.Trackers.Klines; | ||
using CryptoExchange.Net.Trackers.Trades; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace CoinEx.Net.Interfaces | ||
{ | ||
/// <summary> | ||
/// Tracker factory | ||
/// </summary> | ||
public interface ICoinExTrackerFactory | ||
{ | ||
/// <summary> | ||
/// Create a new trade tracker for a symbol | ||
/// </summary> | ||
/// <param name="symbol">The symbol</param> | ||
/// <param name="limit">The max amount of klines to retain</param> | ||
/// <param name="period">The max period the data should be retained</param> | ||
/// <returns></returns> | ||
ITradeTracker CreateTradeTracker(SharedSymbol symbol, int? limit = null, TimeSpan? period = null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.