Skip to content

Commit

Permalink
Added broker reference option
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Oct 29, 2023
1 parent a7998bd commit a7b9c45
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CoinEx.Net/Clients/SpotApi/CoinExRestClientSpotApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class CoinExRestClientSpotApi : RestApiClient, ICoinExClientSpotApi, ISpo
public ICoinExClientSpotApiTrading Trading { get; }
#endregion

internal readonly string _brokerId;

#region ctor
internal CoinExRestClientSpotApi(ILogger logger, HttpClient? httpClient, CoinExRestOptions options) :
base(logger, httpClient, options.Environment.RestBaseAddress, options, options.SpotOptions)
Expand All @@ -61,6 +63,8 @@ internal CoinExRestClientSpotApi(ILogger logger, HttpClient? httpClient, CoinExR
manualParseError = true;
ParameterPositions[HttpMethod.Delete] = HttpMethodParameterPosition.InUri;

_brokerId = !string.IsNullOrEmpty(options.BrokerId) ? options.BrokerId! : "147866029";

}
#endregion

Expand Down
2 changes: 2 additions & 0 deletions CoinEx.Net/Clients/SpotApi/CoinExRestClientSpotApiTrading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public async Task<WebCallResult<CoinExOrder>> PlaceOrderAsync(
endpoint = PlaceImmediateOrCancelOrderEndpoint;
}

clientOrderId = clientOrderId ?? ExchangeHelpers.AppendRandomString(_baseClient._brokerId, 32);

var parameters = new Dictionary<string, object>
{
{ "market", symbol },
Expand Down
2 changes: 1 addition & 1 deletion CoinEx.Net/CoinEx.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="CryptoExchange.Net" Version="6.2.0" />
<PackageReference Include="CryptoExchange.Net" Version="6.2.1" />
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions CoinEx.Net/CoinEx.Net.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions CoinEx.Net/Objects/Options/CoinExRestOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public class CoinExRestOptions : RestExchangeOptions<CoinExEnvironment>
/// </summary>
public RestApiOptions SpotOptions { get; private set; } = new RestApiOptions();

/// <summary>
/// The broker reference id to use
/// </summary>
public string? BrokerId { get; set; }

internal CoinExRestOptions Copy()
{
var options = Copy<CoinExRestOptions>();
Expand Down

0 comments on commit a7b9c45

Please sign in to comment.