diff --git a/ByBit.Net/BybitAuthenticationProvider.cs b/ByBit.Net/BybitAuthenticationProvider.cs index abc210c7..2842a894 100644 --- a/ByBit.Net/BybitAuthenticationProvider.cs +++ b/ByBit.Net/BybitAuthenticationProvider.cs @@ -9,6 +9,7 @@ using System.Globalization; using Bybit.Net.Clients.V5; using System.Text; +using Newtonsoft.Json; namespace Bybit.Net { @@ -33,7 +34,7 @@ public override void AuthenticateRequest(RestApiClient apiClient, Uri uri, HttpM var timestamp = DateTimeConverter.ConvertToMilliseconds(GetTimestamp(apiClient).AddMilliseconds(-1000)).Value.ToString(CultureInfo.InvariantCulture); if (apiClient is BybitRestClientCopyTradingApi || apiClient is BybitRestClientApi) { - var signPayload = parameterPosition == HttpMethodParameterPosition.InUri ? uri.SetParameters(parameters, arraySerialization).Query.Replace("?", "") : parameters.ToFormData(); + var signPayload = parameterPosition == HttpMethodParameterPosition.InUri ? uri.SetParameters(parameters, arraySerialization).Query.Replace("?", "") : apiClient.requestBodyFormat == RequestBodyFormat.FormData ? parameters.ToFormData() : JsonConvert.SerializeObject(parameters); var key = _credentials.Key!.GetString(); var recvWindow = 5000; var payload = timestamp + key + recvWindow + signPayload; diff --git a/ByBit.Net/Clients/V5/BybitRestClientApi.cs b/ByBit.Net/Clients/V5/BybitRestClientApi.cs index 67336e8f..7bf9e5df 100644 --- a/ByBit.Net/Clients/V5/BybitRestClientApi.cs +++ b/ByBit.Net/Clients/V5/BybitRestClientApi.cs @@ -50,7 +50,7 @@ internal BybitRestClientApi(ILogger logger, HttpClient? httpClient, BybitRestOpt ExchangeData = new BybitRestClientApiExchangeData(this); Trading = new BybitRestClientApiTrading(this); - requestBodyFormat = RequestBodyFormat.FormData; + requestBodyFormat = RequestBodyFormat.Json; ParameterPositions[HttpMethod.Delete] = HttpMethodParameterPosition.InUri; } #endregion