Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d11332b
Updated gitignore to exclude compiled files
kolya5544 Aug 27, 2025
63a3293
Exclude untracked files from main repository
kolya5544 Aug 27, 2025
8b56400
Updated 'Trade' category endpoints: added PreCheckOrder
kolya5544 Aug 27, 2025
c55ec91
Added a response model for PreCheckOrder
kolya5544 Aug 27, 2025
b4fba6c
Updated 'Position' category endpoints: Added Get Closed Options Posit…
kolya5544 Aug 27, 2025
35603ec
Market Category Endpoints rewamp, to an extent. Fixed a lot of spelli…
kolya5544 Sep 8, 2025
0259981
Added one extra endpoint that was missing
kolya5544 Sep 8, 2025
9029044
Removed long gone and obsolete endpoints from SDK
kolya5544 Sep 8, 2025
16ede8e
Added all new Account endpoints, updated some Account endpoints, fixe…
kolya5544 Sep 8, 2025
a31d071
Updated all Asset endpoints, added all new Asset endpoints, fixed a l…
kolya5544 Sep 8, 2025
dceac40
Added all User category endpoints, fixed URLs of existing endpoints, …
kolya5544 Sep 8, 2025
39db5d5
Added Affiliate endpoints to the SDK
kolya5544 Sep 8, 2025
12f98a9
Added all new endpoints for Spot Margin Trade, added a few additional…
kolya5544 Sep 8, 2025
2ac82d1
Completely added all New Crypto Loan endpoints and models for New Cry…
kolya5544 Sep 8, 2025
3aa7278
Added all P2P endpoints and corresponding response models
kolya5544 Sep 8, 2025
7f55681
Bumped version to 1.2.0
kolya5544 Sep 10, 2025
dd8a364
Fixed example code to prevent error messages in bybit.api.console
kolya5544 Sep 10, 2025
e3c4ab3
Hotfix PRE_CHECK_ORDER uses incorrect URL
kolya5544 Sep 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
56 changes: 5 additions & 51 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.rsuser
Expand All @@ -10,6 +10,8 @@
*.userosscache
*.sln.docstates

nuget.config

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

Expand All @@ -23,7 +25,6 @@ mono_crash.*
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
Expand Down Expand Up @@ -62,9 +63,6 @@ project.lock.json
project.fragment.lock.json
artifacts/

# ASP.NET Scaffolding
ScaffoldingReadMe.txt

# StyleCop
StyleCopReport.xml

Expand All @@ -73,6 +71,7 @@ StyleCopReport.xml
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
Expand All @@ -89,7 +88,6 @@ StyleCopReport.xml
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
Expand Down Expand Up @@ -141,11 +139,6 @@ _TeamCity*
.axoCover/*
!.axoCover/settings.json

# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info

# Visual Studio code coverage results
*.coverage
*.coveragexml
Expand Down Expand Up @@ -293,17 +286,6 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files
*.ncb
*.aps

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand Down Expand Up @@ -360,39 +342,11 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# Visual Studio History (VSHistory) files
.vshistory/

# BeatPulse healthcheck temp database
healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp

# JetBrains Rider
*.sln.iml
.idea
.ionide/
Binary file removed .vs/bybit.net.api/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file removed .vs/bybit.net.api/v16/.suo
Binary file not shown.
Binary file removed .vs/bybit.net.api/v17/.futdcache.v2
Binary file not shown.
Binary file removed .vs/bybit.net.api/v17/.suo
Binary file not shown.
Binary file removed .vs/bybit.net.api/v17/TestStore/0/testlog.manifest
Binary file not shown.
105 changes: 56 additions & 49 deletions Examples/bybit.api.console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,59 @@
using bybit.net.api.WebSocketStream;


//BybitMarketDataService market = new(url: BybitConstants.HTTP_TESTNET_URL, debugMode: true);
//var klineInfo = await market.GetMarketKline(Category.SPOT, "BTCUSDT", MarketInterval.OneMinute, limit: 3);
//Console.WriteLine(klineInfo);
//var klinePriceInfo = await market.GetMarKPricetKline(Category.LINEAR, "BTCUSDT", MarketInterval.OneMinute);
//Console.WriteLine(klinePriceInfo);

//var spotWebsocket = new BybitSpotWebSocket(true);
//spotWebsocket.OnMessageReceived(
// (data) =>
// {
// Console.WriteLine(data);

// return Task.CompletedTask;
// }, CancellationToken.None);

//await spotWebsocket.ConnectAsync(new string[] { "orderbook.50.BTCUSDT" }, CancellationToken.None);


//var linearWebsocket = new BybitLinearWebSocket(true);
//linearWebsocket.OnMessageReceived(
// (data) =>
// {
// Console.WriteLine(data);
// return Task.CompletedTask;
// }, CancellationToken.None);
//await linearWebsocket.ConnectAsync(new string[] { "publicTrade.BTCUSDT" }, CancellationToken.None);

//var privateWebsocket = new BybitPrivateWebsocket(apiKey: "xxxxxxxxxxxxxxxxxxxxx", apiSecret: "xxxxxxxxxxxxxxxxxxxxx", useTestNet: true, debugMode: true);
//privateWebsocket.OnMessageReceived(
// (data) =>
// {
// Console.WriteLine(data);
// return Task.CompletedTask;
// }, CancellationToken.None);
//await privateWebsocket.ConnectAsync(new string[] { "order" }, CancellationToken.None);

//BybitTradeService tradeService = new(apiKey: "xxxxxxxxxxxxxx", apiSecret: "xxxxxxxxxxxxxxxxxxxxx");
//var orderInfo = await tradeService.PlaceOrder(category: Category.LINEAR, symbol: "BLZUSDT", side: Side.BUY, orderType: OrderType.MARKET, qty: "15", timeInForce: TimeInForce.GTC);
//Console.WriteLine(orderInfo);

//BybitPositionService positionService = new(apiKey: "xxxxxxxxxxxxxxxxxxxxx", apiSecret: "xxxxxxxxxxxxxxxxxxxxx", BybitConstants.HTTP_TESTNET_URL);
//var positionInfo = await positionService.GetPositionInfo(category: Category.LINEAR, symbol: "BLZUSDT");
//Console.WriteLine(positionInfo);

//BybitAccountService accountService = new(apiKey: "xxxxxxxxxxxxxxxxxxxxx", apiSecret: "xxxxxxxxxxxxxxxxxxxxx", url: BybitConstants.HTTP_TESTNET_URL);
//var accountInfo = await accountService.GetAccountBalance(accountType: AccountType.Unified, coin: "USDT");
//Console.WriteLine(accountInfo);

//Console.ReadLine();
public class Program
{
public static async Task Main(string[] args)
{
BybitMarketDataService market = new(url: BybitConstants.HTTP_TESTNET_URL, debugMode: true);
var klineInfo = await market.GetMarketKline(Category.SPOT, "BTCUSDT", MarketInterval.OneMinute, limit: 3);
Console.WriteLine(klineInfo);
var klinePriceInfo = await market.GetMarkPriceKline(Category.LINEAR, "BTCUSDT", MarketInterval.OneMinute);
Console.WriteLine(klinePriceInfo);

var spotWebsocket = new BybitSpotWebSocket(true);
spotWebsocket.OnMessageReceived(
(data) =>
{
Console.WriteLine(data);

return Task.CompletedTask;
}, CancellationToken.None);

await spotWebsocket.ConnectAsync(new string[] { "orderbook.50.BTCUSDT" }, CancellationToken.None);


var linearWebsocket = new BybitLinearWebSocket(true);
linearWebsocket.OnMessageReceived(
(data) =>
{
Console.WriteLine(data);
return Task.CompletedTask;
}, CancellationToken.None);
await linearWebsocket.ConnectAsync(new string[] { "publicTrade.BTCUSDT" }, CancellationToken.None);

var privateWebsocket = new BybitPrivateWebsocket(apiKey: "xxxxxxxxxxxxxxxxxxxxx", apiSecret: "xxxxxxxxxxxxxxxxxxxxx", useTestNet: true, debugMode: true);
privateWebsocket.OnMessageReceived(
(data) =>
{
Console.WriteLine(data);
return Task.CompletedTask;
}, CancellationToken.None);
await privateWebsocket.ConnectAsync(new string[] { "order" }, CancellationToken.None);

BybitTradeService tradeService = new(apiKey: "xxxxxxxxxxxxxx", apiSecret: "xxxxxxxxxxxxxxxxxxxxx");
var orderInfo = await tradeService.PlaceOrder(category: Category.LINEAR, symbol: "BLZUSDT", side: Side.BUY, orderType: OrderType.MARKET, qty: "15", timeInForce: TimeInForce.GTC);
Console.WriteLine(orderInfo);

BybitPositionService positionService = new(apiKey: "xxxxxxxxxxxxxxxxxxxxx", apiSecret: "xxxxxxxxxxxxxxxxxxxxx", BybitConstants.HTTP_TESTNET_URL);
var positionInfo = await positionService.GetPositionInfo(category: Category.LINEAR, symbol: "BLZUSDT");
Console.WriteLine(positionInfo);

BybitAccountService accountService = new(apiKey: "xxxxxxxxxxxxxxxxxxxxx", apiSecret: "xxxxxxxxxxxxxxxxxxxxx", url: BybitConstants.HTTP_TESTNET_URL);
var accountInfo = await accountService.GetAccountBalance(accountType: AccountType.Unified, coin: "USDT");
Console.WriteLine(accountInfo);

Console.ReadLine();

}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading