Skip to content

Commit b8178b5

Browse files
committed
Revert "wip"
This reverts commit 82ace09.
1 parent 82ace09 commit b8178b5

11 files changed

Lines changed: 262 additions & 489 deletions

‎DeepCoin.Net.UnitTests/DeepCoinRestClientTests.cs‎

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
using CryptoExchange.Net.Authentication;
22
using CryptoExchange.Net.Clients;
3-
using CryptoExchange.Net.Converters.SystemTextJson;
4-
using CryptoExchange.Net.Objects;
5-
using CryptoExchange.Net.Testing;
6-
using DeepCoin.Net.Clients;
73
using NUnit.Framework;
84
using System.Collections.Generic;
95
using System.Net.Http;
6+
using DeepCoin.Net.Clients;
7+
using CryptoExchange.Net.Converters.SystemTextJson;
8+
using CryptoExchange.Net.Objects;
109

1110
namespace DeepCoin.Net.UnitTests
1211
{
@@ -43,23 +42,5 @@ public void CheckInterfaces()
4342
CryptoExchange.Net.Testing.TestHelpers.CheckForMissingRestInterfaces<DeepCoinRestClient>();
4443
CryptoExchange.Net.Testing.TestHelpers.CheckForMissingSocketInterfaces<DeepCoinSocketClient>();
4544
}
46-
47-
[Test]
48-
public void TestRestSharedApiDiscoveryMatchesAggregate()
49-
{
50-
var (missingOptions, missingInterfaces) = TestHelpers.ValidateSharedApi(new DeepCoinRestClient().ExchangeApi.SharedApi);
51-
52-
Assert.That(missingOptions, Is.Empty);
53-
Assert.That(missingInterfaces, Is.Empty);
54-
}
55-
56-
[Test]
57-
public void TestSocketSharedApiDiscoveryMatchesAggregate()
58-
{
59-
var (missingOptions, missingInterfaces) = TestHelpers.ValidateSharedApi(new DeepCoinSocketClient().ExchangeApi.SharedApi);
60-
61-
Assert.That(missingOptions, Is.Empty);
62-
Assert.That(missingInterfaces, Is.Empty);
63-
}
6445
}
6546
}

‎DeepCoin.Net/Clients/ExchangeApi/DeepCoinRestClientExchangeApi.cs‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ namespace DeepCoin.Net.Clients.ExchangeApi
2424
internal partial class DeepCoinRestClientExchangeApi : RestApiClient<DeepCoinEnvironment, DeepCoinAuthenticationProvider, DeepCoinCredentials>, IDeepCoinRestClientExchangeApi
2525
{
2626
#region fields
27-
28-
private readonly DeepCoinRestClientExchangeSharedApi _sharedApi;
29-
27+
3028
protected override ErrorMapping ErrorMapping => DeepCoinErrors.Errors;
3129

3230
protected override IRestMessageHandler MessageHandler => new DeepCoinRestMessageHandler(DeepCoinErrors.Errors);
@@ -50,8 +48,6 @@ internal DeepCoinRestClientExchangeApi(ILoggerFactory? loggerFactory, HttpClient
5048
Account = new DeepCoinRestClientExchangeApiAccount(this);
5149
ExchangeData = new DeepCoinRestClientExchangeApiExchangeData(_logger, this);
5250
Trading = new DeepCoinRestClientExchangeApiTrading(_logger, this);
53-
54-
_sharedApi = new DeepCoinRestClientExchangeSharedApi(this);
5551
}
5652
#endregion
5753

@@ -88,9 +84,7 @@ public override string FormatSymbol(string baseAsset, string quoteAsset, Trading
8884
=> DeepCoinExchange.FormatSymbol(baseAsset, quoteAsset, tradingMode, deliverDate);
8985

9086
/// <inheritdoc />
91-
public IDeepCoinRestClientExchangeApiShared SharedClient => _sharedApi;
92-
/// <inheritdoc />
93-
public IDeepCoinRestClientExchangeSharedApi SharedApi => _sharedApi;
87+
public IDeepCoinRestClientExchangeApiShared SharedClient => this;
9488

9589
}
9690
}

‎DeepCoin.Net/Clients/ExchangeApi/DeepCoinRestClientExchangeApiShared.cs‎

Lines changed: 194 additions & 281 deletions
Large diffs are not rendered by default.

‎DeepCoin.Net/Clients/ExchangeApi/DeepCoinSocketClientExchangeApi.cs‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ namespace DeepCoin.Net.Clients.ExchangeApi
3535
/// </summary>
3636
internal partial class DeepCoinSocketClientExchangeApi : SocketApiClient<DeepCoinEnvironment, DeepCoinAuthenticationProvider, DeepCoinCredentials>, IDeepCoinSocketClientExchangeApi
3737
{
38-
private readonly DeepCoinSocketClientExchangeSharedApi _sharedApi;
3938
private readonly ILoggerFactory? _loggerFactory;
4039
private DeepCoinRestClient? _tokenClient;
4140
internal TokenManager TokenManager { get; }
@@ -68,8 +67,6 @@ internal DeepCoinSocketClientExchangeApi(ILoggerFactory? loggerFactory, DeepCoin
6867
{
6968
_loggerFactory = loggerFactory;
7069

71-
_sharedApi = new DeepCoinSocketClientExchangeSharedApi(this);
72-
7370
KeepAliveInterval = TimeSpan.Zero;
7471

7572
TokenManager = new TokenManager(
@@ -270,9 +267,7 @@ public async Task<WebSocketResult<UpdateSubscription>> SubscribeToUserDataUpdate
270267
}
271268

272269
/// <inheritdoc />
273-
public IDeepCoinSocketClientExchangeApiShared SharedClient => _sharedApi;
274-
/// <inheritdoc />
275-
public IDeepCoinSocketClientExchangeSharedApi SharedApi => _sharedApi;
270+
public IDeepCoinSocketClientExchangeApiShared SharedClient => this;
276271

277272
/// <inheritdoc />
278273
public override string FormatSymbol(string baseAsset, string quoteAsset, TradingMode tradingMode, DateTime? deliverDate = null)

‎DeepCoin.Net/Clients/ExchangeApi/DeepCoinSocketClientExchangeApiShared.cs‎

Lines changed: 46 additions & 76 deletions
Large diffs are not rendered by default.

‎DeepCoin.Net/DeepCoin.Net.csproj‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@
5353
<PrivateAssets>all</PrivateAssets>
5454
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5555
</PackageReference>
56+
<PackageReference Include="CryptoExchange.Net" Version="12.5.1" />
5657
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.0.101">
5758
<PrivateAssets>all</PrivateAssets>
5859
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5960
</PackageReference>
6061
</ItemGroup>
61-
<ItemGroup>
62-
<ProjectReference Include="..\..\CryptoExchange.Net\CryptoExchange.Net\CryptoExchange.Net.csproj" />
63-
</ItemGroup>
6462
</Project>

‎DeepCoin.Net/DeepCoinUserDataTracker.cs‎

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,12 @@ public DeepCoinUserSpotDataTracker(
1919
string? userIdentifier,
2020
SpotUserDataTrackerConfig? config) : base(
2121
logger,
22-
restClient.ExchangeApi.SharedApi,
23-
24-
restClient.ExchangeApi.SharedApi,
25-
socketClient.ExchangeApi.SharedApi,
26-
27-
restClient.ExchangeApi.SharedApi,
28-
restClient.ExchangeApi.SharedApi,
29-
socketClient.ExchangeApi.SharedApi,
30-
31-
restClient.ExchangeApi.SharedApi,
32-
socketClient.ExchangeApi.SharedApi,
22+
restClient.ExchangeApi.SharedClient,
23+
restClient.ExchangeApi.SharedClient,
24+
socketClient.ExchangeApi.SharedClient,
25+
restClient.ExchangeApi.SharedClient,
26+
socketClient.ExchangeApi.SharedClient,
27+
socketClient.ExchangeApi.SharedClient,
3328
userIdentifier,
3429
config ?? new SpotUserDataTrackerConfig())
3530
{
@@ -51,20 +46,13 @@ public DeepCoinUserFuturesDataTracker(
5146
IDeepCoinSocketClient socketClient,
5247
string? userIdentifier,
5348
FuturesUserDataTrackerConfig? config) : base(logger,
54-
restClient.ExchangeApi.SharedApi,
55-
56-
restClient.ExchangeApi.SharedApi,
57-
socketClient.ExchangeApi.SharedApi,
58-
59-
restClient.ExchangeApi.SharedApi,
60-
restClient.ExchangeApi.SharedApi,
61-
socketClient.ExchangeApi.SharedApi,
62-
63-
restClient.ExchangeApi.SharedApi,
64-
socketClient.ExchangeApi.SharedApi,
65-
66-
restClient.ExchangeApi.SharedApi,
67-
socketClient.ExchangeApi.SharedApi,
49+
restClient.ExchangeApi.SharedClient,
50+
restClient.ExchangeApi.SharedClient,
51+
socketClient.ExchangeApi.SharedClient,
52+
restClient.ExchangeApi.SharedClient,
53+
socketClient.ExchangeApi.SharedClient,
54+
socketClient.ExchangeApi.SharedClient,
55+
socketClient.ExchangeApi.SharedClient,
6856
userIdentifier,
6957
config ?? new FuturesUserDataTrackerConfig())
7058
{

‎DeepCoin.Net/Interfaces/Clients/ExchangeApi/IDeepCoinRestClientExchangeApi.cs‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,8 @@ public interface IDeepCoinRestClientExchangeApi : IRestApiClient<DeepCoinCredent
2828
public IDeepCoinRestClientExchangeApiTrading Trading { get; }
2929

3030
/// <summary>
31-
/// [V1] Get the shared rest requests client. For new implementations prefer <see cref="SharedApi"/>
31+
/// Get the shared rest requests client. This interface is shared with other exchanges to allow for a common implementation for different exchanges.
3232
/// </summary>
3333
public IDeepCoinRestClientExchangeApiShared SharedClient { get; }
34-
/// <summary>
35-
/// [V2] Gets the aggregate Shared API interface. Shared APIs provide a common,
36-
/// exchange-independent contract for accessing functionality across different
37-
/// exchange client libraries.
38-
/// </summary>
39-
public IDeepCoinRestClientExchangeSharedApi SharedApi { get; }
4034
}
4135
}

‎DeepCoin.Net/Interfaces/Clients/ExchangeApi/IDeepCoinRestClientExchangeApiShared.cs‎

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,4 @@ public interface IDeepCoinRestClientExchangeApiShared :
2121
IBookTickerRestClient
2222
{
2323
}
24-
25-
/// <summary>
26-
/// Shared API interface. Shared APIs provide a common,
27-
/// exchange-independent contract for accessing functionality across different
28-
/// exchange client libraries.
29-
/// </summary>
30-
public interface IDeepCoinRestClientExchangeSharedApi :
31-
IGetBalancesRest,
32-
IGetDepositHistoryRest,
33-
IGetKlinesRest,
34-
IGetOrderBookRest,
35-
IGetWithdrawalHistoryRest,
36-
IGetSpotTickerRest,
37-
IGetAllSpotTickersRest,
38-
IGetSpotSymbolsRest,
39-
IPlaceSpotOrderRest,
40-
IGetSpotOrderRest,
41-
IGetOpenSpotOrdersRest,
42-
IGetClosedSpotOrdersRest,
43-
ICancelSpotOrderRest,
44-
IGetSpotOrderTradesRest,
45-
IGetSpotUserTradeHistoryRest,
46-
IGetLeverageRest,
47-
ISetLeverageRest,
48-
IGetFuturesTickerRest,
49-
IGetAllFuturesTickersRest,
50-
IGetFuturesSymbolsRest,
51-
IPlaceFuturesOrderRest,
52-
IGetFuturesOrderRest,
53-
IGetOpenFuturesOrdersRest,
54-
IGetClosedFuturesOrdersRest,
55-
ICancelFuturesOrderRest,
56-
IGetFuturesOrderTradesRest,
57-
IGetFuturesUserTradeHistoryRest,
58-
IGetPositionsRest,
59-
IClosePositionRest,
60-
IGetBookTickerRest
61-
{ }
6224
}

‎DeepCoin.Net/Interfaces/Clients/ExchangeApi/IDeepCoinSocketClientExchangeApi.cs‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,8 @@ Task<WebSocketResult<UpdateSubscription>> SubscribeToUserDataUpdatesAsync(
117117
CancellationToken ct = default);
118118

119119
/// <summary>
120-
/// [V1] Get the shared socket requests client. For new implementations prefer <see cref="SharedApi"/>
120+
/// Get the shared socket requests client. This interface is shared with other exchanges to allow for a common implementation for different exchanges.
121121
/// </summary>
122122
public IDeepCoinSocketClientExchangeApiShared SharedClient { get; }
123-
/// <summary>
124-
/// [V2] Gets the aggregate Shared API interface. Shared APIs provide a common,
125-
/// exchange-independent contract for accessing functionality across different
126-
/// exchange client libraries.
127-
/// </summary>
128-
public IDeepCoinSocketClientExchangeSharedApi SharedApi { get; }
129123
}
130124
}

0 commit comments

Comments
 (0)