币安量化交易
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
3.0 KiB

using Binance.Net.Clients;
using Binance.Net.Objects;
using Binance.TradeRobot.Model.Base;
using CryptoExchange.Net.Authentication;
using Newtonsoft.Json;
using SDKAdapter.APIClient;
using SDKAdapter.WebSockets.Order.Spot;
using System;
using System.Threading.Tasks;
namespace SDKTestConsole
{
internal class Program
{
private static System.Threading.Timer timer;
private static SpotOrderWebSocketClient orderWebSocketClient;
static void Main(string[] args)
{
var apiKey = "pXKdUPbGN4DNar2f2HRoL2qxHoCWcLNf9V5uHTL2lBVCxz66eE8PMPwBw9h8RbKf";
var secret = "c14tJd7kpMnePKRDoo4nzZk4bIn9bDO8ZCYo69amB4uspLgO5s4GlzYvTwD2zYav";
var client = BaseAPIClient.Create(Enums.Exchange.Binance, 0, apiKey, secret);
//逐仓杠杆账户资产
//var marginList = client.GetIsolatedMarginAccountAssets();
//var s = JsonConvert.SerializeObject(marginList);
//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 binanceSocketClient = new BinanceSocketClient();
//var newClientOrderId = "abcd_286129845448773_1";
//var orderId = client.IsolatedMarginPlaceOrder("ETHUSDT", Enums.TradeDirection.Buy, Enums.OrderType.MARKET, quoteAmount: 20M, newClientOrderId: newClientOrderId);
var logger = NLog.LogManager.GetLogger("test");
var stopLossClientOrderId = "stoploss2_286129845448773_1";
long stopLossOrderId = 0;
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 binanceSocketClient = new BinanceSocketClient();
var r = client.GetIsolatedMarginAccountAssets();
//25.07786941
var i = client.IsolatedMarginRepay("GMTUSDT", 0.00009176M);
Console.ReadKey();
}
}
}