Skip to content

Commit eb51abd

Browse files
authored
Implementation of Bybit V5 unified API (#801)
Implemented main private and public methods, some public (candles and orderbook) and private WebSockets. A decision was made to split spot, inverse, linear, and option branches into different APIs because: 1) market symbols intersect, 2) there are no any method to get all the markets (all orders, all positions) from different branches in one call. Branches behave as separate exchanges.
1 parent ecedb95 commit eb51abd

File tree

8 files changed

+866
-6
lines changed

8 files changed

+866
-6
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using ExchangeSharp.Bybit;
5+
6+
namespace ExchangeSharp
7+
{
8+
[ApiName(ExchangeName.Bybit)]
9+
public class ExchangeBybitInverseAPI : ExchangeBybitV5Base
10+
{
11+
protected override MarketCategory MarketCategory => MarketCategory.Inverse;
12+
public override string BaseUrlWebSocket => "wss://stream.bybit.com/v5/public/inverse";
13+
public ExchangeBybitInverseAPI()
14+
{
15+
}
16+
public ExchangeBybitInverseAPI(bool isUnifiedAccount)
17+
{
18+
IsUnifiedAccount = isUnifiedAccount;
19+
}
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using ExchangeSharp.Bybit;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text;
5+
6+
namespace ExchangeSharp
7+
{
8+
[ApiName(ExchangeName.Bybit)]
9+
public class ExchangeBybitLinearAPI : ExchangeBybitV5Base
10+
{
11+
protected override MarketCategory MarketCategory => MarketCategory.Linear;
12+
public override string BaseUrlWebSocket => "wss://stream.bybit.com/v5/public/linear";
13+
public ExchangeBybitLinearAPI()
14+
{
15+
}
16+
public ExchangeBybitLinearAPI(bool isUnifiedAccount)
17+
{
18+
IsUnifiedAccount = isUnifiedAccount;
19+
}
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using ExchangeSharp.Bybit;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text;
5+
6+
namespace ExchangeSharp
7+
{
8+
[ApiName(ExchangeName.Bybit)]
9+
public class ExchangeBybitOptionAPI : ExchangeBybitV5Base
10+
{
11+
protected override MarketCategory MarketCategory => MarketCategory.Option;
12+
public override string BaseUrlWebSocket => "wss://stream.bybit.com/v5/public/option";
13+
public ExchangeBybitOptionAPI()
14+
{
15+
}
16+
public ExchangeBybitOptionAPI(bool isUnifiedAccount)
17+
{
18+
IsUnifiedAccount = isUnifiedAccount;
19+
}
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using ExchangeSharp.Bybit;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text;
5+
6+
namespace ExchangeSharp
7+
{
8+
[ApiName(ExchangeName.Bybit)]
9+
public class ExchangeBybitSpotAPI : ExchangeBybitV5Base
10+
{
11+
protected override MarketCategory MarketCategory => MarketCategory.Spot;
12+
public override string BaseUrlWebSocket => "wss://stream.bybit.com/v5/public/spot";
13+
public ExchangeBybitSpotAPI()
14+
{
15+
}
16+
public ExchangeBybitSpotAPI(bool isUnified)
17+
{
18+
IsUnifiedAccount = isUnified;
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)