-
-
Notifications
You must be signed in to change notification settings - Fork 49
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 BitfinexExchange class Added support Side setting on SharedTrade model Added BitfinexTrackerFactory Added overload to Create method on BitfinexOrderBookFactory support SharedSymbol parameter Added filtering of TradeUpdate messages in Shared rest trade socket subscription (Trade execution messages are still processed)
- Loading branch information
Showing
21 changed files
with
456 additions
and
38 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
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,68 @@ | ||
using Bitfinex.Net.Clients; | ||
using Bitfinex.Net.Interfaces; | ||
using Bitfinex.Net.Interfaces.Clients; | ||
using CryptoExchange.Net.SharedApis; | ||
using CryptoExchange.Net.Trackers.Klines; | ||
using CryptoExchange.Net.Trackers.Trades; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using System; | ||
|
||
namespace Bitfinex.Net | ||
{ | ||
/// <inheritdoc /> | ||
public class BitfinexTrackerFactory : IBitfinexTrackerFactory | ||
{ | ||
private readonly IServiceProvider? _serviceProvider; | ||
|
||
/// <summary> | ||
/// ctor | ||
/// </summary> | ||
public BitfinexTrackerFactory() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// ctor | ||
/// </summary> | ||
/// <param name="serviceProvider">Service provider for resolving logging and clients</param> | ||
public BitfinexTrackerFactory(IServiceProvider serviceProvider) | ||
{ | ||
_serviceProvider = serviceProvider; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public IKlineTracker CreateKlineTracker(SharedSymbol symbol, SharedKlineInterval interval, int? limit = null, TimeSpan? period = null) | ||
{ | ||
var restClient = (_serviceProvider?.GetRequiredService<IBitfinexRestClient>() ?? new BitfinexRestClient()).SpotApi.SharedClient; | ||
var socketClient = (_serviceProvider?.GetRequiredService<IBitfinexSocketClient>() ?? new BitfinexSocketClient()).SpotApi.SharedClient; | ||
|
||
return new KlineTracker( | ||
_serviceProvider?.GetRequiredService<ILoggerFactory>().CreateLogger(restClient.Exchange), | ||
restClient, | ||
socketClient, | ||
symbol, | ||
interval, | ||
limit, | ||
period | ||
); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public ITradeTracker CreateTradeTracker(SharedSymbol symbol, int? limit = null, TimeSpan? period = null) | ||
{ | ||
var restClient = (_serviceProvider?.GetRequiredService<IBitfinexRestClient>() ?? new BitfinexRestClient()).SpotApi.SharedClient; | ||
var socketClient = (_serviceProvider?.GetRequiredService<IBitfinexSocketClient>() ?? new BitfinexSocketClient()).SpotApi.SharedClient; | ||
|
||
return new TradeTracker( | ||
_serviceProvider?.GetRequiredService<ILoggerFactory>().CreateLogger(restClient.Exchange), | ||
null, | ||
restClient, | ||
socketClient, | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using CryptoExchange.Net.SharedApis; | ||
using CryptoExchange.Net.Trackers.Klines; | ||
using CryptoExchange.Net.Trackers.Trades; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Bitfinex.Net.Interfaces | ||
{ | ||
/// <summary> | ||
/// Tracker factory | ||
/// </summary> | ||
public interface IBitfinexTrackerFactory | ||
{ | ||
/// <summary> | ||
/// Create a new kline tracker | ||
/// </summary> | ||
/// <param name="symbol">The symbol</param> | ||
/// <param name="interval">Kline interval</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> | ||
IKlineTracker CreateKlineTracker(SharedSymbol symbol, SharedKlineInterval interval, int? limit = null, TimeSpan? period = null); | ||
|
||
/// <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.