diff --git a/ByBit.Net/Clients/BybitRestClient.cs b/ByBit.Net/Clients/BybitRestClient.cs
index 6ba6b447..a610abbc 100644
--- a/ByBit.Net/Clients/BybitRestClient.cs
+++ b/ByBit.Net/Clients/BybitRestClient.cs
@@ -1,17 +1,7 @@
using Bybit.Net.Clients.CopyTradingApi;
-using Bybit.Net.Clients.GeneralApi;
-using Bybit.Net.Clients.InverseFuturesApi;
-using Bybit.Net.Clients.InversePerpetualApi;
-using Bybit.Net.Clients.UsdPerpetualApi;
using Bybit.Net.Interfaces.Clients;
using Bybit.Net.Interfaces.Clients.CopyTradingApi;
-using Bybit.Net.Interfaces.Clients.GeneralApi;
-using Bybit.Net.Interfaces.Clients.InverseFuturesApi;
-using Bybit.Net.Interfaces.Clients.InversePerpetualApi;
-using Bybit.Net.Interfaces.Clients.SpotApi.v1;
-using Bybit.Net.Interfaces.Clients.UsdPerpetualApi;
using CryptoExchange.Net;
-using Bybit.Net.Clients.SpotApi.v1;
using Bybit.Net.Clients.SpotApi.v3;
using Bybit.Net.Interfaces.Clients.SpotApi.v3;
using Bybit.Net.Interfaces.Clients.DerivativesApi;
@@ -27,19 +17,9 @@ namespace Bybit.Net.Clients
///
public class BybitRestClient : BaseRestClient, IBybitRestClient
{
- ///
- public IBybitRestClientGeneralApi GeneralApi { get; }
- ///
- public IBybitRestClientSpotApiV1 SpotApiV1 { get; }
///
public IBybitRestClientSpotApiV3 SpotApiV3 { get; }
///
- public IBybitRestClientInversePerpetualApi InversePerpetualApi { get; }
- ///
- public IBybitRestClientInverseFuturesApi InverseFuturesApi { get; }
- ///
- public IBybitRestClientUsdPerpetualApi UsdPerpetualApi { get; }
- ///
public IBybitRestClientCopyTradingApi CopyTradingApi { get; }
///
public IBybitRestClientDerivativesApi DerivativesApi { get; }
@@ -69,12 +49,7 @@ public BybitRestClient(HttpClient? httpClient, ILoggerFactory? loggerFactory, Ac
optionsDelegate(options);
Initialize(options);
- InversePerpetualApi = AddApiClient(new BybitRestClientInversePerpetualApi(_logger, httpClient, options));
- InverseFuturesApi = AddApiClient(new BybitRestClientInverseFuturesApi(_logger, httpClient, options));
- UsdPerpetualApi = AddApiClient(new BybitRestClientUsdPerpetualApi(_logger, httpClient, options));
- SpotApiV1 = AddApiClient(new BybitRestClientSpotApiV1(_logger, httpClient, options));
SpotApiV3 = AddApiClient(new BybitRestClientSpotApiV3(_logger, httpClient, options));
- GeneralApi = AddApiClient(new BybitRestClientGeneralApi(_logger, this, httpClient, options));
CopyTradingApi = AddApiClient(new BybitRestClientCopyTradingApi(_logger, httpClient, options));
DerivativesApi = AddApiClient(new BybitRestClientDerivativesApi(_logger, httpClient, options));
V5Api = AddApiClient(new V5.BybitRestClientApi(_logger, httpClient, options));
@@ -96,12 +71,7 @@ public static void SetDefaultOptions(Action optionsDelegate)
///
public void SetApiCredentials(ApiCredentials credentials)
{
- InversePerpetualApi.SetApiCredentials(credentials);
- InverseFuturesApi.SetApiCredentials(credentials);
- UsdPerpetualApi.SetApiCredentials(credentials);
- SpotApiV1.SetApiCredentials(credentials);
SpotApiV3.SetApiCredentials(credentials);
- GeneralApi.SetApiCredentials(credentials);
CopyTradingApi.SetApiCredentials(credentials);
DerivativesApi.SetApiCredentials(credentials);
V5Api.SetApiCredentials(credentials);
diff --git a/ByBit.Net/Clients/BybitSocketClient.cs b/ByBit.Net/Clients/BybitSocketClient.cs
index c94bb105..83bb1a1e 100644
--- a/ByBit.Net/Clients/BybitSocketClient.cs
+++ b/ByBit.Net/Clients/BybitSocketClient.cs
@@ -1,7 +1,6 @@
using CryptoExchange.Net;
using System;
using Bybit.Net.Interfaces.Clients;
-using Bybit.Net.Interfaces.Clients.UsdPerpetualApi;
using Bybit.Net.Interfaces.Clients.SpotApi.v3;
using Bybit.Net.Interfaces.Clients.DerivativesApi.UnifiedMarginApi;
using Bybit.Net.Interfaces.Clients.DerivativesApi.ContractApi;
diff --git a/ByBit.Net/Clients/GeneralApi/BybitRestClientGeneralApi.cs b/ByBit.Net/Clients/GeneralApi/BybitRestClientGeneralApi.cs
deleted file mode 100644
index 0a6dd397..00000000
--- a/ByBit.Net/Clients/GeneralApi/BybitRestClientGeneralApi.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-using Bybit.Net.Clients.CopyTradingApi;
-using Bybit.Net.Clients.InversePerpetualApi;
-using Bybit.Net.Interfaces.Clients.GeneralApi;
-using Bybit.Net.Objects.Internal;
-using Bybit.Net.Objects.Options;
-using CryptoExchange.Net;
-using CryptoExchange.Net.Authentication;
-using CryptoExchange.Net.Objects;
-using Microsoft.Extensions.Logging;
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Net.Http;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Bybit.Net.Clients.GeneralApi
-{
- ///
- public class BybitRestClientGeneralApi : RestApiClient, IBybitRestClientGeneralApi
- {
- private readonly BybitRestClient _baseClient;
-
- ///
- /// Options
- ///
- public new BybitRestOptions ClientOptions => (BybitRestOptions)base.ClientOptions;
-
- ///
- public IBybitRestClientGeneralApiTransfer Transfer { get; }
- ///
- public IBybitRestClientGeneralApiWithdrawDeposit WithdrawDeposit { get; }
-
- #region ctor
- internal BybitRestClientGeneralApi(ILogger logger, BybitRestClient restClient, HttpClient? httpClient, BybitRestOptions options) :
- base(logger, httpClient, options.Environment.RestBaseAddress, options, options.InversePerpetualOptions)
- {
- if (!string.IsNullOrEmpty(options.Referer))
- {
- StandardRequestHeaders = new Dictionary
- {
- { "x-referer", options.Referer! }
- };
- }
-
- _baseClient = restClient;
-
- Transfer = new BybitRestClientGeneralApiTransfer(this);
- WithdrawDeposit = new BybitRestClientGeneralApiWithdrawDeposit(this);
-
- requestBodyFormat = RequestBodyFormat.Json;
- ParameterPositions[HttpMethod.Delete] = HttpMethodParameterPosition.InUri;
- }
- #endregion
-
- ///
- protected override AuthenticationProvider CreateAuthenticationProvider(ApiCredentials credentials)
- => new BybitAuthenticationProvider(credentials);
-
- ///
- /// Get url for an endpoint
- ///
- ///
- ///
- internal Uri GetUrl(string endpoint)
- {
- return new Uri(BaseAddress.AppendPath(endpoint));
- }
-
- internal async Task> SendRequestAsync(
- Uri uri,
- HttpMethod method,
- CancellationToken cancellationToken,
- Dictionary? parameters = null,
- bool signed = false,
- JsonSerializer? deserializer = null)
- {
- var result = await base.SendRequestAsync>(uri, method, cancellationToken, parameters, signed, deserializer: deserializer).ConfigureAwait(false);
- if (!result)
- return result.As(default);
-
- if (result.Data.ReturnCode != 0)
- return result.AsError(new ServerError(result.Data.ReturnCode, result.Data.ReturnMessage));
-
- return result.As(result.Data.Result);
- }
-
-
- ///
- protected override Task> GetServerTimestampAsync()
- => _baseClient.InversePerpetualApi.ExchangeData.GetServerTimeAsync();
-
- ///
- public override TimeSyncInfo? GetTimeSyncInfo()
- => new TimeSyncInfo(_logger, (ApiOptions.AutoTimestamp ?? ClientOptions.AutoTimestamp), (ApiOptions.TimestampRecalculationInterval ?? ClientOptions.TimestampRecalculationInterval), BybitRestClientInversePerpetualApi._timeSyncState);
-
- ///
- public override TimeSpan? GetTimeOffset()
- => BybitRestClientCopyTradingApi._timeSyncState.TimeOffset;
- }
-}
diff --git a/ByBit.Net/Clients/GeneralApi/BybitRestClientGeneralApiTransfer.cs b/ByBit.Net/Clients/GeneralApi/BybitRestClientGeneralApiTransfer.cs
deleted file mode 100644
index cd5303b8..00000000
--- a/ByBit.Net/Clients/GeneralApi/BybitRestClientGeneralApiTransfer.cs
+++ /dev/null
@@ -1,236 +0,0 @@
-using Bybit.Net.Converters;
-using Bybit.Net.Enums;
-using Bybit.Net.Interfaces.Clients.GeneralApi;
-using Bybit.Net.Objects.Internal;
-using Bybit.Net.Objects.Models;
-using CryptoExchange.Net;
-using CryptoExchange.Net.Converters;
-using CryptoExchange.Net.Objects;
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Net.Http;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Bybit.Net.Clients.GeneralApi
-{
- ///
- public class BybitRestClientGeneralApiTransfer : IBybitRestClientGeneralApiTransfer
- {
- private BybitRestClientGeneralApi _baseClient;
-
- internal BybitRestClientGeneralApiTransfer(BybitRestClientGeneralApi baseClient)
- {
- _baseClient = baseClient;
- }
-
- #region Create internal transfer
-
- ///
- public async Task> CreateInternalTransferAsync(string transferId, string asset, decimal quantity, AccountType fromAccountType, AccountType toAccountType, long? receiveWindow = null, CancellationToken ct = default)
- {
- var parameters = new Dictionary()
- {
- { "transfer_id", transferId },
- { "coin", asset },
- { "amount", quantity.ToString(CultureInfo.InvariantCulture) },
- { "from_account_type", EnumConverter.GetString(fromAccountType)! },
- { "to_account_type", EnumConverter.GetString(toAccountType)! },
- };
- parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.ClientOptions.ReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
-
- return await _baseClient.SendRequestAsync(_baseClient.GetUrl("asset/v1/private/transfer"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false);
- }
-
- #endregion
-
- #region Create subaccount transfer
-
- ///
- public async Task> CreateSubAccountTransferAsync(string transferId, string asset, decimal quantity, string subAccountId, TransferType type, long? receiveWindow = null, CancellationToken ct = default)
- {
- var parameters = new Dictionary()
- {
- { "transfer_id", transferId },
- { "coin", asset },
- { "amount", quantity.ToString(CultureInfo.InvariantCulture) },
- { "sub_user_id", subAccountId },
- { "type", EnumConverter.GetString(type)! },
- };
- parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.ClientOptions.ReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
-
- return await _baseClient.SendRequestAsync(_baseClient.GetUrl("asset/v1/private/sub-member/transfer"), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false);
- }
-
- #endregion
-
- #region Get transfer history
-
- ///
- public async Task>>> GetTransferHistoryAsync(
- string? transferId = null,
- string? asset = null,
- TransferStatus? status = null,
- DateTime? startTime = null,
- DateTime? endTime = null,
- SearchDirection? direction = null,
- int? limit = null,
- string? cursor = null,
- long? receiveWindow = null,
- CancellationToken ct = default)
- {
- var parameters = new Dictionary();
- parameters.AddOptionalParameter("transfer_id", transferId);
- parameters.AddOptionalParameter("coin", asset);
- parameters.AddOptionalParameter("status", EnumConverter.GetString(status));
- parameters.AddOptionalParameter("start_time", DateTimeConverter.ConvertToMilliseconds(startTime));
- parameters.AddOptionalParameter("end_time", DateTimeConverter.ConvertToMilliseconds(endTime));
- parameters.AddOptionalParameter("direction", transferId);
- parameters.AddOptionalParameter("limit", limit?.ToString(CultureInfo.InvariantCulture));
- parameters.AddOptionalParameter("direction", direction == null ? null : JsonConvert.SerializeObject(direction, new SearchDirectionConverter(false)));
- parameters.AddOptionalParameter("cursor", cursor);
- parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.ClientOptions.ReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
-
- return await _baseClient.SendRequestAsync>>(_baseClient.GetUrl("asset/v1/private/transfer/list"), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false);
- }
-
- #endregion
-
- #region Get subaccount transfer history
-
- ///
- public async Task>>> GetSubAccountTransferHistoryAsync(
- string? transferId = null,
- string? asset = null,
- TransferStatus? status = null,
- DateTime? startTime = null,
- DateTime? endTime = null,
- SearchDirection? direction = null,
- int? limit = null,
- string? cursor = null,
- long? receiveWindow = null,
- CancellationToken ct = default)
- {
- var parameters = new Dictionary();
- parameters.AddOptionalParameter("transfer_id", transferId);
- parameters.AddOptionalParameter("coin", asset);
- parameters.AddOptionalParameter("status", EnumConverter.GetString(status));
- parameters.AddOptionalParameter("start_time", DateTimeConverter.ConvertToMilliseconds(startTime));
- parameters.AddOptionalParameter("end_time", DateTimeConverter.ConvertToMilliseconds(endTime));
- parameters.AddOptionalParameter("direction", transferId);
- parameters.AddOptionalParameter("limit", limit?.ToString(CultureInfo.InvariantCulture));
- parameters.AddOptionalParameter("direction", direction == null ? null : JsonConvert.SerializeObject(direction, new SearchDirectionConverter(false)));
- parameters.AddOptionalParameter("cursor", cursor);
- parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.ClientOptions.ReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
-
- return await _baseClient.SendRequestAsync>>(_baseClient.GetUrl("asset/v1/private/sub-member/transfer/list"), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false);
- }
-
- #endregion
-
- #region Get subaccounts
-
- ///
- public async Task> GetSubAccountsAsync(long? receiveWindow = null, CancellationToken ct = default)
- {
- var parameters = new Dictionary();
- parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.ClientOptions.ReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
-
- return await _baseClient.SendRequestAsync(_baseClient.GetUrl("asset/v1/private/sub-member/member-ids"), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false);
- }
-
- #endregion
-
- #region Enable Subaccounts Universal Transfer
-
- ///
- public async Task EnableSubaccountsUniversalTransferAsync(IEnumerable? subaccountIds = null, long? receiveWindow = null, CancellationToken ct = default)
- {
- var parameters = new Dictionary();
- parameters.AddOptionalParameter("transferable_sub_ids", subaccountIds == null ? null : string.Join(",", subaccountIds));
- parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.ClientOptions.ReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
-
- var result = await _baseClient.SendRequestAsync