From f7589d8200b11f40a4fabed37dfeae39eea319e4 Mon Sep 17 00:00:00 2001 From: alplabin <122352306+alplabin@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:26:36 +0900 Subject: [PATCH 1/3] Release v4.1.0 --- .github/ISSUE_TEMPLATE/bug.yaml | 3 +- .github/workflows/dist.yml | 3 +- CHANGELOG.md | 57 +++ .../BSwap/AddLiquidityPreview_Example.cs | 33 -- Examples/CSharp/BSwap/AddLiquidity_Example.cs | 33 -- Examples/CSharp/BSwap/ClaimRewards_Example.cs | 33 -- .../CSharp/BSwap/GetClaimedHistory_Example.cs | 33 -- .../GetLiquidityInformationOfAPool_Example.cs | 33 -- .../GetLiquidityOperationRecord_Example.cs | 33 -- .../CSharp/BSwap/GetSwapHistory_Example.cs | 33 -- .../GetUnclaimedRewardsRecord_Example.cs | 33 -- .../CSharp/BSwap/ListAllSwapPools_Example.cs | 33 -- .../CSharp/BSwap/PoolConfigure_Example.cs | 33 -- .../BSwap/RemoveLiquidityPreview_Example.cs | 33 -- .../CSharp/BSwap/RemoveLiquidity_Example.cs | 33 -- Examples/CSharp/BSwap/RequestQuote_Example.cs | 33 -- Examples/CSharp/BSwap/Swap_Example.cs | 33 -- Examples/CSharp/CSharp.csproj | 4 +- .../CrossMarginAccountTransfer_Example.cs | 33 -- ...le.cs => GetBorrowRepayRecords_Example.cs} | 6 +- ...etIsolatedMarginTransferHistory_Example.cs | 33 -- .../IsolatedMarginAccountTransfer_Example.cs | 33 -- ...cs => MarginAccountBorrowRepay_Example.cs} | 6 +- .../MarginAccountRepay_Example.cs | 33 -- .../QueryCrossMarginPair_Example.cs | 33 -- .../QueryIsolatedMarginSymbol_Example.cs | 33 -- .../QueryLoanRecord_Example.cs | 33 -- .../QueryMarginAsset_Example.cs | 33 -- .../QueryRepayRecord_Example.cs | 33 -- ...rsonalLeftQuotaOfStakingProduct_Example.cs | 33 -- .../Staking/GetStakingHistory_Example.cs | 33 -- .../Staking/GetStakingProductList_Example.cs | 33 -- .../GetStakingProductPosition_Example.cs | 33 -- .../Staking/PurchaseStakingProduct_Example.cs | 33 -- .../Staking/RedeemStakingProduct_Example.cs | 33 -- .../CSharp/Staking/SetAutoStaking_Example.cs | 33 -- .../AccountTrade/AccountInfo_Example.cs | 2 +- .../AccountOrderRateLimits_Example.cs | 2 +- .../AccountPreventedMatches_Example.cs | 2 +- .../AccountTrade/AccountTradeList_Example.cs | 2 +- .../AccountTrade/AllOcoOrders_Example.cs | 2 +- .../AccountTrade/AllOrders_Example.cs | 2 +- .../CancelAllOpenOrdersOnASymbol_Example.cs | 2 +- .../CancelAndReplaceOrder_Example.cs | 2 +- .../AccountTrade/CancelOcoOrder_Example.cs | 2 +- .../AccountTrade/CancelOrder_Example.cs | 2 +- .../CurrentOpenOcoOrders_Example.cs | 2 +- .../AccountTrade/CurrentOpenOrders_Example.cs | 2 +- .../AccountTrade/NewOcoOrder_Example.cs | 2 +- .../AccountTrade/NewOrder_Example.cs | 2 +- .../AccountTrade/QueryOcoOrder_Example.cs | 2 +- .../AccountTrade/QueryOrder_Example.cs | 2 +- .../AccountTrade/TestNewOrder_Example.cs | 2 +- .../UserDataStream/CloseListenKey_Example.cs | 2 +- .../UserDataStream/CreateListenKey_Example.cs | 2 +- .../UserDataStream/PingListenKey_Example.cs | 2 +- .../UserDataWebSocket_Example.cs | 2 +- .../BSwap/AddLiquidityPreview_Example.fs | 27 -- Examples/FSharp/BSwap/AddLiquidity_Example.fs | 27 -- Examples/FSharp/BSwap/ClaimRewards_Example.fs | 27 -- .../FSharp/BSwap/GetClaimedHistory_Example.fs | 27 -- .../GetLiquidityInformationOfAPool_Example.fs | 27 -- .../GetLiquidityOperationRecord_Example.fs | 27 -- .../FSharp/BSwap/GetSwapHistory_Example.fs | 27 -- .../GetUnclaimedRewardsRecord_Example.fs | 27 -- .../FSharp/BSwap/ListAllSwapPools_Example.fs | 27 -- .../FSharp/BSwap/PoolConfigure_Example.fs | 27 -- .../BSwap/RemoveLiquidityPreview_Example.fs | 27 -- .../FSharp/BSwap/RemoveLiquidity_Example.fs | 27 -- Examples/FSharp/BSwap/RequestQuote_Example.fs | 27 -- Examples/FSharp/BSwap/Swap_Example.fs | 27 -- Examples/FSharp/FSharp.fsproj | 4 +- .../CrossMarginAccountTransfer_Example.fs | 27 -- ...le.fs => GetBorrowRepayRecords_Example.fs} | 2 +- ...etIsolatedMarginTransferHistory_Example.fs | 27 -- .../IsolatedMarginAccountTransfer_Example.fs | 27 -- ...fs => MarginAccountBorrowRepay_Example.fs} | 2 +- .../MarginAccountBorrow_Example.fs | 27 -- .../MarginAccountRepay_Example.fs | 27 -- .../QueryCrossMarginPair_Example.fs | 27 -- .../QueryIsolatedMarginSymbol_Example.fs | 27 -- .../QueryLoanRecord_Example.fs | 27 -- .../QueryRepayRecord_Example.fs | 27 -- ...rsonalLeftQuotaOfStakingProduct_Example.fs | 27 -- .../Staking/GetStakingHistory_Example.fs | 27 -- .../Staking/GetStakingProductList_Example.fs | 27 -- .../GetStakingProductPosition_Example.fs | 27 -- .../Staking/PurchaseStakingProduct_Example.fs | 27 -- .../Staking/RedeemStakingProduct_Example.fs | 27 -- .../FSharp/Staking/SetAutoStaking_Example.fs | 27 -- .../AccountTrade/AccountInfo_Example.fs | 2 +- .../AccountOrderRateLimits_Example.fs | 2 +- .../AccountPreventedMatches_Example.fs | 2 +- .../AccountTrade/AccountTradeList_Example.fs | 2 +- .../AccountTrade/AllOcoOrders_Example.fs | 2 +- .../AccountTrade/AllOrders_Example.fs | 2 +- .../CancelAllOpenOrdersOnASymbol_Example.fs | 2 +- .../CancelAndReplaceOrder_Example.fs | 2 +- .../AccountTrade/CancelOcoOrder_Example.fs | 2 +- .../AccountTrade/CancelOrder_Example.fs | 2 +- .../CurrentOpenOcoOrders_Example.fs | 2 +- .../AccountTrade/CurrentOpenOrders_Example.fs | 2 +- .../AccountTrade/NewOcoOrder_Example.fs | 2 +- .../AccountTrade/NewOrder_Example.fs | 2 +- .../AccountTrade/QueryOcoOrder_Example.fs | 2 +- .../AccountTrade/QueryOrder_Example.fs | 2 +- .../AccountTrade/TestNewOrder_Example.fs | 2 +- .../UserDataStream/CloseListenKey_Example.fs | 2 +- .../UserDataStream/CreateListenKey_Example.fs | 2 +- .../UserDataStream/PingListenKey_Example.fs | 2 +- Src/Common/Common.csproj | 4 +- Src/Common/VersionInfo.cs | 2 +- Src/Spot/.nuspec | 2 +- Src/Spot/BSwap.cs | 431 ------------------ Src/Spot/MarginAccountTrade.cs | 344 ++------------ Src/Spot/Models/MarginBorrowRepayType.cs | 19 + Src/Spot/Staking.cs | 248 ---------- Tests/Common.Tests/Common.Tests.csproj | 2 +- Tests/Spot.Tests/BSwap_Tests.cs | 351 -------------- Tests/Spot.Tests/MarginAccountTrade_Tests.cs | 236 +--------- Tests/Spot.Tests/Staking_Tests.cs | 183 -------- 121 files changed, 193 insertions(+), 3598 deletions(-) delete mode 100644 Examples/CSharp/BSwap/AddLiquidityPreview_Example.cs delete mode 100644 Examples/CSharp/BSwap/AddLiquidity_Example.cs delete mode 100644 Examples/CSharp/BSwap/ClaimRewards_Example.cs delete mode 100644 Examples/CSharp/BSwap/GetClaimedHistory_Example.cs delete mode 100644 Examples/CSharp/BSwap/GetLiquidityInformationOfAPool_Example.cs delete mode 100644 Examples/CSharp/BSwap/GetLiquidityOperationRecord_Example.cs delete mode 100644 Examples/CSharp/BSwap/GetSwapHistory_Example.cs delete mode 100644 Examples/CSharp/BSwap/GetUnclaimedRewardsRecord_Example.cs delete mode 100644 Examples/CSharp/BSwap/ListAllSwapPools_Example.cs delete mode 100644 Examples/CSharp/BSwap/PoolConfigure_Example.cs delete mode 100644 Examples/CSharp/BSwap/RemoveLiquidityPreview_Example.cs delete mode 100644 Examples/CSharp/BSwap/RemoveLiquidity_Example.cs delete mode 100644 Examples/CSharp/BSwap/RequestQuote_Example.cs delete mode 100644 Examples/CSharp/BSwap/Swap_Example.cs delete mode 100644 Examples/CSharp/MarginAccountTrade/CrossMarginAccountTransfer_Example.cs rename Examples/CSharp/MarginAccountTrade/{MarginDustlog_Example.cs => GetBorrowRepayRecords_Example.cs} (78%) delete mode 100644 Examples/CSharp/MarginAccountTrade/GetIsolatedMarginTransferHistory_Example.cs delete mode 100644 Examples/CSharp/MarginAccountTrade/IsolatedMarginAccountTransfer_Example.cs rename Examples/CSharp/MarginAccountTrade/{MarginAccountBorrow_Example.cs => MarginAccountBorrowRepay_Example.cs} (86%) delete mode 100644 Examples/CSharp/MarginAccountTrade/MarginAccountRepay_Example.cs delete mode 100644 Examples/CSharp/MarginAccountTrade/QueryCrossMarginPair_Example.cs delete mode 100644 Examples/CSharp/MarginAccountTrade/QueryIsolatedMarginSymbol_Example.cs delete mode 100644 Examples/CSharp/MarginAccountTrade/QueryLoanRecord_Example.cs delete mode 100644 Examples/CSharp/MarginAccountTrade/QueryMarginAsset_Example.cs delete mode 100644 Examples/CSharp/MarginAccountTrade/QueryRepayRecord_Example.cs delete mode 100644 Examples/CSharp/Staking/GetPersonalLeftQuotaOfStakingProduct_Example.cs delete mode 100644 Examples/CSharp/Staking/GetStakingHistory_Example.cs delete mode 100644 Examples/CSharp/Staking/GetStakingProductList_Example.cs delete mode 100644 Examples/CSharp/Staking/GetStakingProductPosition_Example.cs delete mode 100644 Examples/CSharp/Staking/PurchaseStakingProduct_Example.cs delete mode 100644 Examples/CSharp/Staking/RedeemStakingProduct_Example.cs delete mode 100644 Examples/CSharp/Staking/SetAutoStaking_Example.cs delete mode 100644 Examples/FSharp/BSwap/AddLiquidityPreview_Example.fs delete mode 100644 Examples/FSharp/BSwap/AddLiquidity_Example.fs delete mode 100644 Examples/FSharp/BSwap/ClaimRewards_Example.fs delete mode 100644 Examples/FSharp/BSwap/GetClaimedHistory_Example.fs delete mode 100644 Examples/FSharp/BSwap/GetLiquidityInformationOfAPool_Example.fs delete mode 100644 Examples/FSharp/BSwap/GetLiquidityOperationRecord_Example.fs delete mode 100644 Examples/FSharp/BSwap/GetSwapHistory_Example.fs delete mode 100644 Examples/FSharp/BSwap/GetUnclaimedRewardsRecord_Example.fs delete mode 100644 Examples/FSharp/BSwap/ListAllSwapPools_Example.fs delete mode 100644 Examples/FSharp/BSwap/PoolConfigure_Example.fs delete mode 100644 Examples/FSharp/BSwap/RemoveLiquidityPreview_Example.fs delete mode 100644 Examples/FSharp/BSwap/RemoveLiquidity_Example.fs delete mode 100644 Examples/FSharp/BSwap/RequestQuote_Example.fs delete mode 100644 Examples/FSharp/BSwap/Swap_Example.fs delete mode 100644 Examples/FSharp/MarginAccountTrade/CrossMarginAccountTransfer_Example.fs rename Examples/FSharp/MarginAccountTrade/{MarginDustlog_Example.fs => GetBorrowRepayRecords_Example.fs} (83%) delete mode 100644 Examples/FSharp/MarginAccountTrade/GetIsolatedMarginTransferHistory_Example.fs delete mode 100644 Examples/FSharp/MarginAccountTrade/IsolatedMarginAccountTransfer_Example.fs rename Examples/FSharp/MarginAccountTrade/{QueryMarginAsset_Example.fs => MarginAccountBorrowRepay_Example.fs} (84%) delete mode 100644 Examples/FSharp/MarginAccountTrade/MarginAccountBorrow_Example.fs delete mode 100644 Examples/FSharp/MarginAccountTrade/MarginAccountRepay_Example.fs delete mode 100644 Examples/FSharp/MarginAccountTrade/QueryCrossMarginPair_Example.fs delete mode 100644 Examples/FSharp/MarginAccountTrade/QueryIsolatedMarginSymbol_Example.fs delete mode 100644 Examples/FSharp/MarginAccountTrade/QueryLoanRecord_Example.fs delete mode 100644 Examples/FSharp/MarginAccountTrade/QueryRepayRecord_Example.fs delete mode 100644 Examples/FSharp/Staking/GetPersonalLeftQuotaOfStakingProduct_Example.fs delete mode 100644 Examples/FSharp/Staking/GetStakingHistory_Example.fs delete mode 100644 Examples/FSharp/Staking/GetStakingProductList_Example.fs delete mode 100644 Examples/FSharp/Staking/GetStakingProductPosition_Example.fs delete mode 100644 Examples/FSharp/Staking/PurchaseStakingProduct_Example.fs delete mode 100644 Examples/FSharp/Staking/RedeemStakingProduct_Example.fs delete mode 100644 Examples/FSharp/Staking/SetAutoStaking_Example.fs delete mode 100644 Src/Spot/BSwap.cs create mode 100644 Src/Spot/Models/MarginBorrowRepayType.cs delete mode 100644 Src/Spot/Staking.cs delete mode 100644 Tests/Spot.Tests/BSwap_Tests.cs delete mode 100644 Tests/Spot.Tests/Staking_Tests.cs diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml index cc04f7b..4299165 100644 --- a/.github/ISSUE_TEMPLATE/bug.yaml +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -40,8 +40,9 @@ body: description: "What version of .NET are you running?" options: - .NET Core 3.1.x - - .NET Framework 5.0.x - .NET Framework 6.0.x + - .NET Framework 7.0.x + - .NET Framework 8.0.x - Other (specify in environment) validations: required: true diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 4d22808..8691a9f 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -15,12 +15,13 @@ jobs: operating-system: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v2 - - name: Setup .NET on 6.0.x, 7.0.x + - name: Setup .NET on 6.0.x, 7.0.x, 8.0.x uses: actions/setup-dotnet@v1 with: dotnet-version: | 6.0.x 7.0.x + 8.0.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a9723e..471bc46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,62 @@ # Changelog +## 4.1.0 - 2024-06-17 +### Added +- New endpoints for Margin: + - `POST /sapi/v1/margin/borrow-repay`: Margin account borrow/repay + - `GET /sapi/v1/margin/borrow-repay`: Query borrow/repay records in Margin account + +### Updated +- Updated dependencies versions: + - `Microsoft.Extensions.Logging` to `8.0.0` + - `Microsoft.Extensions.Logging.Console` to `8.0.0` + - `Microsoft.Extensions.Logging.Abstractions` to `8.0.1` + - `BouncyCastle.Cryptograph` to `2.3.1` +- Margin: + - `GET /sapi/v1/margin/transfer`: add parameter `isolatedSymbol` + - `GET /sapi/v1/margin/allAssets`: add parameter `asset` + - `GET /sapi/v1/margin/allPairs`: add parameter `symbol` + - `GET /sapi/v1/margin/isolated/allPairs`: add parameter `symbol` + +### Removed +- Bswap + - `GET /sapi/v1/bswap/pools` + - `GET /sapi/v1/bswap/liquidity` + - `POST /sapi/v1/bswap/liquidityAdd` + - `POST /sapi/v1/bswap/liquidityRemove` + - `GET /sapi/v1/bswap/liquidityOps` + - `GET /sapi/v1/bswap/quote` + - `POST /sapi/v1/bswap/swap` + - `GET /sapi/v1/bswap/swap` + - `GET /sapi/v1/bswap/poolConfigure` + - `GET /sapi/v1/bswap/addLiquidityPreview` + - `GET /sapi/v1/bswap/removeLiquidityPreview` + - `GET /sapi/v1/bswap/unclaimedRewards` + - `POST /sapi/v1/bswap/claimRewards` + - `GET /sapi/v1/bswap/claimedHistory` + +- Margin + - `GET /sapi/v1/margin/isolated/pair` + - `POST /sapi/v1/margin/isolated/transfer` + - `GET /sapi/v1/margin/isolated/transfer` + - `GET /sapi/v1/margin/asset` + - `POST /sapi/v1/margin/loan` + - `GET /sapi/v1/margin/dribblet` + - `GET /sapi/v1/margin/loan` + - `GET /sapi/v1/margin/pair` + - `POST /sapi/v1/margin/repay` + - `GET /sapi/v1/margin/repay` + - `POST /sapi/v1/margin/transfer` + +- Staking + - `GET /sapi/v1/staking/productList` + - `POST /sapi/v1/staking/purchase` + - `POST /sapi/v1/staking/redeem` + - `GET /sapi/v1/staking/position` + - `GET /sapi/v1/staking/stakingRecord` + - `POST /sapi/v1/staking/setAutoStaking` + - `GET /sapi/v1/staking/personalLeftQuota` + ## 4.0.1 - 2023-10-04 ### Updated diff --git a/Examples/CSharp/BSwap/AddLiquidityPreview_Example.cs b/Examples/CSharp/BSwap/AddLiquidityPreview_Example.cs deleted file mode 100644 index 5d80819..0000000 --- a/Examples/CSharp/BSwap/AddLiquidityPreview_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class AddLiquidityPreview_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.AddLiquidityPreview(2, "SINGLE", "USDT", 12415.2m); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/AddLiquidity_Example.cs b/Examples/CSharp/BSwap/AddLiquidity_Example.cs deleted file mode 100644 index 80171d4..0000000 --- a/Examples/CSharp/BSwap/AddLiquidity_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class AddLiquidity_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.AddLiquidity(2, "BTC", 12415.2m); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/ClaimRewards_Example.cs b/Examples/CSharp/BSwap/ClaimRewards_Example.cs deleted file mode 100644 index 23cf729..0000000 --- a/Examples/CSharp/BSwap/ClaimRewards_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class ClaimRewards_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.ClaimRewards(); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/GetClaimedHistory_Example.cs b/Examples/CSharp/BSwap/GetClaimedHistory_Example.cs deleted file mode 100644 index ca95048..0000000 --- a/Examples/CSharp/BSwap/GetClaimedHistory_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class GetClaimedHistory_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.GetClaimedHistory(); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/GetLiquidityInformationOfAPool_Example.cs b/Examples/CSharp/BSwap/GetLiquidityInformationOfAPool_Example.cs deleted file mode 100644 index 5d35cfc..0000000 --- a/Examples/CSharp/BSwap/GetLiquidityInformationOfAPool_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class GetLiquidityInformationOfAPool_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.GetLiquidityInformationOfAPool(); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/GetLiquidityOperationRecord_Example.cs b/Examples/CSharp/BSwap/GetLiquidityOperationRecord_Example.cs deleted file mode 100644 index c48133c..0000000 --- a/Examples/CSharp/BSwap/GetLiquidityOperationRecord_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class GetLiquidityOperationRecord_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.GetLiquidityOperationRecord(); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/GetSwapHistory_Example.cs b/Examples/CSharp/BSwap/GetSwapHistory_Example.cs deleted file mode 100644 index d4017d1..0000000 --- a/Examples/CSharp/BSwap/GetSwapHistory_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class GetSwapHistory_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.GetSwapHistory(); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/GetUnclaimedRewardsRecord_Example.cs b/Examples/CSharp/BSwap/GetUnclaimedRewardsRecord_Example.cs deleted file mode 100644 index 415688b..0000000 --- a/Examples/CSharp/BSwap/GetUnclaimedRewardsRecord_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class GetUnclaimedRewardsRecord_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.GetUnclaimedRewardsRecord(); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/ListAllSwapPools_Example.cs b/Examples/CSharp/BSwap/ListAllSwapPools_Example.cs deleted file mode 100644 index 30dea7e..0000000 --- a/Examples/CSharp/BSwap/ListAllSwapPools_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class ListAllSwapPools_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.ListAllSwapPools(); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/PoolConfigure_Example.cs b/Examples/CSharp/BSwap/PoolConfigure_Example.cs deleted file mode 100644 index fd9bbaa..0000000 --- a/Examples/CSharp/BSwap/PoolConfigure_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class PoolConfigure_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.PoolConfigure(); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/RemoveLiquidityPreview_Example.cs b/Examples/CSharp/BSwap/RemoveLiquidityPreview_Example.cs deleted file mode 100644 index 268179b..0000000 --- a/Examples/CSharp/BSwap/RemoveLiquidityPreview_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class RemoveLiquidityPreview_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.RemoveLiquidityPreview(2, "SINGLE", "USDT", 12415.2m); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/RemoveLiquidity_Example.cs b/Examples/CSharp/BSwap/RemoveLiquidity_Example.cs deleted file mode 100644 index 44bfc77..0000000 --- a/Examples/CSharp/BSwap/RemoveLiquidity_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class RemoveLiquidity_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.RemoveLiquidity(2, LiquidityRemovalType.SINGLE, 12415.2m); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/RequestQuote_Example.cs b/Examples/CSharp/BSwap/RequestQuote_Example.cs deleted file mode 100644 index b1337af..0000000 --- a/Examples/CSharp/BSwap/RequestQuote_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class RequestQuote_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.RequestQuote("USDT", "BUSD", 12415.2m); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/BSwap/Swap_Example.cs b/Examples/CSharp/BSwap/Swap_Example.cs deleted file mode 100644 index 0317d14..0000000 --- a/Examples/CSharp/BSwap/Swap_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.BSwapExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class Swap_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var bSwap = new BSwap(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await bSwap.Swap("USDT", "BUSD", 12415.2m); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/CSharp.csproj b/Examples/CSharp/CSharp.csproj index 54f5a41..d605ac9 100644 --- a/Examples/CSharp/CSharp.csproj +++ b/Examples/CSharp/CSharp.csproj @@ -18,8 +18,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Examples/CSharp/MarginAccountTrade/CrossMarginAccountTransfer_Example.cs b/Examples/CSharp/MarginAccountTrade/CrossMarginAccountTransfer_Example.cs deleted file mode 100644 index f73c1da..0000000 --- a/Examples/CSharp/MarginAccountTrade/CrossMarginAccountTransfer_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.MarginAccountTradeExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class CrossMarginAccountTransfer_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await marginAccountTrade.CrossMarginAccountTransfer("BTC", 1.01m, MarginTransferType.SPOT_TO_MARGIN); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/MarginAccountTrade/MarginDustlog_Example.cs b/Examples/CSharp/MarginAccountTrade/GetBorrowRepayRecords_Example.cs similarity index 78% rename from Examples/CSharp/MarginAccountTrade/MarginDustlog_Example.cs rename to Examples/CSharp/MarginAccountTrade/GetBorrowRepayRecords_Example.cs index 48ee97b..fe8ec52 100644 --- a/Examples/CSharp/MarginAccountTrade/MarginDustlog_Example.cs +++ b/Examples/CSharp/MarginAccountTrade/GetBorrowRepayRecords_Example.cs @@ -9,7 +9,7 @@ namespace Binance.Spot.MarginAccountTradeExamples using Binance.Spot.Models; using Microsoft.Extensions.Logging; - public class MarginDustlog_Example + public class GetBorrowRepayRecords_Example { public static async Task Main(string[] args) { @@ -17,7 +17,7 @@ public static async Task Main(string[] args) { builder.AddConsole(); }); - ILogger logger = loggerFactory.CreateLogger(); + ILogger logger = loggerFactory.CreateLogger(); HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); HttpClient httpClient = new HttpClient(handler: loggingHandler); @@ -27,7 +27,7 @@ public static async Task Main(string[] args) var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - var result = await marginAccountTrade.MarginDustlog(); + var result = await marginAccountTrade.GetBorrowRepayRecords(MarginBorrowRepayType.BORROW); } } } \ No newline at end of file diff --git a/Examples/CSharp/MarginAccountTrade/GetIsolatedMarginTransferHistory_Example.cs b/Examples/CSharp/MarginAccountTrade/GetIsolatedMarginTransferHistory_Example.cs deleted file mode 100644 index fbcf47f..0000000 --- a/Examples/CSharp/MarginAccountTrade/GetIsolatedMarginTransferHistory_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.MarginAccountTradeExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class GetIsolatedMarginTransferHistory_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await marginAccountTrade.GetIsolatedMarginTransferHistory("BNBUSDT"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/MarginAccountTrade/IsolatedMarginAccountTransfer_Example.cs b/Examples/CSharp/MarginAccountTrade/IsolatedMarginAccountTransfer_Example.cs deleted file mode 100644 index bb6f017..0000000 --- a/Examples/CSharp/MarginAccountTrade/IsolatedMarginAccountTransfer_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.MarginAccountTradeExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class IsolatedMarginAccountTransfer_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await marginAccountTrade.IsolatedMarginAccountTransfer("BTC", "BNBUSDT", IsolatedMarginAccountTransferType.SPOT, IsolatedMarginAccountTransferType.ISOLATED_MARGIN, 1.01m); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/MarginAccountTrade/MarginAccountBorrow_Example.cs b/Examples/CSharp/MarginAccountTrade/MarginAccountBorrowRepay_Example.cs similarity index 86% rename from Examples/CSharp/MarginAccountTrade/MarginAccountBorrow_Example.cs rename to Examples/CSharp/MarginAccountTrade/MarginAccountBorrowRepay_Example.cs index b6743b2..986c2db 100644 --- a/Examples/CSharp/MarginAccountTrade/MarginAccountBorrow_Example.cs +++ b/Examples/CSharp/MarginAccountTrade/MarginAccountBorrowRepay_Example.cs @@ -9,7 +9,7 @@ namespace Binance.Spot.MarginAccountTradeExamples using Binance.Spot.Models; using Microsoft.Extensions.Logging; - public class MarginAccountBorrow_Example + public class MarginAccountBorrowRepay_Example { public static async Task Main(string[] args) { @@ -17,7 +17,7 @@ public static async Task Main(string[] args) { builder.AddConsole(); }); - ILogger logger = loggerFactory.CreateLogger(); + ILogger logger = loggerFactory.CreateLogger(); HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); HttpClient httpClient = new HttpClient(handler: loggingHandler); @@ -27,7 +27,7 @@ public static async Task Main(string[] args) var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - var result = await marginAccountTrade.MarginAccountBorrow("BTC", 1.01m); + var result = await marginAccountTrade.MarginAccountBorrowRepay("BNB", "TRUE", "BNBUSDT", "1.0", MarginBorrowRepayType.BORROW); } } } \ No newline at end of file diff --git a/Examples/CSharp/MarginAccountTrade/MarginAccountRepay_Example.cs b/Examples/CSharp/MarginAccountTrade/MarginAccountRepay_Example.cs deleted file mode 100644 index 1096e2c..0000000 --- a/Examples/CSharp/MarginAccountTrade/MarginAccountRepay_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.MarginAccountTradeExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class MarginAccountRepay_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await marginAccountTrade.MarginAccountRepay("BTC", 1.01m); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/MarginAccountTrade/QueryCrossMarginPair_Example.cs b/Examples/CSharp/MarginAccountTrade/QueryCrossMarginPair_Example.cs deleted file mode 100644 index 4b3a177..0000000 --- a/Examples/CSharp/MarginAccountTrade/QueryCrossMarginPair_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.MarginAccountTradeExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class QueryCrossMarginPair_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await marginAccountTrade.QueryCrossMarginPair("BNBUSDT"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/MarginAccountTrade/QueryIsolatedMarginSymbol_Example.cs b/Examples/CSharp/MarginAccountTrade/QueryIsolatedMarginSymbol_Example.cs deleted file mode 100644 index 86c53bf..0000000 --- a/Examples/CSharp/MarginAccountTrade/QueryIsolatedMarginSymbol_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.MarginAccountTradeExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class QueryIsolatedMarginSymbol_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await marginAccountTrade.QueryIsolatedMarginSymbol("BNBUSDT"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/MarginAccountTrade/QueryLoanRecord_Example.cs b/Examples/CSharp/MarginAccountTrade/QueryLoanRecord_Example.cs deleted file mode 100644 index 45cbb10..0000000 --- a/Examples/CSharp/MarginAccountTrade/QueryLoanRecord_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.MarginAccountTradeExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class QueryLoanRecord_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await marginAccountTrade.QueryLoanRecord("BTC"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/MarginAccountTrade/QueryMarginAsset_Example.cs b/Examples/CSharp/MarginAccountTrade/QueryMarginAsset_Example.cs deleted file mode 100644 index de8ef6a..0000000 --- a/Examples/CSharp/MarginAccountTrade/QueryMarginAsset_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.MarginAccountTradeExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class QueryMarginAsset_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await marginAccountTrade.QueryMarginAsset("BTC"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/MarginAccountTrade/QueryRepayRecord_Example.cs b/Examples/CSharp/MarginAccountTrade/QueryRepayRecord_Example.cs deleted file mode 100644 index d05c118..0000000 --- a/Examples/CSharp/MarginAccountTrade/QueryRepayRecord_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.MarginAccountTradeExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class QueryRepayRecord_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var marginAccountTrade = new MarginAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await marginAccountTrade.QueryRepayRecord("BTC"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/Staking/GetPersonalLeftQuotaOfStakingProduct_Example.cs b/Examples/CSharp/Staking/GetPersonalLeftQuotaOfStakingProduct_Example.cs deleted file mode 100644 index e510fb2..0000000 --- a/Examples/CSharp/Staking/GetPersonalLeftQuotaOfStakingProduct_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.StakingExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class GetPersonalLeftQuotaOfStakingProduct_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var staking = new Staking(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await staking.GetPersonalLeftQuotaOfStakingProduct("STAKING", "Axs*90"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/Staking/GetStakingHistory_Example.cs b/Examples/CSharp/Staking/GetStakingHistory_Example.cs deleted file mode 100644 index b18ac79..0000000 --- a/Examples/CSharp/Staking/GetStakingHistory_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.StakingExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class GetStakingHistory_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var staking = new Staking(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await staking.GetStakingHistory("STAKING", "SUBSCRIPTION"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/Staking/GetStakingProductList_Example.cs b/Examples/CSharp/Staking/GetStakingProductList_Example.cs deleted file mode 100644 index b9394a2..0000000 --- a/Examples/CSharp/Staking/GetStakingProductList_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.StakingExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class GetStakingProductList_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var staking = new Staking(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await staking.GetStakingProductList("STAKING"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/Staking/GetStakingProductPosition_Example.cs b/Examples/CSharp/Staking/GetStakingProductPosition_Example.cs deleted file mode 100644 index d136441..0000000 --- a/Examples/CSharp/Staking/GetStakingProductPosition_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.StakingExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class GetStakingProductPosition_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var staking = new Staking(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await staking.GetStakingProductPosition("STAKING"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/Staking/PurchaseStakingProduct_Example.cs b/Examples/CSharp/Staking/PurchaseStakingProduct_Example.cs deleted file mode 100644 index 6aa51f7..0000000 --- a/Examples/CSharp/Staking/PurchaseStakingProduct_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.StakingExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class PurchaseStakingProduct_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var staking = new Staking(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await staking.PurchaseStakingProduct("STAKING", "Axs*90", 10.1m); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/Staking/RedeemStakingProduct_Example.cs b/Examples/CSharp/Staking/RedeemStakingProduct_Example.cs deleted file mode 100644 index 7b23f42..0000000 --- a/Examples/CSharp/Staking/RedeemStakingProduct_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.StakingExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class RedeemStakingProduct_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var staking = new Staking(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await staking.RedeemStakingProduct("STAKING", "Axs*90"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/Staking/SetAutoStaking_Example.cs b/Examples/CSharp/Staking/SetAutoStaking_Example.cs deleted file mode 100644 index a19674c..0000000 --- a/Examples/CSharp/Staking/SetAutoStaking_Example.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Binance.Spot.StakingExamples -{ - using System; - using System.Net; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot; - using Binance.Spot.Models; - using Microsoft.Extensions.Logging; - - public class SetAutoStaking_Example - { - public static async Task Main(string[] args) - { - using var loggerFactory = LoggerFactory.Create(builder => - { - builder.AddConsole(); - }); - ILogger logger = loggerFactory.CreateLogger(); - - HttpMessageHandler loggingHandler = new BinanceLoggingHandler(logger: logger); - HttpClient httpClient = new HttpClient(handler: loggingHandler); - - string apiKey = "api-key"; - string apiSecret = "api-secret"; - - var staking = new Staking(httpClient, apiKey: apiKey, apiSecret: apiSecret); - - var result = await staking.SetAutoStaking("STAKING", "1234", "true"); - } - } -} \ No newline at end of file diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/AccountInfo_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/AccountInfo_Example.cs index 56af88c..20bee30 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/AccountInfo_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/AccountInfo_Example.cs @@ -18,7 +18,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string privateKey = File.ReadAllText("/Users/john/ssl/Private_key.pem"); - var websocket = new WebSocketApi(baseUrl: "wss://testnet.binance.vision/ws-api/v3", apiKey: "apiKey", signatureService: new BinanceRsa(privateKey)); + var websocket = new WebSocketApi(baseUrl: "wss://ws-api.testnet.binance.vision/ws-api/v3", apiKey: "apiKey", signatureService: new BinanceRsa(privateKey)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/AccountOrderRateLimits_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/AccountOrderRateLimits_Example.cs index c259243..a4db347 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/AccountOrderRateLimits_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/AccountOrderRateLimits_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/AccountPreventedMatches_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/AccountPreventedMatches_Example.cs index 357b2e2..db18033 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/AccountPreventedMatches_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/AccountPreventedMatches_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/AccountTradeList_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/AccountTradeList_Example.cs index a111a35..77fddcb 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/AccountTradeList_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/AccountTradeList_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/AllOcoOrders_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/AllOcoOrders_Example.cs index 4f924f2..e729494 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/AllOcoOrders_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/AllOcoOrders_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/AllOrders_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/AllOrders_Example.cs index ad8a6d0..2acaf5c 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/AllOrders_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/AllOrders_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/CancelAllOpenOrdersOnASymbol_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/CancelAllOpenOrdersOnASymbol_Example.cs index eddeeb7..b5def05 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/CancelAllOpenOrdersOnASymbol_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/CancelAllOpenOrdersOnASymbol_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/CancelAndReplaceOrder_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/CancelAndReplaceOrder_Example.cs index 01ea634..9f0ad12 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/CancelAndReplaceOrder_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/CancelAndReplaceOrder_Example.cs @@ -18,7 +18,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/CancelOcoOrder_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/CancelOcoOrder_Example.cs index 385ff3c..db62ee0 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/CancelOcoOrder_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/CancelOcoOrder_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/CancelOrder_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/CancelOrder_Example.cs index 14be77f..402c677 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/CancelOrder_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/CancelOrder_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/CurrentOpenOcoOrders_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/CurrentOpenOcoOrders_Example.cs index 5651785..b53dca0 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/CurrentOpenOcoOrders_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/CurrentOpenOcoOrders_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/CurrentOpenOrders_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/CurrentOpenOrders_Example.cs index 790f48b..dd39372 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/CurrentOpenOrders_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/CurrentOpenOrders_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/NewOcoOrder_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/NewOcoOrder_Example.cs index 867221b..0a29f91 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/NewOcoOrder_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/NewOcoOrder_Example.cs @@ -18,7 +18,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/NewOrder_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/NewOrder_Example.cs index 10fa501..3d4fe94 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/NewOrder_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/NewOrder_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/QueryOcoOrder_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/QueryOcoOrder_Example.cs index c906629..437e837 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/QueryOcoOrder_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/QueryOcoOrder_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/QueryOrder_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/QueryOrder_Example.cs index 8923923..670d7e6 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/QueryOrder_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/QueryOrder_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/AccountTrade/TestNewOrder_Example.cs b/Examples/CSharp/WebSocketApi/AccountTrade/TestNewOrder_Example.cs index a0338fa..63c3baf 100644 --- a/Examples/CSharp/WebSocketApi/AccountTrade/TestNewOrder_Example.cs +++ b/Examples/CSharp/WebSocketApi/AccountTrade/TestNewOrder_Example.cs @@ -17,7 +17,7 @@ public static async Task Main(string[] args) ILogger logger = loggerFactory.CreateLogger(); string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); websocket.OnMessageReceived( async (data) => diff --git a/Examples/CSharp/WebSocketApi/UserDataStream/CloseListenKey_Example.cs b/Examples/CSharp/WebSocketApi/UserDataStream/CloseListenKey_Example.cs index 236255e..cb9a986 100644 --- a/Examples/CSharp/WebSocketApi/UserDataStream/CloseListenKey_Example.cs +++ b/Examples/CSharp/WebSocketApi/UserDataStream/CloseListenKey_Example.cs @@ -19,7 +19,7 @@ public static async Task Main(string[] args) // Create WebSocket API string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); // Receive WebSocket API Response websocket.OnMessageReceived( diff --git a/Examples/CSharp/WebSocketApi/UserDataStream/CreateListenKey_Example.cs b/Examples/CSharp/WebSocketApi/UserDataStream/CreateListenKey_Example.cs index fdae080..97cb88c 100644 --- a/Examples/CSharp/WebSocketApi/UserDataStream/CreateListenKey_Example.cs +++ b/Examples/CSharp/WebSocketApi/UserDataStream/CreateListenKey_Example.cs @@ -19,7 +19,7 @@ public static async Task Main(string[] args) // Create WebSocket API string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); // Receive WebSocket API Response websocket.OnMessageReceived( diff --git a/Examples/CSharp/WebSocketApi/UserDataStream/PingListenKey_Example.cs b/Examples/CSharp/WebSocketApi/UserDataStream/PingListenKey_Example.cs index c778319..8df5a89 100644 --- a/Examples/CSharp/WebSocketApi/UserDataStream/PingListenKey_Example.cs +++ b/Examples/CSharp/WebSocketApi/UserDataStream/PingListenKey_Example.cs @@ -19,7 +19,7 @@ public static async Task Main(string[] args) // Create WebSocket API string apiSecret = "apiSecret"; - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac(apiSecret)); // Receive WebSocket API Response websocket.OnMessageReceived( diff --git a/Examples/CSharp/WebSocketStream/UserDataWebSocket_Example.cs b/Examples/CSharp/WebSocketStream/UserDataWebSocket_Example.cs index 3dcc25a..224f653 100644 --- a/Examples/CSharp/WebSocketStream/UserDataWebSocket_Example.cs +++ b/Examples/CSharp/WebSocketStream/UserDataWebSocket_Example.cs @@ -33,7 +33,7 @@ public static async Task Main(string[] args) string listenKey = JsonConvert.DeserializeObject(response).listenKey.ToString(); // Subscribe to user data stream - var websocket = new UserDataWebSocket(listenKey, "wss://testnet.binance.vision"); + var websocket = new UserDataWebSocket(listenKey, "wss://stream.testnet.binance.vision"); var onlyOneMessage = new TaskCompletionSource(); websocket.OnMessageReceived( diff --git a/Examples/FSharp/BSwap/AddLiquidityPreview_Example.fs b/Examples/FSharp/BSwap/AddLiquidityPreview_Example.fs deleted file mode 100644 index ec51e52..0000000 --- a/Examples/FSharp/BSwap/AddLiquidityPreview_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.AddLiquidityPreview(2, "SINGLE", "USDT", 12415.2m) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/AddLiquidity_Example.fs b/Examples/FSharp/BSwap/AddLiquidity_Example.fs deleted file mode 100644 index 01497e2..0000000 --- a/Examples/FSharp/BSwap/AddLiquidity_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.AddLiquidity(2, "BTC", 12415.2m) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/ClaimRewards_Example.fs b/Examples/FSharp/BSwap/ClaimRewards_Example.fs deleted file mode 100644 index 1ad62ea..0000000 --- a/Examples/FSharp/BSwap/ClaimRewards_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.ClaimRewards() |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/GetClaimedHistory_Example.fs b/Examples/FSharp/BSwap/GetClaimedHistory_Example.fs deleted file mode 100644 index c14db9b..0000000 --- a/Examples/FSharp/BSwap/GetClaimedHistory_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.GetClaimedHistory() |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/GetLiquidityInformationOfAPool_Example.fs b/Examples/FSharp/BSwap/GetLiquidityInformationOfAPool_Example.fs deleted file mode 100644 index 9da62e8..0000000 --- a/Examples/FSharp/BSwap/GetLiquidityInformationOfAPool_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.GetLiquidityInformationOfAPool() |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/GetLiquidityOperationRecord_Example.fs b/Examples/FSharp/BSwap/GetLiquidityOperationRecord_Example.fs deleted file mode 100644 index 5310203..0000000 --- a/Examples/FSharp/BSwap/GetLiquidityOperationRecord_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.GetLiquidityOperationRecord() |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/GetSwapHistory_Example.fs b/Examples/FSharp/BSwap/GetSwapHistory_Example.fs deleted file mode 100644 index 5a41b37..0000000 --- a/Examples/FSharp/BSwap/GetSwapHistory_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.GetSwapHistory() |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/GetUnclaimedRewardsRecord_Example.fs b/Examples/FSharp/BSwap/GetUnclaimedRewardsRecord_Example.fs deleted file mode 100644 index 56dcd2b..0000000 --- a/Examples/FSharp/BSwap/GetUnclaimedRewardsRecord_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.GetUnclaimedRewardsRecord() |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/ListAllSwapPools_Example.fs b/Examples/FSharp/BSwap/ListAllSwapPools_Example.fs deleted file mode 100644 index 987e1b5..0000000 --- a/Examples/FSharp/BSwap/ListAllSwapPools_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.ListAllSwapPools() |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/PoolConfigure_Example.fs b/Examples/FSharp/BSwap/PoolConfigure_Example.fs deleted file mode 100644 index 20ad848..0000000 --- a/Examples/FSharp/BSwap/PoolConfigure_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.PoolConfigure() |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/RemoveLiquidityPreview_Example.fs b/Examples/FSharp/BSwap/RemoveLiquidityPreview_Example.fs deleted file mode 100644 index b587227..0000000 --- a/Examples/FSharp/BSwap/RemoveLiquidityPreview_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.RemoveLiquidityPreview(2, "SINGLE", "USDT", 12415.2m) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/RemoveLiquidity_Example.fs b/Examples/FSharp/BSwap/RemoveLiquidity_Example.fs deleted file mode 100644 index 44452f4..0000000 --- a/Examples/FSharp/BSwap/RemoveLiquidity_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.RemoveLiquidity(2, LiquidityRemovalType.SINGLE, 12415.2m) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/RequestQuote_Example.fs b/Examples/FSharp/BSwap/RequestQuote_Example.fs deleted file mode 100644 index c40e765..0000000 --- a/Examples/FSharp/BSwap/RequestQuote_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.RequestQuote("USDT", "BUSD", 12415.2m) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/BSwap/Swap_Example.fs b/Examples/FSharp/BSwap/Swap_Example.fs deleted file mode 100644 index 4fc3f3f..0000000 --- a/Examples/FSharp/BSwap/Swap_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let bSwap = new BSwap(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = bSwap.Swap("USDT", "BUSD", 12415.2m) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/FSharp.fsproj b/Examples/FSharp/FSharp.fsproj index dcc5b34..2597512 100644 --- a/Examples/FSharp/FSharp.fsproj +++ b/Examples/FSharp/FSharp.fsproj @@ -23,8 +23,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Examples/FSharp/MarginAccountTrade/CrossMarginAccountTransfer_Example.fs b/Examples/FSharp/MarginAccountTrade/CrossMarginAccountTransfer_Example.fs deleted file mode 100644 index 0922f2c..0000000 --- a/Examples/FSharp/MarginAccountTrade/CrossMarginAccountTransfer_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = marginAccountTrade.CrossMarginAccountTransfer("BTC", 1.01m, MarginTransferType.SPOT_TO_MARGIN) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/MarginAccountTrade/MarginDustlog_Example.fs b/Examples/FSharp/MarginAccountTrade/GetBorrowRepayRecords_Example.fs similarity index 83% rename from Examples/FSharp/MarginAccountTrade/MarginDustlog_Example.fs rename to Examples/FSharp/MarginAccountTrade/GetBorrowRepayRecords_Example.fs index 959bd26..3c72c70 100644 --- a/Examples/FSharp/MarginAccountTrade/MarginDustlog_Example.fs +++ b/Examples/FSharp/MarginAccountTrade/GetBorrowRepayRecords_Example.fs @@ -22,6 +22,6 @@ let main argv = let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - let result = marginAccountTrade.MarginDustlog() |> Async.AwaitTask |> Async.RunSynchronously + let result = marginAccountTrade.GetBorrowRepayRecords(MarginBorrowRepayType.BORROW) |> Async.AwaitTask |> Async.RunSynchronously 0 diff --git a/Examples/FSharp/MarginAccountTrade/GetIsolatedMarginTransferHistory_Example.fs b/Examples/FSharp/MarginAccountTrade/GetIsolatedMarginTransferHistory_Example.fs deleted file mode 100644 index c04363a..0000000 --- a/Examples/FSharp/MarginAccountTrade/GetIsolatedMarginTransferHistory_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = marginAccountTrade.GetIsolatedMarginTransferHistory("BNBUSDT") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/MarginAccountTrade/IsolatedMarginAccountTransfer_Example.fs b/Examples/FSharp/MarginAccountTrade/IsolatedMarginAccountTransfer_Example.fs deleted file mode 100644 index 55cc6c3..0000000 --- a/Examples/FSharp/MarginAccountTrade/IsolatedMarginAccountTransfer_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = marginAccountTrade.IsolatedMarginAccountTransfer("BTC", "BNBUSDT", IsolatedMarginAccountTransferType.SPOT, IsolatedMarginAccountTransferType.ISOLATED_MARGIN, 1.01m) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/MarginAccountTrade/QueryMarginAsset_Example.fs b/Examples/FSharp/MarginAccountTrade/MarginAccountBorrowRepay_Example.fs similarity index 84% rename from Examples/FSharp/MarginAccountTrade/QueryMarginAsset_Example.fs rename to Examples/FSharp/MarginAccountTrade/MarginAccountBorrowRepay_Example.fs index b37ab16..6ed9438 100644 --- a/Examples/FSharp/MarginAccountTrade/QueryMarginAsset_Example.fs +++ b/Examples/FSharp/MarginAccountTrade/MarginAccountBorrowRepay_Example.fs @@ -22,6 +22,6 @@ let main argv = let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - let result = marginAccountTrade.QueryMarginAsset("BTC") |> Async.AwaitTask |> Async.RunSynchronously + let result = marginAccountTrade.MarginAccountBorrowRepay("BNB", "TRUE", "BNBUSDT", "1.0", MarginBorrowRepayType.BORROW) |> Async.AwaitTask |> Async.RunSynchronously 0 diff --git a/Examples/FSharp/MarginAccountTrade/MarginAccountBorrow_Example.fs b/Examples/FSharp/MarginAccountTrade/MarginAccountBorrow_Example.fs deleted file mode 100644 index bb9091c..0000000 --- a/Examples/FSharp/MarginAccountTrade/MarginAccountBorrow_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = marginAccountTrade.MarginAccountBorrow("BTC", 1.01m) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/MarginAccountTrade/MarginAccountRepay_Example.fs b/Examples/FSharp/MarginAccountTrade/MarginAccountRepay_Example.fs deleted file mode 100644 index 44b4e52..0000000 --- a/Examples/FSharp/MarginAccountTrade/MarginAccountRepay_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = marginAccountTrade.MarginAccountRepay("BTC", 1.01m) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/MarginAccountTrade/QueryCrossMarginPair_Example.fs b/Examples/FSharp/MarginAccountTrade/QueryCrossMarginPair_Example.fs deleted file mode 100644 index 346365d..0000000 --- a/Examples/FSharp/MarginAccountTrade/QueryCrossMarginPair_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = marginAccountTrade.QueryCrossMarginPair("BNBUSDT") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/MarginAccountTrade/QueryIsolatedMarginSymbol_Example.fs b/Examples/FSharp/MarginAccountTrade/QueryIsolatedMarginSymbol_Example.fs deleted file mode 100644 index 47616b2..0000000 --- a/Examples/FSharp/MarginAccountTrade/QueryIsolatedMarginSymbol_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = marginAccountTrade.QueryIsolatedMarginSymbol("BNBUSDT") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/MarginAccountTrade/QueryLoanRecord_Example.fs b/Examples/FSharp/MarginAccountTrade/QueryLoanRecord_Example.fs deleted file mode 100644 index 4fd670d..0000000 --- a/Examples/FSharp/MarginAccountTrade/QueryLoanRecord_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = marginAccountTrade.QueryLoanRecord("BTC") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/MarginAccountTrade/QueryRepayRecord_Example.fs b/Examples/FSharp/MarginAccountTrade/QueryRepayRecord_Example.fs deleted file mode 100644 index c9793db..0000000 --- a/Examples/FSharp/MarginAccountTrade/QueryRepayRecord_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let marginAccountTrade = new MarginAccountTrade(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = marginAccountTrade.QueryRepayRecord("BTC") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/Staking/GetPersonalLeftQuotaOfStakingProduct_Example.fs b/Examples/FSharp/Staking/GetPersonalLeftQuotaOfStakingProduct_Example.fs deleted file mode 100644 index 00427c1..0000000 --- a/Examples/FSharp/Staking/GetPersonalLeftQuotaOfStakingProduct_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let staking = new Staking(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = staking.GetPersonalLeftQuotaOfStakingProduct("STAKING", "Axs*90") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/Staking/GetStakingHistory_Example.fs b/Examples/FSharp/Staking/GetStakingHistory_Example.fs deleted file mode 100644 index 5de984b..0000000 --- a/Examples/FSharp/Staking/GetStakingHistory_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let staking = new Staking(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = staking.GetStakingHistory("STAKING", "SUBSCRIPTION") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/Staking/GetStakingProductList_Example.fs b/Examples/FSharp/Staking/GetStakingProductList_Example.fs deleted file mode 100644 index 88366dc..0000000 --- a/Examples/FSharp/Staking/GetStakingProductList_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let staking = new Staking(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = staking.GetStakingProductList("STAKING") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/Staking/GetStakingProductPosition_Example.fs b/Examples/FSharp/Staking/GetStakingProductPosition_Example.fs deleted file mode 100644 index 87a1d0e..0000000 --- a/Examples/FSharp/Staking/GetStakingProductPosition_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let staking = new Staking(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = staking.GetStakingProductPosition("STAKING") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/Staking/PurchaseStakingProduct_Example.fs b/Examples/FSharp/Staking/PurchaseStakingProduct_Example.fs deleted file mode 100644 index 72e9ade..0000000 --- a/Examples/FSharp/Staking/PurchaseStakingProduct_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let staking = new Staking(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = staking.PurchaseStakingProduct("STAKING", "Axs*90", 10.1m) |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/Staking/RedeemStakingProduct_Example.fs b/Examples/FSharp/Staking/RedeemStakingProduct_Example.fs deleted file mode 100644 index eaf1d5a..0000000 --- a/Examples/FSharp/Staking/RedeemStakingProduct_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let staking = new Staking(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = staking.RedeemStakingProduct("STAKING", "Axs*90") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/Staking/SetAutoStaking_Example.fs b/Examples/FSharp/Staking/SetAutoStaking_Example.fs deleted file mode 100644 index 1f166a7..0000000 --- a/Examples/FSharp/Staking/SetAutoStaking_Example.fs +++ /dev/null @@ -1,27 +0,0 @@ -open System -open System.Net -open System.Net.Http -open System.Threading.Tasks -open Microsoft.Extensions.Logging -open Binance.Common -open Binance.Spot -open Binance.Spot.Models - -[] -let main argv = - let loggerFactory = LoggerFactory.Create(fun (builder:ILoggingBuilder) -> - builder.AddConsole() |> ignore - ) - let logger = loggerFactory.CreateLogger() - - let loggingHandler = new BinanceLoggingHandler(logger) - let httpClient = new HttpClient(loggingHandler) - - let apiKey = "api-key"; - let apiSecret = "api-secret"; - - let staking = new Staking(httpClient, apiKey = apiKey, apiSecret = apiSecret) - - let result = staking.SetAutoStaking("STAKING", "1234", "true") |> Async.AwaitTask |> Async.RunSynchronously - - 0 diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/AccountInfo_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/AccountInfo_Example.fs index 6b41770..5eccf02 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/AccountInfo_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/AccountInfo_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/AccountOrderRateLimits_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/AccountOrderRateLimits_Example.fs index b06feff..1b5d593 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/AccountOrderRateLimits_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/AccountOrderRateLimits_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/AccountPreventedMatches_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/AccountPreventedMatches_Example.fs index f4115d6..501703d 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/AccountPreventedMatches_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/AccountPreventedMatches_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/AccountTradeList_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/AccountTradeList_Example.fs index af336e4..92b2588 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/AccountTradeList_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/AccountTradeList_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/AllOcoOrders_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/AllOcoOrders_Example.fs index a67e520..f9c8db2 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/AllOcoOrders_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/AllOcoOrders_Example.fs @@ -20,7 +20,7 @@ let main argv = let privateKey = File.ReadAllText("/Users/john/ssl/Private_key.pem"); - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceRsa(privateKey)); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceRsa(privateKey)); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/AllOrders_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/AllOrders_Example.fs index dc46c08..b467a31 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/AllOrders_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/AllOrders_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/CancelAllOpenOrdersOnASymbol_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/CancelAllOpenOrdersOnASymbol_Example.fs index f8e153b..0cfe4b7 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/CancelAllOpenOrdersOnASymbol_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/CancelAllOpenOrdersOnASymbol_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/CancelAndReplaceOrder_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/CancelAndReplaceOrder_Example.fs index d504661..3c5a3e0 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/CancelAndReplaceOrder_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/CancelAndReplaceOrder_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/CancelOcoOrder_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/CancelOcoOrder_Example.fs index af4104e..cd830d0 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/CancelOcoOrder_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/CancelOcoOrder_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/CancelOrder_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/CancelOrder_Example.fs index 4971a1d..a929717 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/CancelOrder_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/CancelOrder_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/CurrentOpenOcoOrders_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/CurrentOpenOcoOrders_Example.fs index 7941626..0e6ad20 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/CurrentOpenOcoOrders_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/CurrentOpenOcoOrders_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/CurrentOpenOrders_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/CurrentOpenOrders_Example.fs index 1c45a6e..f0718a8 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/CurrentOpenOrders_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/CurrentOpenOrders_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/NewOcoOrder_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/NewOcoOrder_Example.fs index 0df18a7..49ba795 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/NewOcoOrder_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/NewOcoOrder_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/NewOrder_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/NewOrder_Example.fs index 2da3010..1ab48b2 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/NewOrder_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/NewOrder_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/QueryOcoOrder_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/QueryOcoOrder_Example.fs index abd81c3..808f926 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/QueryOcoOrder_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/QueryOcoOrder_Example.fs @@ -16,7 +16,7 @@ let main argv = builder.AddConsole() |> ignore ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/QueryOrder_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/QueryOrder_Example.fs index cf14175..ab8a0aa 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/QueryOrder_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/QueryOrder_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/AccountTrade/TestNewOrder_Example.fs b/Examples/FSharp/WebSocketApi/AccountTrade/TestNewOrder_Example.fs index 50d13b4..50ff885 100644 --- a/Examples/FSharp/WebSocketApi/AccountTrade/TestNewOrder_Example.fs +++ b/Examples/FSharp/WebSocketApi/AccountTrade/TestNewOrder_Example.fs @@ -17,7 +17,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/UserDataStream/CloseListenKey_Example.fs b/Examples/FSharp/WebSocketApi/UserDataStream/CloseListenKey_Example.fs index 1bf188b..cdfac54 100644 --- a/Examples/FSharp/WebSocketApi/UserDataStream/CloseListenKey_Example.fs +++ b/Examples/FSharp/WebSocketApi/UserDataStream/CloseListenKey_Example.fs @@ -16,7 +16,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/UserDataStream/CreateListenKey_Example.fs b/Examples/FSharp/WebSocketApi/UserDataStream/CreateListenKey_Example.fs index 94b83d9..dc3eca3 100644 --- a/Examples/FSharp/WebSocketApi/UserDataStream/CreateListenKey_Example.fs +++ b/Examples/FSharp/WebSocketApi/UserDataStream/CreateListenKey_Example.fs @@ -16,7 +16,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Examples/FSharp/WebSocketApi/UserDataStream/PingListenKey_Example.fs b/Examples/FSharp/WebSocketApi/UserDataStream/PingListenKey_Example.fs index 3e0bec1..9273808 100644 --- a/Examples/FSharp/WebSocketApi/UserDataStream/PingListenKey_Example.fs +++ b/Examples/FSharp/WebSocketApi/UserDataStream/PingListenKey_Example.fs @@ -16,7 +16,7 @@ let main argv = ) let logger = loggerFactory.CreateLogger() - let websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + let websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); let onlyOneMessage = new TaskCompletionSource(); diff --git a/Src/Common/Common.csproj b/Src/Common/Common.csproj index 11c3824..1b3626f 100644 --- a/Src/Common/Common.csproj +++ b/Src/Common/Common.csproj @@ -13,8 +13,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Src/Common/VersionInfo.cs b/Src/Common/VersionInfo.cs index 95b1d2b..fd171a0 100644 --- a/Src/Common/VersionInfo.cs +++ b/Src/Common/VersionInfo.cs @@ -2,7 +2,7 @@ namespace Binance.Common { public static class VersionInfo { - private static string version = "4.0.1"; + private static string version = "4.1.0"; public static string GetVersion { diff --git a/Src/Spot/.nuspec b/Src/Spot/.nuspec index 9bdd9a6..aa8e5c2 100644 --- a/Src/Spot/.nuspec +++ b/Src/Spot/.nuspec @@ -11,7 +11,7 @@ https://github.com/binance/binance-connector-dotnet/blob/master/CHANGELOG.md README.md - 4.0.1 + 4.1.0 binance diff --git a/Src/Spot/BSwap.cs b/Src/Spot/BSwap.cs deleted file mode 100644 index d571cc1..0000000 --- a/Src/Spot/BSwap.cs +++ /dev/null @@ -1,431 +0,0 @@ -namespace Binance.Spot -{ - using System; - using System.Collections.Generic; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot.Models; - - public class BSwap : SpotService - { - public BSwap(string baseUrl = DEFAULT_SPOT_BASE_URL, string apiKey = null, string apiSecret = null) - : this(new HttpClient(), baseUrl: baseUrl, apiKey: apiKey, apiSecret: apiSecret) - { - } - - public BSwap(HttpClient httpClient, string baseUrl = DEFAULT_SPOT_BASE_URL, string apiKey = null, string apiSecret = null) - : base(httpClient, baseUrl: baseUrl, apiKey: apiKey, apiSecret: apiSecret) - { - } - - public BSwap(HttpClient httpClient, IBinanceSignatureService signatureService, string baseUrl = DEFAULT_SPOT_BASE_URL, string apiKey = null) - : base(httpClient, baseUrl: baseUrl, apiKey: apiKey, signatureService: signatureService) - { - } - - private const string LIST_ALL_SWAP_POOLS = "/sapi/v1/bswap/pools"; - - /// - /// Get metadata about all swap pools. - /// Weight(IP): 1. - /// - /// List of Swap Pools. - public async Task ListAllSwapPools() - { - var result = await this.SendPublicAsync( - LIST_ALL_SWAP_POOLS, - HttpMethod.Get); - - return result; - } - - private const string GET_LIQUIDITY_INFORMATION_OF_A_POOL = "/sapi/v1/bswap/liquidity"; - - /// - /// Get liquidity information and user share of a pool. - /// Weight(IP):. - /// - `1` for one pool;. - /// - `10` when the poolId parameter is omitted;. - /// - /// - /// The value cannot be greater than 60000. - /// Pool Liquidation information. - public async Task GetLiquidityInformationOfAPool(long? poolId = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - GET_LIQUIDITY_INFORMATION_OF_A_POOL, - HttpMethod.Get, - query: new Dictionary - { - { "poolId", poolId }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string ADD_LIQUIDITY = "/sapi/v1/bswap/liquidityAdd"; - - /// - /// Add liquidity to a pool. - /// Weight(UID): 1000 (Additional: 3 times one second). - /// - /// - /// - /// - /// * `Single` - to add a single token. - /// * `Combination` - to add dual tokens. - /// The value cannot be greater than 60000. - /// Operation Id. - public async Task AddLiquidity(long poolId, string asset, decimal quantity, string type = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - ADD_LIQUIDITY, - HttpMethod.Post, - query: new Dictionary - { - { "poolId", poolId }, - { "type", type }, - { "asset", asset }, - { "quantity", quantity }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string REMOVE_LIQUIDITY = "/sapi/v1/bswap/liquidityRemove"; - - /// - /// Remove liquidity from a pool, `type` include `SINGLE` and `COMBINATION`, asset is mandatory for single asset removal. - /// Weight(UID): 1000 (Additional: 3 times one second). - /// - /// - /// * `SINGLE` - for single asset removal. - /// * `COMBINATION` - for combination of all coins removal. - /// - /// Mandatory for single asset removal. - /// The value cannot be greater than 60000. - /// Operation Id. - public async Task RemoveLiquidity(long poolId, LiquidityRemovalType type, decimal shareAmount, string[] asset = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - REMOVE_LIQUIDITY, - HttpMethod.Post, - query: new Dictionary - { - { "poolId", poolId }, - { "type", type }, - { "asset", asset }, - { "shareAmount", shareAmount }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string GET_LIQUIDITY_OPERATION_RECORD = "/sapi/v1/bswap/liquidityOps"; - - /// - /// Get liquidity operation (add/remove) records. - /// Weight(UID): 3000. - /// - /// - /// - /// - /// UTC timestamp in ms. - /// UTC timestamp in ms. - /// Default 500; max 1000. - /// The value cannot be greater than 60000. - /// Liquidity Operation Record. - public async Task GetLiquidityOperationRecord(long? operationId = null, long? poolId = null, LiquidityOperation? operation = null, long? startTime = null, long? endTime = null, int? limit = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - GET_LIQUIDITY_OPERATION_RECORD, - HttpMethod.Get, - query: new Dictionary - { - { "operationId", operationId }, - { "poolId", poolId }, - { "operation", operation }, - { "startTime", startTime }, - { "endTime", endTime }, - { "limit", limit }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string REQUEST_QUOTE = "/sapi/v1/bswap/quote"; - - /// - /// Request a quote for swap quote asset (selling asset) for base asset (buying asset), essentially price/exchange rates. - /// quoteQty is quantity of quote asset (to sell). - /// Please be noted the quote is for reference only, the actual price will change as the liquidity changes, it's recommended to swap immediate after request a quote for slippage prevention. - /// Weight(UID): 150. - /// - /// - /// - /// - /// The value cannot be greater than 60000. - /// Quote Info. - public async Task RequestQuote(string quoteAsset, string baseAsset, decimal quoteQty, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - REQUEST_QUOTE, - HttpMethod.Get, - query: new Dictionary - { - { "quoteAsset", quoteAsset }, - { "baseAsset", baseAsset }, - { "quoteQty", quoteQty }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string SWAP = "/sapi/v1/bswap/swap"; - - /// - /// Swap `quoteAsset` for `baseAsset`. - /// Weight(UID): 1000 (Additional: 3 times one second). - /// - /// - /// - /// - /// The value cannot be greater than 60000. - /// Swap Id. - public async Task Swap(string quoteAsset, string baseAsset, decimal quoteQty, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - SWAP, - HttpMethod.Post, - query: new Dictionary - { - { "quoteAsset", quoteAsset }, - { "baseAsset", baseAsset }, - { "quoteQty", quoteQty }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string GET_SWAP_HISTORY = "/sapi/v1/bswap/swap"; - - /// - /// Get swap history. - /// Weight(UID): 3000. - /// - /// - /// UTC timestamp in ms. - /// UTC timestamp in ms. - /// * `0` - pending for swap. - /// * `1` - success. - /// * `2` - failed. - /// - /// - /// default 3, max 100. - /// The value cannot be greater than 60000. - /// Swap History. - public async Task GetSwapHistory(long? swapId = null, long? startTime = null, long? endTime = null, SwapStatus? status = null, string quoteAsset = null, string baseAsset = null, int? limit = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - GET_SWAP_HISTORY, - HttpMethod.Get, - query: new Dictionary - { - { "swapId", swapId }, - { "startTime", startTime }, - { "endTime", endTime }, - { "status", status }, - { "quoteAsset", quoteAsset }, - { "baseAsset", baseAsset }, - { "limit", limit }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string POOL_CONFIGURE = "/sapi/v1/bswap/poolConfigure"; - - /// - /// Weight(IP): 150. - /// - /// - /// The value cannot be greater than 60000. - /// Pool Information. - public async Task PoolConfigure(long? poolId = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - POOL_CONFIGURE, - HttpMethod.Get, - query: new Dictionary - { - { "poolId", poolId }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string ADD_LIQUIDITY_PREVIEW = "/sapi/v1/bswap/addLiquidityPreview"; - - /// - /// Calculate expected share amount for adding liquidity in single or dual token. - /// Weight(IP): 150. - /// - /// - /// * `SINGLE` - for adding a single token. - /// * `COMBINATION` - for adding dual tokens. - /// - /// - /// The value cannot be greater than 60000. - /// Add Liquidity Preview. - public async Task AddLiquidityPreview(long poolId, string type, string quoteAsset, decimal quoteQty, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - ADD_LIQUIDITY_PREVIEW, - HttpMethod.Get, - query: new Dictionary - { - { "poolId", poolId }, - { "type", type }, - { "quoteAsset", quoteAsset }, - { "quoteQty", quoteQty }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string REMOVE_LIQUIDITY_PREVIEW = "/sapi/v1/bswap/removeLiquidityPreview"; - - /// - /// Calculate the expected asset amount of single token redemption or dual token redemption. - /// Weight(IP): 150. - /// - /// - /// * `SINGLE` - remove and obtain a single token. - /// * `COMBINATION` - remove and obtain dual token. - /// - /// - /// The value cannot be greater than 60000. - /// Remove Liquidity Preview. - public async Task RemoveLiquidityPreview(long poolId, string type, string quoteAsset, decimal shareAmount, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - REMOVE_LIQUIDITY_PREVIEW, - HttpMethod.Get, - query: new Dictionary - { - { "poolId", poolId }, - { "type", type }, - { "quoteAsset", quoteAsset }, - { "shareAmount", shareAmount }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string GET_UNCLAIMED_REWARDS_RECORD = "/sapi/v1/bswap/unclaimedRewards"; - - /// - /// Get unclaimed rewards record. - /// . - /// Weight(UID): 1000. - /// - /// 0: Swap rewards, 1: Liquidity rewards, default to 0. - /// The value cannot be greater than 60000. - /// Unclaimed rewards record. - public async Task GetUnclaimedRewardsRecord(int? type = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - GET_UNCLAIMED_REWARDS_RECORD, - HttpMethod.Get, - query: new Dictionary - { - { "type", type }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string CLAIM_REWARDS = "/sapi/v1/bswap/claimRewards"; - - /// - /// Claim swap rewards or liquidity rewards. - /// . - /// Weight(UID): 1000. - /// - /// 0: Swap rewards, 1: Liquidity rewards, default to 0. - /// The value cannot be greater than 60000. - /// Result of claim. - public async Task ClaimRewards(int? type = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - CLAIM_REWARDS, - HttpMethod.Post, - query: new Dictionary - { - { "type", type }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string GET_CLAIMED_HISTORY = "/sapi/v1/bswap/claimedHistory"; - - /// - /// Get history of claimed rewards. - /// . - /// Weight(UID): 1000. - /// - /// - /// - /// 0: Swap rewards, 1: Liquidity rewards, default to 0. - /// UTC timestamp in ms. - /// UTC timestamp in ms. - /// Default 3, max 100. - /// The value cannot be greater than 60000. - /// Claimed History. - public async Task GetClaimedHistory(long? poolId = null, string assetRewards = null, int? type = null, long? startTime = null, long? endTime = null, int? limit = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - GET_CLAIMED_HISTORY, - HttpMethod.Get, - query: new Dictionary - { - { "poolId", poolId }, - { "assetRewards", assetRewards }, - { "type", type }, - { "startTime", startTime }, - { "endTime", endTime }, - { "limit", limit }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - } -} \ No newline at end of file diff --git a/Src/Spot/MarginAccountTrade.cs b/Src/Spot/MarginAccountTrade.cs index e1ee07a..bde2f98 100644 --- a/Src/Spot/MarginAccountTrade.cs +++ b/Src/Spot/MarginAccountTrade.cs @@ -24,54 +24,23 @@ public MarginAccountTrade(HttpClient httpClient, IBinanceSignatureService signat { } - private const string CROSS_MARGIN_ACCOUNT_TRANSFER = "/sapi/v1/margin/transfer"; + private const string MARGIN_ACCOUNT_BORROW_REPAY = "/sapi/v1/margin/borrow-repay"; /// - /// Execute transfer between spot account and cross margin account. - /// Weight(IP): 600. - /// - /// - /// - /// * `1` - transfer from main account to margin account. - /// * `2` - transfer from margin account to main account. - /// The value cannot be greater than 60000. - /// Transfer Id. - public async Task CrossMarginAccountTransfer(string asset, decimal amount, MarginTransferType type, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - CROSS_MARGIN_ACCOUNT_TRANSFER, - HttpMethod.Post, - query: new Dictionary - { - { "asset", asset }, - { "amount", amount }, - { "type", type }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string MARGIN_ACCOUNT_BORROW = "/sapi/v1/margin/loan"; - - /// - /// Apply for a loan. - /// - If "isIsolated" = "TRUE", "symbol" must be sent. - /// - "isIsolated" = "FALSE" for crossed margin loan. + /// Margin account borrow/repay(MARGIN). /// Weight(UID): 3000. /// /// + /// TRUE for Isolated Margin, FALSE for Cross Margin, Default FALSE. + /// Only for Isolated margin. /// - /// * `TRUE` - For isolated margin. - /// * `FALSE` - Default, not for isolated margin. - /// Trading symbol, e.g. BNBUSDT. + /// BORROW or REPAY. /// The value cannot be greater than 60000. - /// Transaction id. - public async Task MarginAccountBorrow(string asset, decimal amount, bool? isIsolated = null, string symbol = null, long? recvWindow = null) + /// Margin Account borrow/repay transaction id. + public async Task MarginAccountBorrowRepay(string asset, string isIsolated, string symbol, string amount, MarginBorrowRepayType type, long? recvWindow = null) { var result = await this.SendSignedAsync( - MARGIN_ACCOUNT_BORROW, + MARGIN_ACCOUNT_BORROW_REPAY, HttpMethod.Post, query: new Dictionary { @@ -79,6 +48,7 @@ public async Task MarginAccountBorrow(string asset, decimal amount, bool { "isIsolated", isIsolated }, { "symbol", symbol }, { "amount", amount }, + { "type", type }, { "recvWindow", recvWindow }, { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, }); @@ -86,32 +56,37 @@ public async Task MarginAccountBorrow(string asset, decimal amount, bool return result; } - private const string MARGIN_ACCOUNT_REPAY = "/sapi/v1/margin/repay"; + private const string GET_BORROW_REPAY_RECORDS = "/sapi/v1/margin/borrow-repay"; /// - /// Repay loan for margin account. - /// - If "isIsolated" = "TRUE", "symbol" must be sent. - /// - "isIsolated" = "FALSE" for crossed margin repay. - /// Weight(IP): 3000. + /// Query borrow/repay records in Margin account(USER_DATA). + /// Weight(IP): 10. /// + /// BORROW or REPAY. /// - /// - /// * `TRUE` - For isolated margin. - /// * `FALSE` - Default, not for isolated margin. - /// Trading symbol, e.g. BNBUSDT. + /// Symbol in Isolated Margin. + /// tranId in POST /sapi/v1/margin/loan. + /// + /// + /// Current querying page. Start from 1. Default:1. + /// Default:10 Max:100. /// The value cannot be greater than 60000. - /// Transaction id. - public async Task MarginAccountRepay(string asset, decimal amount, bool? isIsolated = null, string symbol = null, long? recvWindow = null) + /// Borrow/Repay records. + public async Task GetBorrowRepayRecords(MarginBorrowRepayType type, string asset = null, string isIsolated = null, long? txId = null, long? startTime = null, long? endTime = null, long? current = null, long? size = null, long? recvWindow = null) { var result = await this.SendSignedAsync( - MARGIN_ACCOUNT_REPAY, - HttpMethod.Post, + GET_BORROW_REPAY_RECORDS, + HttpMethod.Get, query: new Dictionary { + { "type", type }, { "asset", asset }, { "isIsolated", isIsolated }, - { "symbol", symbol }, - { "amount", amount }, + { "txId", txId }, + { "startTime", startTime }, + { "endTime", endTime }, + { "current", current }, + { "size", size }, { "recvWindow", recvWindow }, { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, }); @@ -119,17 +94,17 @@ public async Task MarginAccountRepay(string asset, decimal amount, bool? return result; } - private const string QUERY_MARGIN_ASSET = "/sapi/v1/margin/asset"; + private const string GET_ALL_MARGIN_ASSETS = "/sapi/v1/margin/allAssets"; /// - /// Weight(IP): 10. + /// Weight(IP): 1. /// /// - /// Asset details. - public async Task QueryMarginAsset(string asset) + /// Assets details. + public async Task GetAllMarginAssets(string asset = null) { var result = await this.SendPublicAsync( - QUERY_MARGIN_ASSET, + GET_ALL_MARGIN_ASSETS, HttpMethod.Get, query: new Dictionary { @@ -139,17 +114,17 @@ public async Task QueryMarginAsset(string asset) return result; } - private const string QUERY_CROSS_MARGIN_PAIR = "/sapi/v1/margin/pair"; + private const string GET_ALL_CROSS_MARGIN_PAIRS = "/sapi/v1/margin/allPairs"; /// - /// Weight(IP): 10. + /// Weight(IP): 1. /// /// Trading symbol, e.g. BNBUSDT. - /// Margin pair details. - public async Task QueryCrossMarginPair(string symbol) + /// Margin pairs. + public async Task GetAllCrossMarginPairs(string symbol = null) { var result = await this.SendPublicAsync( - QUERY_CROSS_MARGIN_PAIR, + GET_ALL_CROSS_MARGIN_PAIRS, HttpMethod.Get, query: new Dictionary { @@ -159,36 +134,6 @@ public async Task QueryCrossMarginPair(string symbol) return result; } - private const string GET_ALL_MARGIN_ASSETS = "/sapi/v1/margin/allAssets"; - - /// - /// Weight(IP): 1. - /// - /// Assets details. - public async Task GetAllMarginAssets() - { - var result = await this.SendPublicAsync( - GET_ALL_MARGIN_ASSETS, - HttpMethod.Get); - - return result; - } - - private const string GET_ALL_CROSS_MARGIN_PAIRS = "/sapi/v1/margin/allPairs"; - - /// - /// Weight(IP): 1. - /// - /// Margin pairs. - public async Task GetAllCrossMarginPairs() - { - var result = await this.SendPublicAsync( - GET_ALL_CROSS_MARGIN_PAIRS, - HttpMethod.Get); - - return result; - } - private const string QUERY_MARGIN_PRICEINDEX = "/sapi/v1/margin/priceIndex"; /// @@ -218,7 +163,7 @@ public async Task QueryMarginPriceindex(string symbol) /// Trading symbol, e.g. BNBUSDT. /// /// Order type. - /// * `TRUE` - For isolated margin. + /// * `TRUE` - For isolated margin. /// * `FALSE` - Default, not for isolated margin. /// /// Quote quantity. @@ -334,10 +279,10 @@ public async Task MarginAccountCancelAllOpenOrdersOnASymbol(string symbo /// UTC timestamp in ms. /// Current querying page. Start from 1. Default:1. /// Default:10 Max:100. - /// Default: false. Set to true for archived data from 6 months ago. + /// Symbol in Isolated Margin. /// The value cannot be greater than 60000. /// Margin account transfer history, response in descending order. - public async Task GetCrossMarginTransferHistory(string asset = null, CrossMarginTransferType? type = null, long? startTime = null, long? endTime = null, int? current = null, int? size = null, bool? archived = null, long? recvWindow = null) + public async Task GetCrossMarginTransferHistory(string asset = null, CrossMarginTransferType? type = null, long? startTime = null, long? endTime = null, int? current = null, int? size = null, string isolatedSymbol = null, long? recvWindow = null) { var result = await this.SendSignedAsync( GET_CROSS_MARGIN_TRANSFER_HISTORY, @@ -350,89 +295,7 @@ public async Task GetCrossMarginTransferHistory(string asset = null, Cro { "endTime", endTime }, { "current", current }, { "size", size }, - { "archived", archived }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string QUERY_LOAN_RECORD = "/sapi/v1/margin/loan"; - - /// - /// - `txId` or `startTime` must be sent. `txId` takes precedence. - /// - Response in descending order. - /// - If `isolatedSymbol` is not sent, crossed margin data will be returned. - /// - Set `archived` to `true` to query data from 6 months ago. - /// Weight(IP): 10. - /// - /// - /// Isolated symbol. - /// the tranId in `POST /sapi/v1/margin/loan`. - /// UTC timestamp in ms. - /// UTC timestamp in ms. - /// Current querying page. Start from 1. Default:1. - /// Default:10 Max:100. - /// Default: false. Set to true for archived data from 6 months ago. - /// The value cannot be greater than 60000. - /// Loan records. - public async Task QueryLoanRecord(string asset, string isolatedSymbol = null, long? txId = null, long? startTime = null, long? endTime = null, long? current = null, long? size = null, bool? archived = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - QUERY_LOAN_RECORD, - HttpMethod.Get, - query: new Dictionary - { - { "asset", asset }, - { "isolatedSymbol", isolatedSymbol }, - { "txId", txId }, - { "startTime", startTime }, - { "endTime", endTime }, - { "current", current }, - { "size", size }, - { "archived", archived }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string QUERY_REPAY_RECORD = "/sapi/v1/margin/repay"; - - /// - /// - `txId` or `startTime` must be sent. `txId` takes precedence. - /// - Response in descending order. - /// - If `isolatedSymbol` is not sent, crossed margin data will be returned. - /// - Set `archived` to `true` to query data from 6 months ago. - /// Weight(IP): 10. - /// - /// - /// Isolated symbol. - /// the tranId in `POST /sapi/v1/margin/repay`. - /// UTC timestamp in ms. - /// UTC timestamp in ms. - /// Current querying page. Start from 1. Default:1. - /// Default:10 Max:100. - /// Default: false. Set to true for archived data from 6 months ago. - /// The value cannot be greater than 60000. - /// Load records. - public async Task QueryRepayRecord(string asset, string isolatedSymbol = null, long? txId = null, long? startTime = null, long? endTime = null, long? current = null, long? size = null, bool? archived = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - QUERY_REPAY_RECORD, - HttpMethod.Get, - query: new Dictionary - { - { "asset", asset }, { "isolatedSymbol", isolatedSymbol }, - { "txId", txId }, - { "startTime", startTime }, - { "endTime", endTime }, - { "current", current }, - { "size", size }, - { "archived", archived }, { "recvWindow", recvWindow }, { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, }); @@ -913,76 +776,6 @@ public async Task QueryMaxTransferoutAmount(string asset, bool? isolated return result; } - private const string ISOLATED_MARGIN_ACCOUNT_TRANSFER = "/sapi/v1/margin/isolated/transfer"; - - /// - /// Weight(UID): 600. - /// - /// - /// Trading symbol, e.g. BNBUSDT. - /// - /// - /// - /// The value cannot be greater than 60000. - /// Transaction Id. - public async Task IsolatedMarginAccountTransfer(string asset, string symbol, IsolatedMarginAccountTransferType transFrom, IsolatedMarginAccountTransferType transTo, decimal amount, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - ISOLATED_MARGIN_ACCOUNT_TRANSFER, - HttpMethod.Post, - query: new Dictionary - { - { "asset", asset }, - { "symbol", symbol }, - { "transFrom", transFrom }, - { "transTo", transTo }, - { "amount", amount }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string GET_ISOLATED_MARGIN_TRANSFER_HISTORY = "/sapi/v1/margin/isolated/transfer"; - - /// - /// Weight(IP): 1. - /// - /// Trading symbol, e.g. BNBUSDT. - /// - /// - /// - /// UTC timestamp in ms. - /// UTC timestamp in ms. - /// Current querying page. Start from 1. Default:1. - /// Default:10 Max:100. - /// Default: false. Set to true for archived data from 6 months ago. - /// The value cannot be greater than 60000. - /// Isolated Margin Transfer History. - public async Task GetIsolatedMarginTransferHistory(string symbol, string asset = null, IsolatedMarginAccountTransferType? transFrom = null, IsolatedMarginAccountTransferType? transTo = null, long? startTime = null, long? endTime = null, long? current = null, long? size = null, string archived = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - GET_ISOLATED_MARGIN_TRANSFER_HISTORY, - HttpMethod.Get, - query: new Dictionary - { - { "asset", asset }, - { "symbol", symbol }, - { "transFrom", transFrom }, - { "transTo", transTo }, - { "startTime", startTime }, - { "endTime", endTime }, - { "current", current }, - { "size", size }, - { "archived", archived }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - private const string QUERY_ISOLATED_MARGIN_ACCOUNT_INFO = "/sapi/v1/margin/isolated/account"; /// @@ -1078,43 +871,22 @@ public async Task QueryEnabledIsolatedMarginAccountLimit(long? recvWindo return result; } - private const string QUERY_ISOLATED_MARGIN_SYMBOL = "/sapi/v1/margin/isolated/pair"; - - /// - /// Weight(IP): 10. - /// - /// Trading symbol, e.g. BNBUSDT. - /// The value cannot be greater than 60000. - /// Isolated Margin Symbol. - public async Task QueryIsolatedMarginSymbol(string symbol, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - QUERY_ISOLATED_MARGIN_SYMBOL, - HttpMethod.Get, - query: new Dictionary - { - { "symbol", symbol }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - private const string GET_ALL_ISOLATED_MARGIN_SYMBOL = "/sapi/v1/margin/isolated/allPairs"; /// /// Weight(IP): 10. /// + /// Trading symbol, e.g. BNBUSDT. /// The value cannot be greater than 60000. /// All Isolated Margin Symbols. - public async Task GetAllIsolatedMarginSymbol(long? recvWindow = null) + public async Task GetAllIsolatedMarginSymbol(string symbol = null, long? recvWindow = null) { var result = await this.SendSignedAsync( GET_ALL_ISOLATED_MARGIN_SYMBOL, HttpMethod.Get, query: new Dictionary { + { "symbol", symbol }, { "recvWindow", recvWindow }, { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, }); @@ -1303,31 +1075,5 @@ public async Task QueryCurrentMarginOrderCountUsage(string isIsolated = return result; } - - private const string MARGIN_DUSTLOG = "/sapi/v1/margin/dribblet"; - - /// - /// Query the historical information of user's margin account small-value asset conversion BNB. - /// Weight(IP): 1. - /// - /// UTC timestamp in ms. - /// UTC timestamp in ms. - /// The value cannot be greater than 60000. - /// Usage.. - public async Task MarginDustlog(long? startTime = null, long? endTime = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - MARGIN_DUSTLOG, - HttpMethod.Get, - query: new Dictionary - { - { "startTime", startTime }, - { "endTime", endTime }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } } } \ No newline at end of file diff --git a/Src/Spot/Models/MarginBorrowRepayType.cs b/Src/Spot/Models/MarginBorrowRepayType.cs new file mode 100644 index 0000000..126c1e5 --- /dev/null +++ b/Src/Spot/Models/MarginBorrowRepayType.cs @@ -0,0 +1,19 @@ +namespace Binance.Spot.Models +{ + public struct MarginBorrowRepayType + { + private MarginBorrowRepayType(string value) + { + this.Value = value; + } + + public static MarginBorrowRepayType BORROW { get => new MarginBorrowRepayType("BORROW"); } + public static MarginBorrowRepayType REPAY { get => new MarginBorrowRepayType("REPAY"); } + + public string Value { get; private set; } + + public static implicit operator string(MarginBorrowRepayType enm) => enm.Value; + + public override string ToString() => this.Value.ToString(); + } +} \ No newline at end of file diff --git a/Src/Spot/Staking.cs b/Src/Spot/Staking.cs deleted file mode 100644 index 2e895a7..0000000 --- a/Src/Spot/Staking.cs +++ /dev/null @@ -1,248 +0,0 @@ -namespace Binance.Spot -{ - using System; - using System.Collections.Generic; - using System.Net.Http; - using System.Threading.Tasks; - using Binance.Common; - using Binance.Spot.Models; - - public class Staking : SpotService - { - public Staking(string baseUrl = DEFAULT_SPOT_BASE_URL, string apiKey = null, string apiSecret = null) - : this(new HttpClient(), baseUrl: baseUrl, apiKey: apiKey, apiSecret: apiSecret) - { - } - - public Staking(HttpClient httpClient, string baseUrl = DEFAULT_SPOT_BASE_URL, string apiKey = null, string apiSecret = null) - : base(httpClient, baseUrl: baseUrl, apiKey: apiKey, apiSecret: apiSecret) - { - } - - public Staking(HttpClient httpClient, IBinanceSignatureService signatureService, string baseUrl = DEFAULT_SPOT_BASE_URL, string apiKey = null) - : base(httpClient, baseUrl: baseUrl, apiKey: apiKey, signatureService: signatureService) - { - } - - private const string GET_STAKING_PRODUCT_LIST = "/sapi/v1/staking/productList"; - - /// - /// Get available Staking product list. - /// Weight(IP): 1. - /// - /// * `STAKING` - for Locked Staking. - /// * `F_DEFI` - for flexible DeFi Staking. - /// * `L_DEFI` - for locked DeFi Staking. - /// - /// Currently querying page. Start from 1. Default:1. - /// Default:10, Max:100. - /// The value cannot be greater than 60000. - /// Product list.. - public async Task GetStakingProductList(string product, string asset = null, long? current = null, long? size = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - GET_STAKING_PRODUCT_LIST, - HttpMethod.Get, - query: new Dictionary - { - { "product", product }, - { "asset", asset }, - { "current", current }, - { "size", size }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string PURCHASE_STAKING_PRODUCT = "/sapi/v1/staking/purchase"; - - /// - /// Weight(IP): 1. - /// - /// * `STAKING` - for Locked Staking. - /// * `F_DEFI` - for flexible DeFi Staking. - /// * `L_DEFI` - for locked DeFi Staking. - /// - /// - /// true or false, default false. Active if product is `STAKING` or `L_DEFI`. - /// The value cannot be greater than 60000. - /// Position Id.. - public async Task PurchaseStakingProduct(string product, string productId, decimal amount, string renewable = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - PURCHASE_STAKING_PRODUCT, - HttpMethod.Post, - query: new Dictionary - { - { "product", product }, - { "productId", productId }, - { "amount", amount }, - { "renewable", renewable }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string REDEEM_STAKING_PRODUCT = "/sapi/v1/staking/redeem"; - - /// - /// Redeem Staking product. Locked staking and Locked DeFI staking belong to early redemption, redeeming in advance will result in loss of interest that you have earned. - /// Weight(IP): 1. - /// - /// * `STAKING` - for Locked Staking. - /// * `F_DEFI` - for flexible DeFi Staking. - /// * `L_DEFI` - for locked DeFi Staking. - /// - /// Mandatory if product is `STAKING` or `L_DEFI`. - /// Mandatory if product is `F_DEFI`. - /// The value cannot be greater than 60000. - /// Success.. - public async Task RedeemStakingProduct(string product, string productId, string positionId = null, decimal? amount = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - REDEEM_STAKING_PRODUCT, - HttpMethod.Post, - query: new Dictionary - { - { "product", product }, - { "positionId", positionId }, - { "productId", productId }, - { "amount", amount }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string GET_STAKING_PRODUCT_POSITION = "/sapi/v1/staking/position"; - - /// - /// Weight(IP): 1. - /// - /// * `STAKING` - for Locked Staking. - /// * `F_DEFI` - for flexible DeFi Staking. - /// * `L_DEFI` - for locked DeFi Staking. - /// - /// - /// Currently querying the page. Start from 1. Default:1. - /// Default:10, Max:100. - /// The value cannot be greater than 60000. - /// Position.. - public async Task GetStakingProductPosition(string product, string productId = null, string asset = null, long? current = null, long? size = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - GET_STAKING_PRODUCT_POSITION, - HttpMethod.Get, - query: new Dictionary - { - { "product", product }, - { "productId", productId }, - { "asset", asset }, - { "current", current }, - { "size", size }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string GET_STAKING_HISTORY = "/sapi/v1/staking/stakingRecord"; - - /// - /// Weight(IP): 1. - /// - /// * `STAKING` - for Locked Staking. - /// * `F_DEFI` - for flexible DeFi Staking. - /// * `L_DEFI` - for locked DeFi Staking. - /// `SUBSCRIPTION`, `REDEMPTION`, `INTEREST`. - /// - /// - /// - /// Currently querying the page. Start from 1. Default:1. - /// Default:10, Max:100. - /// The value cannot be greater than 60000. - /// Staking History.. - public async Task GetStakingHistory(string product, string txnType, string asset = null, long? startTime = null, long? endTime = null, long? current = null, long? size = null, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - GET_STAKING_HISTORY, - HttpMethod.Get, - query: new Dictionary - { - { "product", product }, - { "txnType", txnType }, - { "asset", asset }, - { "startTime", startTime }, - { "endTime", endTime }, - { "current", current }, - { "size", size }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string SET_AUTO_STAKING = "/sapi/v1/staking/setAutoStaking"; - - /// - /// Set auto staking on Locked Staking or Locked DeFi Staking. - /// Weight(IP): 1. - /// - /// * `STAKING` - for Locked Staking. - /// * `L_DEFI` - for locked DeFi Staking. - /// - /// true or false. - /// The value cannot be greater than 60000. - /// Success.. - public async Task SetAutoStaking(string product, string positionId, string renewable, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - SET_AUTO_STAKING, - HttpMethod.Post, - query: new Dictionary - { - { "product", product }, - { "positionId", positionId }, - { "renewable", renewable }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - - private const string GET_PERSONAL_LEFT_QUOTA_OF_STAKING_PRODUCT = "/sapi/v1/staking/personalLeftQuota"; - - /// - /// Weight(IP): 1. - /// - /// * `STAKING` - for Locked Staking. - /// * `F_DEFI` - for flexible DeFi Staking. - /// * `L_DEFI` - for locked DeFi Staking. - /// - /// The value cannot be greater than 60000. - /// Quota.. - public async Task GetPersonalLeftQuotaOfStakingProduct(string product, string productId, long? recvWindow = null) - { - var result = await this.SendSignedAsync( - GET_PERSONAL_LEFT_QUOTA_OF_STAKING_PRODUCT, - HttpMethod.Get, - query: new Dictionary - { - { "product", product }, - { "productId", productId }, - { "recvWindow", recvWindow }, - { "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }, - }); - - return result; - } - } -} \ No newline at end of file diff --git a/Tests/Common.Tests/Common.Tests.csproj b/Tests/Common.Tests/Common.Tests.csproj index 1f237f4..682bf74 100644 --- a/Tests/Common.Tests/Common.Tests.csproj +++ b/Tests/Common.Tests/Common.Tests.csproj @@ -15,7 +15,7 @@ - + diff --git a/Tests/Spot.Tests/BSwap_Tests.cs b/Tests/Spot.Tests/BSwap_Tests.cs deleted file mode 100644 index 8f0a8de..0000000 --- a/Tests/Spot.Tests/BSwap_Tests.cs +++ /dev/null @@ -1,351 +0,0 @@ -namespace Binance.Spot.Tests -{ - using System.Net; - using System.Net.Http; - using Binance.Spot.Models; - using Moq; - using Moq.Protected; - using Xunit; - - public class BSwap_Tests - { - private string apiKey = "api-key"; - private string apiSecret = "api-secret"; - - #region ListAllSwapPools - [Fact] - public async void ListAllSwapPools_Response() - { - var responseContent = "[{\"poolId\":2,\"poolName\":\"BUSD/USDT\",\"assets\":[\"\"]}]"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/pools", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.ListAllSwapPools(); - - Assert.Equal(responseContent, result); - } - #endregion - - #region GetLiquidityInformationOfAPool - [Fact] - public async void GetLiquidityInformationOfAPool_Response() - { - var responseContent = "[{\"poolId\":2,\"poolNmae\":\"BUSD/USDT\",\"updateTime\":1565769342148,\"liquidity\":{\"BUSD\":100000315.79,\"USDT\":99999245.54},\"share\":{\"shareAmount\":12415,\"sharePercentage\":0.00006207,\"asset\":{\"BUSD\":6207.02,\"USDT\":6206.95}}}]"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/liquidity", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.GetLiquidityInformationOfAPool(); - - Assert.Equal(responseContent, result); - } - #endregion - - #region AddLiquidity - [Fact] - public async void AddLiquidity_Response() - { - var responseContent = "{\"operationId\":12341}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/liquidityAdd", HttpMethod.Post) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.AddLiquidity(2, "BTC", 12415.2m); - - Assert.Equal(responseContent, result); - } - #endregion - - #region RemoveLiquidity - [Fact] - public async void RemoveLiquidity_Response() - { - var responseContent = "{\"operationId\":12341}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/liquidityRemove", HttpMethod.Post) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.RemoveLiquidity(2, LiquidityRemovalType.SINGLE, 12415.2m); - - Assert.Equal(responseContent, result); - } - #endregion - - #region GetLiquidityOperationRecord - [Fact] - public async void GetLiquidityOperationRecord_Response() - { - var responseContent = "[{\"operationId\":12341,\"poolId\":2,\"poolName\":\"BUSD/USDT\",\"operation\":\"ADD\",\"status\":1,\"updateTime\":1565769342148,\"shareAmount\":\"10.1\"}]"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/liquidityOps", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.GetLiquidityOperationRecord(); - - Assert.Equal(responseContent, result); - } - #endregion - - #region RequestQuote - [Fact] - public async void RequestQuote_Response() - { - var responseContent = "{\"quoteAsset\":\"USDT\",\"baseAsset\":\"BUSD\",\"quoteQty\":300000,\"baseQty\":299975,\"price\":1.00008334,\"slippage\":0.00007245,\"fee\":120}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/quote", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.RequestQuote("USDT", "BUSD", 12415.2m); - - Assert.Equal(responseContent, result); - } - #endregion - - #region Swap - [Fact] - public async void Swap_Response() - { - var responseContent = "{\"swapId\":2314}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/swap", HttpMethod.Post) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.Swap("USDT", "BUSD", 12415.2m); - - Assert.Equal(responseContent, result); - } - #endregion - - #region GetSwapHistory - [Fact] - public async void GetSwapHistory_Response() - { - var responseContent = "[{\"swapId\":2314,\"swapTime\":1565770342148,\"status\":0,\"quoteAsset\":\"USDT\",\"baseAsset\":\"BUSD\",\"quoteQty\":300000,\"baseQty\":299975,\"price\":1.00008334,\"fee\":120}]"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/swap", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.GetSwapHistory(); - - Assert.Equal(responseContent, result); - } - #endregion - - #region PoolConfigure - [Fact] - public async void PoolConfigure_Response() - { - var responseContent = "[{\"poolId\":2,\"poolNmae\":\"BUSD/USDT\",\"updateTime\":1565769342148,\"liquidity\":{\"constantA\":2000,\"minRedeemShare\":0.1,\"slippageTolerance\":0.2},\"assetConfigure\":{\"BUSD\":{\"minAdd\":10,\"maxAdd\":20,\"minSwap\":10,\"maxSwap\":30},\"USDT\":{\"minAdd\":10,\"maxAdd\":20,\"minSwap\":10,\"maxSwap\":30}}}]"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/poolConfigure", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.PoolConfigure(); - - Assert.Equal(responseContent, result); - } - #endregion - - #region AddLiquidityPreview - [Fact] - public async void AddLiquidityPreview_Response() - { - var responseContent = "{\"quoteAsset\":\"USDT\",\"baseAsset\":\"BUSD\",\"quoteAmt\":300000,\"baseAmt\":299975,\"price\":1.00008334,\"share\":1.23}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/addLiquidityPreview", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.AddLiquidityPreview(2, "SINGLE", "USDT", 12415.2m); - - Assert.Equal(responseContent, result); - } - #endregion - - #region RemoveLiquidityPreview - [Fact] - public async void RemoveLiquidityPreview_Response() - { - var responseContent = "{\"quoteAsset\":\"USDT\",\"baseAsset\":\"BUSD\",\"quoteAmt\":300000,\"baseAmt\":299975,\"price\":1.00008334}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/removeLiquidityPreview", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.RemoveLiquidityPreview(2, "SINGLE", "USDT", 12415.2m); - - Assert.Equal(responseContent, result); - } - #endregion - - #region GetUnclaimedRewardsRecord - [Fact] - public async void GetUnclaimedRewardsRecord_Response() - { - var responseContent = "{\"totalUnclaimedRewards\":{\"BUSD\":100000315.79,\"BNB\":1e-8,\"USDT\":2e-8},\"details\":{\"BNB/USDT\":{\"BUSD\":100000315.79,\"USDT\":2e-8},\"BNB/BTC\":{\"BNB\":1e-8}}}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/unclaimedRewards", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.GetUnclaimedRewardsRecord(); - - Assert.Equal(responseContent, result); - } - #endregion - - #region ClaimRewards - [Fact] - public async void ClaimRewards_Response() - { - var responseContent = "{\"success\":true}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/claimRewards", HttpMethod.Post) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.ClaimRewards(); - - Assert.Equal(responseContent, result); - } - #endregion - - #region GetClaimedHistory - [Fact] - public async void GetClaimedHistory_Response() - { - var responseContent = "[{\"poolId\":52,\"poolName\":\"BNB/USDT\",\"assetRewards\":\"BNB\",\"claimTime\":1565769342148,\"claimAmount\":2.3e-7,\"status\":1}]"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/bswap/claimedHistory", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - BSwap bSwap = new BSwap( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await bSwap.GetClaimedHistory(); - - Assert.Equal(responseContent, result); - } - #endregion - } -} \ No newline at end of file diff --git a/Tests/Spot.Tests/MarginAccountTrade_Tests.cs b/Tests/Spot.Tests/MarginAccountTrade_Tests.cs index 19172be..ceee059 100644 --- a/Tests/Spot.Tests/MarginAccountTrade_Tests.cs +++ b/Tests/Spot.Tests/MarginAccountTrade_Tests.cs @@ -12,14 +12,14 @@ public class MarginAccountTrade_Tests private string apiKey = "api-key"; private string apiSecret = "api-secret"; - #region CrossMarginAccountTransfer + #region MarginAccountBorrowRepay [Fact] - public async void CrossMarginAccountTransfer_Response() + public async void MarginAccountBorrowRepay_Response() { - var responseContent = "{\"tranId\":345196462}"; + var responseContent = "{\"tranId\": 100000001}"; var mockMessageHandler = new Mock(); mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/transfer", HttpMethod.Post) + .SetupSendAsync("/sapi/v1/margin/borrow-repay", HttpMethod.Post) .ReturnsAsync(new HttpResponseMessage { StatusCode = HttpStatusCode.OK, @@ -30,92 +30,20 @@ public async void CrossMarginAccountTransfer_Response() apiKey: this.apiKey, apiSecret: this.apiSecret); - var result = await marginAccountTrade.CrossMarginAccountTransfer("BTC", 1.01m, MarginTransferType.SPOT_TO_MARGIN); + var result = await marginAccountTrade.MarginAccountBorrowRepay("BNB", "TRUE", "BNBUSDT", "1.0", MarginBorrowRepayType.BORROW); Assert.Equal(responseContent, result); } #endregion - #region MarginAccountBorrow + #region GetBorrowRepayRecords [Fact] - public async void MarginAccountBorrow_Response() + public async void GetBorrowRepayRecords_Response() { - var responseContent = "{\"tranId\":345196462}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/loan", HttpMethod.Post) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - MarginAccountTrade marginAccountTrade = new MarginAccountTrade( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await marginAccountTrade.MarginAccountBorrow("BTC", 1.01m); - - Assert.Equal(responseContent, result); - } - #endregion - - #region MarginAccountRepay - [Fact] - public async void MarginAccountRepay_Response() - { - var responseContent = "{\"tranId\":345196462}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/repay", HttpMethod.Post) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - MarginAccountTrade marginAccountTrade = new MarginAccountTrade( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await marginAccountTrade.MarginAccountRepay("BTC", 1.01m); - - Assert.Equal(responseContent, result); - } - #endregion - - #region QueryMarginAsset - [Fact] - public async void QueryMarginAsset_Response() - { - var responseContent = "{\"assetFullName\":\"Binance Coin\",\"assetName\":\"BNB\",\"isBorrowable\":false,\"isMortgageable\":true,\"userMinBorrow\":\"0.00000000\",\"userMinRepay\":\"0.00000000\"}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/asset", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - MarginAccountTrade marginAccountTrade = new MarginAccountTrade( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await marginAccountTrade.QueryMarginAsset("BTC"); - - Assert.Equal(responseContent, result); - } - #endregion - - #region QueryCrossMarginPair - [Fact] - public async void QueryCrossMarginPair_Response() - { - var responseContent = "{\"id\":323355778339572400,\"symbol\":\"BNBUSDT\",\"base\":\"BTC\",\"quote\":\"USDT\",\"isMarginTrade\":true,\"isBuyAllowed\":true,\"isSellAllowed\":true}"; + var responseContent = "{\"rows\":[{\"isolatedSymbol\":\"BNBUSDT\",\"amount\":\"14.00000000\",\"asset\":\"BNB\",\"interest\":\"0.01866667\",\"principal\":\"13.98133333\",\"status\":\"CONFIRMED\",\"timestamp\":1563438204000,\"txId\":2970933056}],\"total\":1}"; var mockMessageHandler = new Mock(); mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/pair", HttpMethod.Get) + .SetupSendAsync("/sapi/v1/margin/borrow-repay", HttpMethod.Get) .ReturnsAsync(new HttpResponseMessage { StatusCode = HttpStatusCode.OK, @@ -126,7 +54,7 @@ public async void QueryCrossMarginPair_Response() apiKey: this.apiKey, apiSecret: this.apiSecret); - var result = await marginAccountTrade.QueryCrossMarginPair("BNBUSDT"); + var result = await marginAccountTrade.GetBorrowRepayRecords(MarginBorrowRepayType.BORROW); Assert.Equal(responseContent, result); } @@ -300,54 +228,6 @@ public async void GetCrossMarginTransferHistory_Response() } #endregion - #region QueryLoanRecord - [Fact] - public async void QueryLoanRecord_Response() - { - var responseContent = "{\"rows\":[{\"isolatedSymbol\":\"\",\"txId\":0,\"asset\":\"\",\"principal\":\"\",\"timestamp\":0,\"status\":\"\"}],\"total\":0}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/loan", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - MarginAccountTrade marginAccountTrade = new MarginAccountTrade( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await marginAccountTrade.QueryLoanRecord("BTC"); - - Assert.Equal(responseContent, result); - } - #endregion - - #region QueryRepayRecord - [Fact] - public async void QueryRepayRecord_Response() - { - var responseContent = "{\"rows\":[{\"isolatedSymbol\":\"BNBUSDT\",\"amount\":\"14.00000000\",\"asset\":\"BNB\",\"interest\":\"0.01866667\",\"principal\":\"13.98133333\",\"status\":\"CONFIRMED\",\"timestamp\":1563438204000,\"txId\":2970933056}],\"total\":1}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/repay", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - MarginAccountTrade marginAccountTrade = new MarginAccountTrade( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await marginAccountTrade.QueryRepayRecord("BTC"); - - Assert.Equal(responseContent, result); - } - #endregion - #region GetInterestHistory [Fact] public async void GetInterestHistory_Response() @@ -684,54 +564,6 @@ public async void QueryMaxTransferoutAmount_Response() } #endregion - #region IsolatedMarginAccountTransfer - [Fact] - public async void IsolatedMarginAccountTransfer_Response() - { - var responseContent = "{}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/isolated/transfer", HttpMethod.Post) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - MarginAccountTrade marginAccountTrade = new MarginAccountTrade( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await marginAccountTrade.IsolatedMarginAccountTransfer("BTC", "BNBUSDT", IsolatedMarginAccountTransferType.SPOT, IsolatedMarginAccountTransferType.ISOLATED_MARGIN, 1.01m); - - Assert.Equal(responseContent, result); - } - #endregion - - #region GetIsolatedMarginTransferHistory - [Fact] - public async void GetIsolatedMarginTransferHistory_Response() - { - var responseContent = "{\"rows\":[{\"amount\":\"0.10000000\",\"asset\":\"BNB\",\"status\":\"CONFIRMED\",\"timestamp\":1566898617000,\"txId\":5240372201,\"transFrom\":\"SPOT\",\"transTo\":\"ISOLATED_MARGIN\"}],\"total\":1}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/isolated/transfer", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - MarginAccountTrade marginAccountTrade = new MarginAccountTrade( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await marginAccountTrade.GetIsolatedMarginTransferHistory("BNBUSDT"); - - Assert.Equal(responseContent, result); - } - #endregion - #region QueryIsolatedMarginAccountInfo [Fact] public async void QueryIsolatedMarginAccountInfo_Response() @@ -828,30 +660,6 @@ public async void QueryEnabledIsolatedMarginAccountLimit_Response() } #endregion - #region QueryIsolatedMarginSymbol - [Fact] - public async void QueryIsolatedMarginSymbol_Response() - { - var responseContent = "{\"symbol\":\"BTCUSDT\",\"base\":\"BTC\",\"quote\":\"USDT\",\"isMarginTrade\":true,\"isBuyAllowed\":true,\"isSellAllowed\":true}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/isolated/pair", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - MarginAccountTrade marginAccountTrade = new MarginAccountTrade( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await marginAccountTrade.QueryIsolatedMarginSymbol("BNBUSDT"); - - Assert.Equal(responseContent, result); - } - #endregion - #region GetAllIsolatedMarginSymbol [Fact] public async void GetAllIsolatedMarginSymbol_Response() @@ -1043,29 +851,5 @@ public async void QueryCurrentMarginOrderCountUsage_Response() Assert.Equal(responseContent, result); } #endregion - - #region MarginDustlog - [Fact] - public async void MarginDustlog_Response() - { - var responseContent = "{\"total\":8,\"userAssetDribblets\":[{\"operateTime\":1615985535000,\"totalTransferedAmount\":\"0.00132256\",\"totalServiceChargeAmount\":\"0.00002699\",\"transId\":45178372831,\"userAssetDribbletDetails\":[{\"transId\":4359321,\"serviceChargeAmount\":\"0.000009\",\"amount\":\"0.0009\",\"operateTime\":1615985535000,\"transferedAmount\":\"0.000441\",\"fromAsset\":\"USDT\"},{\"transId\":4359321,\"serviceChargeAmount\":\"0.00001799\",\"amount\":\"0.0009\",\"operateTime\":1615985535000,\"transferedAmount\":\"0.00088156\",\"fromAsset\":\"ETH\"}]}]}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/margin/dribblet", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - MarginAccountTrade marginAccountTrade = new MarginAccountTrade( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await marginAccountTrade.MarginDustlog(); - - Assert.Equal(responseContent, result); - } - #endregion } } \ No newline at end of file diff --git a/Tests/Spot.Tests/Staking_Tests.cs b/Tests/Spot.Tests/Staking_Tests.cs deleted file mode 100644 index 035f9a1..0000000 --- a/Tests/Spot.Tests/Staking_Tests.cs +++ /dev/null @@ -1,183 +0,0 @@ -namespace Binance.Spot.Tests -{ - using System.Net; - using System.Net.Http; - using Binance.Spot.Models; - using Moq; - using Moq.Protected; - using Xunit; - - public class Staking_Tests - { - private string apiKey = "api-key"; - private string apiSecret = "api-secret"; - - #region GetStakingProductList - [Fact] - public async void GetStakingProductList_Response() - { - var responseContent = "[{\"projectId\":\"Axs*90\",\"detail\":{\"asset\":\"AXS\",\"rewardAsset\":\"AXS\",\"duration\":90,\"renewable\":true,\"apy\":\"1.2069\"},\"quota\":{\"totalPersonalQuota\":\"2\",\"minimum\":\"0.001\"}},{\"projectId\":\"Fio*90\",\"detail\":{\"asset\":\"FIO\",\"rewardAsset\":\"FIO\",\"duration\":90,\"renewable\":true,\"apy\":\"1.0769\"},\"quota\":{\"totalPersonalQuota\":\"600\",\"minimum\":\"0.1\"}}]"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/staking/productList", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - Staking staking = new Staking( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await staking.GetStakingProductList("STAKING"); - - Assert.Equal(responseContent, result); - } - #endregion - - #region PurchaseStakingProduct - [Fact] - public async void PurchaseStakingProduct_Response() - { - var responseContent = "{\"positionId\":\"12345\",\"success\":true}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/staking/purchase", HttpMethod.Post) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - Staking staking = new Staking( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await staking.PurchaseStakingProduct("STAKING", "Axs*90", 10.1m); - - Assert.Equal(responseContent, result); - } - #endregion - - #region RedeemStakingProduct - [Fact] - public async void RedeemStakingProduct_Response() - { - var responseContent = "{\"success\":true}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/staking/redeem", HttpMethod.Post) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - Staking staking = new Staking( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await staking.RedeemStakingProduct("STAKING", "Axs*90"); - - Assert.Equal(responseContent, result); - } - #endregion - - #region GetStakingProductPosition - [Fact] - public async void GetStakingProductPosition_Response() - { - var responseContent = "[{\"positionId\":\"123123\",\"projectId\":\"Axs*90\",\"asset\":\"AXS\",\"amount\":\"122.09202928\",\"purchaseTime\":\"1646182276000\",\"duration\":\"60\",\"accrualDays\":\"4\",\"rewardAsset\":\"AXS\",\"APY\":\"0.2032\",\"rewardAmt\":\"5.17181528\",\"extraRewardAsset\":\"BNB\",\"extraRewardAPY\":\"0.0203\",\"estExtraRewardAmt\":\"5.17181528\",\"nextInterestPay\":\"1.29295383\",\"nextInterestPayDate\":\"1646697600000\",\"payInterestPeriod\":\"1\",\"redeemAmountEarly\":\"2802.24068892\",\"interestEndDate\":\"1651449600000\",\"deliverDate\":\"1651536000000\",\"redeemPeriod\":\"1\",\"redeemingAmt\":\"232.2323\",\"partialAmtDeliverDate\":\"1651536000000\",\"canRedeemEarly\":true,\"renewable\":true,\"type\":\"AUTO\",\"status\":\"HOLDING\"}]"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/staking/position", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - Staking staking = new Staking( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await staking.GetStakingProductPosition("STAKING"); - - Assert.Equal(responseContent, result); - } - #endregion - - #region GetStakingHistory - [Fact] - public async void GetStakingHistory_Response() - { - var responseContent = "[{\"positionId\":\"123123\",\"time\":1575018510000,\"asset\":\"BNB\",\"project\":\"BSC\",\"amount\":\"21312.23223\",\"lockPeriod\":\"30\",\"deliverDate\":\"1575018510000\",\"type\":\"AUTO\",\"status\":\"success\"}]"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/staking/stakingRecord", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - Staking staking = new Staking( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await staking.GetStakingHistory("STAKING", "SUBSCRIPTION"); - - Assert.Equal(responseContent, result); - } - #endregion - - #region SetAutoStaking - [Fact] - public async void SetAutoStaking_Response() - { - var responseContent = "{\"success\":true}"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/staking/setAutoStaking", HttpMethod.Post) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - Staking staking = new Staking( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await staking.SetAutoStaking("STAKING", "1234", "true"); - - Assert.Equal(responseContent, result); - } - #endregion - - #region GetPersonalLeftQuotaOfStakingProduct - [Fact] - public async void GetPersonalLeftQuotaOfStakingProduct_Response() - { - var responseContent = "[{\"leftPersonalQuota\":\"1000\"}]"; - var mockMessageHandler = new Mock(); - mockMessageHandler.Protected() - .SetupSendAsync("/sapi/v1/staking/personalLeftQuota", HttpMethod.Get) - .ReturnsAsync(new HttpResponseMessage - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(responseContent), - }); - Staking staking = new Staking( - new HttpClient(mockMessageHandler.Object), - apiKey: this.apiKey, - apiSecret: this.apiSecret); - - var result = await staking.GetPersonalLeftQuotaOfStakingProduct("STAKING", "Axs*90"); - - Assert.Equal(responseContent, result); - } - #endregion - } -} \ No newline at end of file From c5c643d5e4a87f39e6276cd438239606a9efc391 Mon Sep 17 00:00:00 2001 From: alplabin <122352306+alplabin@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:41:24 +0900 Subject: [PATCH 2/3] Update Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03e05d2..789c471 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ public class NewOrder_Example { public static async Task Main(string[] args) { - var websocket = new WebSocketApi("wss://testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); + var websocket = new WebSocketApi("wss://ws-api.testnet.binance.vision/ws-api/v3", "apiKey", new BinanceHmac("apiSecret")); websocket.OnMessageReceived( async (data) => From a312e7b5550f2bfc03e2a8dbd4ffa9bee4f87437 Mon Sep 17 00:00:00 2001 From: alplabin <122352306+alplabin@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:02:14 +0900 Subject: [PATCH 3/3] Update date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 471bc46..e8b9bd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 4.1.0 - 2024-06-17 +## 4.1.0 - 2024-06-18 ### Added - New endpoints for Margin: - `POST /sapi/v1/margin/borrow-repay`: Margin account borrow/repay