Skip to content

Commit

Permalink
Added V5 GetBrokerAccountInfoAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Jan 18, 2024
1 parent a37b1bf commit 7351f7c
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ByBit.Net/Clients/V5/BybitRestClientApiAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,16 @@ public async Task<WebCallResult<IEnumerable<BybitSpotMarginVipMarginList>>> GetS

#endregion

#region Get Broker Account Info

/// <inheritdoc />
public async Task<WebCallResult<BybitBrokerAccountInfo>> GetBrokerAccountInfoAsync(CancellationToken ct = default)
{
return await _baseClient.SendRequestAsync<BybitBrokerAccountInfo>(_baseClient.GetUrl("v5/broker/account-info"), HttpMethod.Get, ct, null, true).ConfigureAwait(false);
}

#endregion

#region Get Broker Earnings

/// <inheritdoc />
Expand Down
8 changes: 8 additions & 0 deletions ByBit.Net/Interfaces/Clients/V5/IBybitRestClientApiAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,5 +515,13 @@ Task<WebCallResult<BybitPosition>> AddOrReduceMarginAsync(
/// <param name="ct">Cancellation token</param>
/// <returns></returns>
Task<WebCallResult<BybitBrokerEarnings>> GetBrokerEarningsAsync(string? bizType = null, DateTime? startTime = null, DateTime? endTime = null, string? subAccountId = null, int? limit = null, string? cursor = null, CancellationToken ct = default);

/// <summary>
/// Get broker account info
/// <para><a href="https://bybit-exchange.github.io/docs/v5/broker/account-info" /></para>
/// </summary>
/// <param name="ct">Cancellation token</param>
/// <returns></returns>
Task<WebCallResult<BybitBrokerAccountInfo>> GetBrokerAccountInfoAsync(CancellationToken ct = default);
}
}
56 changes: 56 additions & 0 deletions ByBit.Net/Objects/Models/V5/BybitBrokerAccountInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using CryptoExchange.Net.Converters;
using Newtonsoft.Json;
using System;

namespace Bybit.Net.Objects.Models.V5
{
/// <summary>
/// Broker account info
/// </summary>
public class BybitBrokerAccountInfo
{
/// <summary>
/// Current sub account quantity
/// </summary>
[JsonProperty("subAcctQty")]
public int SubAccountCount { get; set; }
/// <summary>
/// Max sub account quantity
/// </summary>
[JsonProperty("maxSubAcctQty")]
public int MaxSubAccountCount { get; set; }
/// <summary>
/// Timestamp
/// </summary>
[JsonProperty("ts")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime Timestamp { get; set; }
/// <summary>
/// Base fee rebate rates
/// </summary>
[JsonProperty("baseFeeRebateRate")]
public BybitBrokerRebateRate BaseFeeRebateRates { get; set; } = null!;
/// <summary>
/// Markup fee rebate rates
/// </summary>
[JsonProperty("markupFeeRebateRate")]
public BybitBrokerRebateRate MarkupFeeRebateRates { get; set; } = null!;
}

/// <summary>
/// Rebate rate info
/// </summary>
public class BybitBrokerRebateRate
{
/// <summary>
/// Spot rebate rate
/// </summary>
[JsonProperty("spot")]
public string Spot { get; set; } = string.Empty;
/// <summary>
/// Derivatives rebate rate
/// </summary>
[JsonProperty("derivatives")]
public string Derivatives { get; set; } = string.Empty;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"retCode": 0,
"retMsg": "success",
"result": {
"subAcctQty": "2",
"maxSubAcctQty": "20",
"baseFeeRebateRate": {
"spot": "10.0%",
"derivatives": "10.0%"
},
"markupFeeRebateRate": {
"spot": "6.00%",
"derivatives": "9.00%"
},
"ts": "1701395633402"
},
"retExtInfo": {},
"time": 1701395633403
}

0 comments on commit 7351f7c

Please sign in to comment.