Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

namespace ExchangeSharp
{
[ApiName(ExchangeName.Bybit)]
public class ExchangeBybitInverseAPI : ExchangeBybitV5Base
{
protected override MarketCategory MarketCategory => MarketCategory.Inverse;
Expand All @@ -18,4 +17,5 @@ public ExchangeBybitInverseAPI(bool isUnifiedAccount)
IsUnifiedAccount = isUnifiedAccount;
}
}
public partial class ExchangeName { public const string BybitInverse = "BybitInverse"; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

namespace ExchangeSharp
{
[ApiName(ExchangeName.Bybit)]
public class ExchangeBybitLinearAPI : ExchangeBybitV5Base
{
protected override MarketCategory MarketCategory => MarketCategory.Linear;
Expand All @@ -18,4 +17,5 @@ public ExchangeBybitLinearAPI(bool isUnifiedAccount)
IsUnifiedAccount = isUnifiedAccount;
}
}
public partial class ExchangeName { public const string BybitLinear = "BybitLinear"; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

namespace ExchangeSharp
{
[ApiName(ExchangeName.Bybit)]
public class ExchangeBybitOptionAPI : ExchangeBybitV5Base
{
protected override MarketCategory MarketCategory => MarketCategory.Option;
Expand All @@ -18,4 +17,5 @@ public ExchangeBybitOptionAPI(bool isUnifiedAccount)
IsUnifiedAccount = isUnifiedAccount;
}
}
public partial class ExchangeName { public const string BybitOption = "BybitOption"; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

namespace ExchangeSharp
{
[ApiName(ExchangeName.Bybit)]
public class ExchangeBybitSpotAPI : ExchangeBybitV5Base
{
protected override MarketCategory MarketCategory => MarketCategory.Spot;
Expand All @@ -18,4 +17,5 @@ public ExchangeBybitSpotAPI(bool isUnified)
IsUnifiedAccount = isUnified;
}
}
public partial class ExchangeName { public const string BybitSpot = "BybitSpot"; }
}
11 changes: 8 additions & 3 deletions src/ExchangeSharp/API/Exchanges/Bybit/ExchangeBybitV5Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ protected override async Task<IEnumerable<MarketCandle>> OnGetCandlesAsync(strin
string url = "/v5/market/kline";
int maxLimit = 200;
limit ??= maxLimit;
if (limit.Value > maxLimit) { limit = maxLimit; }
if (limit.Value > maxLimit)
{
limit = maxLimit;
}
List<MarketCandle> candles = new List<MarketCandle>();
string periodString = PeriodSecondsToString(periodSeconds);
if (startDate == null)
Expand Down Expand Up @@ -244,7 +247,10 @@ protected override async Task<Dictionary<string, decimal>> OnGetAmountsAvailable
Dictionary<string, decimal> amounts = new Dictionary<string, decimal>(StringComparer.OrdinalIgnoreCase);

var accountBalances = result["list"].FirstOrDefault(i => i["accountType"].ToStringInvariant() == accType);
if (accountBalances == null) return amounts;
if (accountBalances == null)
{
return amounts;
}
if (IsUnifiedAccount.Value)
{
// All assets that can be used as collateral, converted to USD, will be here
Expand All @@ -253,7 +259,6 @@ protected override async Task<Dictionary<string, decimal>> OnGetAmountsAvailable
string balanceKey = accType == "SPOT" ? "free" : "availableToWithdraw";
foreach (var coin in accountBalances["coin"])
{

decimal amount = coin[balanceKey].ConvertInvariant<decimal>();
if (amount > 0m)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ExchangeSharp/Model/ExchangeOrderBook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ExchangeOrderPrice(BinaryReader reader)
public sealed class ExchangeOrderBook
{
/// <summary>
/// Needed to distinguish between fool book and deltas
/// Needed to distinguish between full book and deltas
/// </summary>
public bool IsFromSnapshot { get; set; }
public string ExchangeName { get; set; }
Expand Down