From 706e589363e45fa47f13943a36a6e8c8c26d42e5 Mon Sep 17 00:00:00 2001
From: shanji <18996038927@163.com>
Date: Sat, 14 May 2022 19:36:14 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E5=8D=95=E6=B5=8B=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Binance.TradeRobot.Model.xml | 10 +++
SDKTestConsole/Program.cs | 70 ++++++++++++++++++-
2 files changed, 77 insertions(+), 3 deletions(-)
diff --git a/Binance.TradeRobot.Model/Binance.TradeRobot.Model.xml b/Binance.TradeRobot.Model/Binance.TradeRobot.Model.xml
index 698bf7d..4807a02 100644
--- a/Binance.TradeRobot.Model/Binance.TradeRobot.Model.xml
+++ b/Binance.TradeRobot.Model/Binance.TradeRobot.Model.xml
@@ -244,6 +244,16 @@
交易量
+
+
+ 借币金额
+
+
+
+
+ 借币利息
+
+
执行模式
diff --git a/SDKTestConsole/Program.cs b/SDKTestConsole/Program.cs
index 446fc67..e8a3ba3 100644
--- a/SDKTestConsole/Program.cs
+++ b/SDKTestConsole/Program.cs
@@ -1,4 +1,8 @@
-using Binance.TradeRobot.Model.Base;
+using Binance.Net.Clients;
+using Binance.Net.Objects;
+using Binance.TradeRobot.Model.Base;
+using CryptoExchange.Net.Authentication;
+using Newtonsoft.Json;
using SDKAdapter.APIClient;
using System;
@@ -20,13 +24,73 @@ namespace SDKTestConsole
//var maxLoan = client.QueryMaxLoanAmount("ETHUSDT");
//Console.WriteLine(maxLoan);
+ //借币
//var r1 = client.IsolatedMarginLoan("ETHUSDT", 10M);
//var r2 = client.IsolatedMarginLoan("ETHUSDT", 10M);
//Console.WriteLine(r2.AccountLoanAmount);
+ //还币
+ //var r3 = client.IsolatedMarginRepay("ETHUSDT", 20M);
+ //Console.WriteLine(r3);
- var r3 = client.IsolatedMarginRepay("ETHUSDT", 20M);
- Console.WriteLine(r3);
+
+ var spotClientOption = new BinanceApiClientOptions()
+ {
+ BaseAddress = "https://api.binance.com",
+ ApiCredentials = new ApiCredentials(apiKey, secret)
+ };
+ var usdFuturesClientOption = new BinanceApiClientOptions()
+ {
+ BaseAddress = "https://fapi.binance.com",
+ ApiCredentials = new ApiCredentials(apiKey, secret)
+ };
+ var binanceClient = new BinanceClient(new BinanceClientOptions()
+ {
+ UsdFuturesApiOptions = usdFuturesClientOption,
+ SpotApiOptions = spotClientOption
+ });
+
+
+ //市价买币
+ //var r = binanceClient.SpotApi.Trading.PlaceMarginOrderAsync("ETHUSDT",
+ // Binance.Net.Enums.OrderSide.Buy,
+ // Binance.Net.Enums.SpotOrderType.Market,
+ // quoteQuantity: 20M, //报价币金额
+ // //quantity: 100M,
+ // //timeInForce: Binance.Net.Enums.TimeInForce.GoodTillCanceled,
+ // //stopPrice: 1899M,
+ // isIsolated: true,
+ // orderResponseType: Binance.Net.Enums.OrderResponseType.Full).Result;
+ //var s = JsonConvert.SerializeObject(r);
+
+ //市价卖币
+ //var r = binanceClient.SpotApi.Trading.PlaceMarginOrderAsync("ETHUSDT",
+ // Binance.Net.Enums.OrderSide.Sell,
+ // Binance.Net.Enums.SpotOrderType.Market,
+ // quantity: 0.0098M,
+ // //quoteQuantity: 20M, //报价币金额
+ // //quantity: 100M,
+ // //timeInForce: Binance.Net.Enums.TimeInForce.GoodTillCanceled,
+ // //stopPrice: 1899M,
+ // isIsolated: true,
+ // orderResponseType: Binance.Net.Enums.OrderResponseType.Full).Result;
+ //var s = JsonConvert.SerializeObject(r);
+
+
+ //止损卖币
+ //var r = binanceClient.SpotApi.Trading.PlaceMarginOrderAsync("ETHUSDT",
+ // Binance.Net.Enums.OrderSide.Sell,
+ // Binance.Net.Enums.SpotOrderType.StopLossLimit,
+ // quantity: 0.00008040M,
+ // price: 1899M,
+ // //quoteQuantity: 20M, //报价币金额
+ // //quantity: 100M,
+ // timeInForce: Binance.Net.Enums.TimeInForce.GoodTillCanceled,
+ // stopPrice: 1899M,
+ // isIsolated: true,
+ // orderResponseType: Binance.Net.Enums.OrderResponseType.Full).Result;
+ //var s = JsonConvert.SerializeObject(r);
+ //Console.WriteLine(s);
Console.ReadKey();
}
}