Giter Club home page Giter Club logo

binance-connector-dotnet's People

Contributors

2pd avatar aisling-2 avatar tantialex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

binance-connector-dotnet's Issues

Wrong `Value` property accessed here.

if (!string.IsNullOrWhiteSpace(queryParameter.Value?.ToString()))

Here you're looping on the dictionary to build the query string that will be published to the REST API endpoint.
But it doesn't always work, especially if what's inside the Value member is an object or a struct that does not overload the ToString() which leads to that instead of having the value behind the "Enum struct" (LendingType.DAILY => DAILY for instance) you send the type of the object Binance.Spot.Models.LendingType.

So instead of having the queryString like: lendingType=DAILY you get lendingType=Binance.Spot.Models.LendingType

Best Regards,

The Ticker doesn't update

Hi,

I'm not sure what I'm doing wrong, but I grab the websocket example code for the symbol ticker and it works, but only shows one piece of market information. I am hoping to have the stream continue to provide real-time data.

Thanks

Hey, great connector. Please tell me what am I doing wrong

Description

namespace Binance.Spot.MarketExamples
{
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 CheckServerTime_Example
{
    public static async Task Main(string[] args)
    {

        HttpClient httpClient = new HttpClient();

        string apiKey = "ZkV5TA6y***********";
        string apiSecret = "LHbVgVD****;

        var spotAccountTrade = new SpotAccountTrade(httpClient, apiKey, apiSecret);

        var result = await spotAccountTrade.TestNewOrder("BNBUSDT", Side.SELL, OrderType.MARKET); <--- Error

/System.ArgumentNullException: "String reference not set to an instance of a String. Arg_ParamName_Name"/

        Console.ReadLine();
    }
}

}

Binance namespace could not be found

Installed Binance.Spot 1.0.1 nuget package
Replicated the Websocket example documented in the readme

Encounter this error: "The type or namespace name 'Binance' could not be found."

A repo replicating this error can be found here: https://github.com/Tolvic/BinanceTest

This repo is using .NET core 3.1. I have also tested using .NET 6 and the same error occurs.

Documentation: How I can use the repo to find All Coins' Information?

Description

Hello:
I want to find all coin’s information as described in API document, the HTTP Get URL is like this:
GET /sapi/v1/capital/config/getall (HMAC SHA256)

But I can’t find any code example on how to get the information.
I can use NUGET Binance.Spot Version 1.8.0 package to get account balance, since there is some code example.

But how I can do this with the repo?
Please provide some code examples (C# on Windows 10)
Thanks,

Exception : Timestamp for this request was 1000ms ahead of the server's time.

Reproduction steps

var wallet = new Wallet(httpClient: _httpClient, apiKey: user.BinanceApiKey, apiSecret: user.BinanceApiSecret); string userassets = string.Empty; try { userassets = await wallet.UserAsset(); } catch (Exception exception) { throw new Exception(exception.Message); }

Expected behavior

Result should be successfull

Actual Behavior

Exception : Timestamp for this request was 1000ms ahead of the server's time.

.NET version

.NET Framework 6.0.x

Operating system

Windows

Environment

No response

dotnet --info

No response

Not receiving any websocket packets

public class BinanceService
    {
        private BinanceServiceConfiguration mConfiguration { get; set; }
        private HttpClient mHttpClient { get; set; }
        private MarketDataWebSocket mMarketDataWebSocket { get; set; }
        private Mock<IBinanceWebSocketHandler> mSocketHandler { get; set; }
        private BinanceOrderBook mBinanceOrderBook { get; set; }

        public BinanceService()
        {
            mHttpClient = new HttpClient();

            IConfiguration config = new ConfigurationBuilder()
                .AddJsonFile("configuration.json")
                .Build();

            mConfiguration = config.GetRequiredSection("binanceService").Get<BinanceServiceConfiguration>();

            mSocketHandler = new Mock<IBinanceWebSocketHandler>();
        }

        public async Task InitialiseAsync(string symbol)
        {
            mMarketDataWebSocket = new MarketDataWebSocket($"{symbol}@depth", mSocketHandler.Object);

            mMarketDataWebSocket.OnMessageReceived((data) => {
                OnMessageReceived(data);
                return Task.CompletedTask;
            }, CancellationToken.None);

            Market market = new Market(mHttpClient);
            mBinanceOrderBook = JsonConvert.DeserializeObject<BinanceOrderBook>(await market.OrderBook(symbol, 5000));

            await mMarketDataWebSocket.ConnectAsync(CancellationToken.None);
            mSocketHandler.Verify(mock => mock.ConnectAsync(It.Is<Uri>(uri => uri.AbsolutePath == $"/ws/{symbol}@depth"), It.IsAny<CancellationToken>()), Times.Once());
        }

        public async Task RunBotContinuouslyAsync()
        {
            // DO STUFF HERE
        }

        private void OnMessageReceived(string data)
        {
            Console.WriteLine("test");
            BinanceOrderBook orderbookUpdates = JsonConvert.DeserializeObject<BinanceOrderBook>(data);

            foreach ((double price, double volume) in orderbookUpdates.Asks)
            {
                if (mBinanceOrderBook.Asks.ContainsKey(price))
                {
                    mBinanceOrderBook.Asks[price] = volume;
                }
                else
                {
                    mBinanceOrderBook.Asks.Add(price, volume);
                }
            }

            foreach ((double price, double volume) in orderbookUpdates.Bids)
            {
                if (mBinanceOrderBook.Bids.ContainsKey(price))
                {
                    mBinanceOrderBook.Bids[price] = volume;
                }
                else
                {
                    mBinanceOrderBook.Bids.Add(price, volume);
                }
            }
        }
    }

var binanceService = new BinanceService();
await binanceService.InitialiseAsync("BTCUSDT");
Task continuousBotTask = binanceService.RunBotContinuouslyAsync();
Task.Run(() => continuousBotTask);

Thread.Sleep(Timeout.Infinite);

I don't seem to receive any packets from the WS using the above implementation. The verification does not throw so presumably the connection is live. Any thoughts?

Problem with PostAsync request in "TRADE" Section from Postman collection

Hello, i am working with binanceAPI and i get stuck at this point:
{"code":-1102,"msg":"Mandatory parameter 'symbol' was not sent, was empty/null, or malformed."}

This is my code:

    public CRUD_TESTNET()
    {
        _httpClient.BaseAddress = new Uri("https://testnet.binance.vision");
        _httpClient.Timeout = new TimeSpan(0, 0, 5);
        _httpClient.DefaultRequestHeaders.Clear();
        _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        _httpClient.DefaultRequestHeaders.Add("X-MBX-APIKEY", Environment.GetEnvironmentVariable("APIKEY"));
        _httpClient.DefaultRequestHeaders.Add("SecretKey", Environment.GetEnvironmentVariable("SECRETKEY"));
        
    }
private async Task POSTNewOrder()
        {
            string? signature = Environment.GetEnvironmentVariable("SIGNATURE");
            var timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
            // EXAMPLE: XRPBUSD
            Console.Write("Choose pair: "); string? pair = Console.ReadLine();
            //EXAMPLE: BUY / SELL
            Console.Write("Side: "); string? side = Console.ReadLine();
            //EXAMPLE: LIMIT / MARKET / STOP_LOSS / STOP_LOSS_LIMIT / TAKE_PROFIT / TAKE_PROFIT_LIMIT / LIMIT_MAKER
            Console.Write("Type: "); string? type = Console.ReadLine();
            //EXAMPLE: GTC (good till canceled) / FOK (fill or kill) / IOC (immediate or cancel)
            Console.Write("TimeInForce: "); string? timeInForce = Console.ReadLine();
            //EXAMPLE: Quantity: 100
            Console.Write("Quantity: "); string? quantity = Console.ReadLine();
            //EXAMPLE: Price: 350
            Console.Write("Price: "); string? price = Console.ReadLine();
            string? query = $"symbol={pair}&side={side}&type={type}&timeInForce={timeInForce}&quantity={quantity}&price={price}&timestamp={timestamp}&signature={signature}";
            var request = new
            {
                symbol = pair,
                side = side,
                type = type,
                timeInForce = timeInForce,
                quantity = quantity,
                price = price,
                timestamp = timestamp,
                signature = signature
            };
            var json = JsonConvert.SerializeObject(request);
            var stringContent = new StringContent(json);
            try
            {

                var response = await _httpClient.PostAsync("/api/v3/order?", stringContent);
                //response.EnsureSuccessStatusCode();
                var content = await response.Content.ReadAsStringAsync();
                Console.WriteLine($"{content.ToString()}");
                Console.WriteLine($"{response.Headers}");
                Console.WriteLine($"{response.StatusCode}");

            }
            catch (Exception exception)
            {
                Console.WriteLine("\nSorry, cannot proceed your request.." + $"\n{exception.Message}");

            }

This is response state:

{StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Connection: keep-alive
  Date: Tue, 08 Nov 2022 16:25:09 GMT
  Server: nginx
  x-mbx-uuid: 0aee5274-30fc-405d-a68a-a2fe57334ef0
  x-mbx-used-weight: 1
  x-mbx-used-weight-1m: 1
  Strict-Transport-Security: max-age=31536000; includeSubdomains
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block
  X-Content-Type-Options: nosniff
  Content-Security-Policy: default-src 'self'
  X-Content-Security-Policy: default-src 'self'
  X-WebKit-CSP: default-src 'self'
  Cache-Control: no-cache, no-store, must-revalidate
  Pragma: no-cache
  X-Cache: Error from cloudfront
  Via: 1.1 6c38ff4c7648bbb26bea641498fdefb0.cloudfront.net (CloudFront)
  X-Amz-Cf-Pop: VIE50-P1
  X-Amz-Cf-Id: SuFO8l1L5xsnzqZQ3fqRFmXwIyP6l6cRoRBjRnK94wmQRK305Ct47g==
  Content-Type: application/json;charset=UTF-8
  Content-Length: 95
  Expires: 0
}}

I would appreciate if you will help me.

Actually i am building API connector and i found something.
All methods from "TRADE" are working in POSTMAN, but not from my C# code. Even GetAsync dont work. This is another one method:

        private async Task GETAllOwnOrders(long timestamp, string signature)
        {

            try
            {
                var response = await _httpClient.GetAsync($"/api/v3/allOrders?symbol=BNBUSDT&timestamp={timestamp}&signature={signature}");
                response.EnsureSuccessStatusCode();
                var content = await response.Content.ReadAsStringAsync();
                Console.WriteLine($"\nCurrent Open Orders {content}");
            }
            catch (Exception exception)
            {
                Console.WriteLine("\nSorry, cannot proceed your request.." + $"\n{exception.Message}");

            }

        }

This is link to the repository: https://github.com/MGabala/BINANCE-BOT

where is pong response?

by your guide:
"Heartbeat
Once connected, the websocket server sends a ping frame every 3 minutes and requires a response pong frame back within a 10 minutes period. This package handles the pong responses automatically."
but i cannot this handle code in BinanceWebSocket.cs or BinanceWebSocketHandler.cs
please guide me , where is this handle code?
i'm getting !bookTicker stream by socket but after a period of time this is cut off !!!

Can not make a request

Hello, can not get system status, getting this error

      An unhandled exception has occurred while executing the request.
      System.NullReferenceException: Object reference not set to an instance of an object.
         at Binance.Common.BinanceService.SendAsync[T](String requestUri, HttpMethod httpMethod, Object content)
         at Binance.Common.BinanceService.SendPublicAsync[T](String requestUri, HttpMethod httpMethod, Dictionary`2 query, Object content)
         at Binance.Spot.Wallet.SystemStatus()
         at binance_api_consumer.wallet.WalletWrapper.GetSystemStatus() in /Users/domas/ws/binance-api-consumer/wallet/WalletWrapper.cs:line 24
         at Program.<>c__DisplayClass0_0.<<<Main>$>b__2>d.MoveNext() in /Users/domas/ws/binance-api-consumer/Program.cs:line 16
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Http.RequestDelegateFactory.<ExecuteTaskOfString>g__ExecuteAwaited|59_0(Task`1 task, HttpContext httpContext)
         at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Here is code I Wrote:

{
    public class WalletWrapper
    {
        private Config _config;
        private Wallet wallet;

        public WalletWrapper(Config config)
        {
            _config = config;
            wallet = new Wallet(baseUrl: config.baseUrl, apiKey: config.apiKey, apiSecret: config.secretKey);
        }

        public async Task<string> GetSystemStatus()
        {
            Console.WriteLine(wallet);
            return await wallet.SystemStatus();
        } 
    }
}

and Porgram.cs:

using binance_api_consumer.config;
using binance_api_consumer.wallet;
using Binance.Spot;

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

var config = new ConfigReader().config;

app.MapGet("/", () => "Welcome!");
app.MapGet("/config", () => config);

var walletWrapper = new WalletWrapper(config);

var func = async () => {
    string s = await walletWrapper.GetSystemStatus();
    Console.WriteLine(s);
    return s;
};

app.MapGet("/wallet", () => func());

app.Run();

Documentation: How I can use the repo to get account snapshot for Spot Test Network.

Description

Hello:
I want to test some API functions in Spot Test Network, I created API key/Secret Key in Spot Test Network.
I downloaded the repo, and modified the source code, so I changed base URL to pointo Spot Test Network base URL.
I wrote some C# code to get Account Balance in Spot Test Network, but I don't like logging, so I created a Winforms App, the following is my C# code:
Wallet wallet =
new(new HttpClient(), apiKey: Binance_Test_API_Key1, apiSecret: Binance_Test_Secret_Key1);
var result = await wallet.DailyAccountSnapshot(AccountType.SPOT);
But I got 404 (NOT Found) error:
So, I did some debugging, and I found the following HTTP GET request:

https://testnet.binance.vision/api/sapi/v1/accountSnapshot?type=SPOT&timestamp=1661633657884&signature=8615ce5b2f32cd97bf1525373c32babfb3eb809467652c5d746da3fd197086fe
Its header is something like:
X-MBX-APIKEY: My_Test_API_Key
For me, the URL seems to be correct, but why I got 404 error.
Please advise on what went wrong.
Thanks,

Documentation: BSwap.Swap not working from USDT to ETH (binance-connector-dotnet)

Description

Hello, i am not sure what i am doing wrong, i am trying to make a swap from USDT to ETH but it gives me an "Exception of type 'Binance.Common.BinanceClientException' error. USDT to BUSD works fine. Any help will be appreciated, thank you.

CODE:

var bSwap = new BSwap(binanceUrl, binanceApiKey, binanceApiSecret);
var result = await bSwap.Swap("USDT", "ETH", 5.0m);
print(result);

Documentation: Get confused about different API terms.

Description

Hello:
I spent some time to learn on using API. But I found it is rather confusing to understand.
Usually, I can have Private key and can generate a public key from a private key, and have Passphrase to control access to keys, right?
When I get my API keys, I found I have one API key (64 letters and digits combination) and one secret key (64 letters and digits combination).
But which one is the private key, is this API key (64 letters and digits combination).
If yes, then how I can get one public key from this private key?
If no, then let me know how I can get one private key?
By the way, what is the purpose for this secret key? And how I can get Passphrase? If not set, then is it empty?

Hi, with your hint in the last question, everything went smoothly. I wanted to ask if your code has a method that can get the data you need from * OrderResult *.

Description

using System;
using System.Threading;
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 NewOrder_Example
{
    public static async Task Main(string[] args)
    {
        HttpClient httpClient = new HttpClient();

        string apiKey = "api-key";
        string apiSecret = "api-secret";
        var spotAccountTrade = new SpotAccountTrade(httpClient, apiKey: apiKey, apiSecret: apiSecret);


        string symbol = USDTcrypt;
        Side side = BUY;
        OrderType type = "MARKET";
        TimeInForce? timeInForce = GTC;
        double? quantity = firstValue; 
        double? quoteOrderQty = null;
        double? price = null;
        string newClientOrderId;
        decimal? stopPrice;
        decimal? trailingDelta;
        decimal? icebergQty;
        NewOrderResponseType? newOrderRespType;
        long? recvWindow;
            var OrderResult = await spotAccountTrade.NewOrder(symbol, side, type, timeInForce, quantity); 


        // What code do I use to get the order ID from OrderResult

    	var result_Id = OrderResult.Split(':', ';'); // ... orderId: 246456435734; ...
	    long Order_id = long.Parse(result_Id[n]);
	    Console.WriteLine(Order_id); // 246456435734
	    

	    // What code do I want to use
	    
        dynamic order_result = OrderResult.Result;
	    result_Id = order_result.orderId; // <---- Get only order id, no extra characters
	    long Order_id = long.Parse(result_Id);
	    Console.WriteLine(Order_id); // 246456435734

    }
}   

Bug Report: Incomplete webscoket messages received

Reproduction steps

Simply listening to the websocket.

Expected behavior

Receipt of clean, complete, json deserialisable messages.

Actual Behavior

I get incomplete messages from BinanceWebSocket.OnMessageReceived. This is due to the buffer filling up. Can the buffer be dynamically expanded? What is the best practice here? An example message:

{"e":"depthUpdate","E":1665578700816,"s":"BTCUSDT","U":25597310584,"u":25597310880,"b":[["19122.59000000","0.00000000"],["19122.27000000","0.00000000"],["19122.26000000","0.00000000"],["19122.22000000","0.00000000"],["19122.01000000","0.00000000"],["19122.00000000","0.00000000"],["19121.95000000","0.00000000"],["19121.94000000","0.00000000"],["19121.92000000","0.00000000"],["19121.91000000","0.00000000"],["19121.89000000","0.00000000"],["19121.85000000","0.00000000"],["19121.74000000","0.00000000"],["19121.73000000","0.00000000"],["19121.65000000","0.00000000"],["19121.64000000","0.00000000"],["19121.63000000","0.00000000"],["19121.61000000","0.00000000"],["19121.54000000","0.00000000"],["19121.53000000","0.00000000"],["19121.47000000","0.00000000"],["19121.46000000","0.00000000"],["19121.41000000","0.00000000"],["19121.31000000","0.00000000"],["19121.30000000","0.00000000"],["19121.25000000","0.00000000"],["19121.16000000","0.00000000"],["19121.15000000","0.00000000"],["19121.13000000","0.00000000"],["19121.12000000","0.00000000"],["19121.09000000","0.00000000"],["19120.99000000","0.00000000"],["19120.98000000","0.00000000"],["19120.93000000","0.00000000"],["19120.92000000","0.00000000"],["19120.87000000","0.00000000"],["19120.86000000","0.00000000"],["19120.80000000","0.00000000"],["19120.79000000","0.00000000"],["19120.75000000","0.00000000"],["19120.73000000","0.00000000"],["19120.67000000","0.00000000"],["19120.63000000","0.00000000"],["19120.62000000","0.00000000"],["19120.60000000","0.00000000"],["19120.57000000","0.00000000"],["19120.45000000","0.00000000"],["19120.44000000","0.00000000"],["19120.39000000","0.00000000"],["19120.33000000","0.00000000"],["19120.26000000","0.00000000"],["19120.23000000","0.00000000"],["19120.20000000","0.00000000"],["19120.19000000","0.00000000"],["19120.17000000","0.00000000"],["19120.01000000","0.00000000"],["19120.00000000","0.00000000"],["19119.97000000","0.00000000"],["19119.95000000","0.00000000"],["19119.83000000","0.00000000"],["19119.79000000","0.00000000"],["19119.78000000","0.00000000"],["19119.75000000","0.00000000"],["19119.59000000","0.00000000"],["19119.55000000","0.00000000"],["19119.51000000","0.40733000"],["19119.50000000","0.00060000"],["19119.28000000","0.00000000"],["19119.26000000","0.00000000"],["19119.22000000","0.00000000"],["19119.18000000","0.03287000"],["19119.16000000","0.00000000"],["19119.15000000","0.00000000"],["19118.73000000","0.00000000"],["19118.72000000","0.00000000"],["19118.52000000","0.00000000"],["19118.50000000","0.07800000"],["19118.44000000","0.09500000"],["19118.39000000","0.00000000"],["19118.21000000","0.32017000"],["19118.20000000","0.00000000"],["19118.12000000","0.00000000"],["19118.10000000","0.00000000"],["19117.94000000","0.07600000"],["19117.85000000","0.00000000"],["19117.78000000","0.42579000"],["19117.77000000","0.27300000"],["19117.76000000","0.00000000"],["19117.69000000","0.00000000"],["19117.44000000","0.00000000"],["19117.20000000","0.41834000"],["19117.19000000","0.00000000"],["19117.09000000","0.00000000"],["19116.95000000","0.78453000"],["19116.92000000","0.00000000"],["19116.76000000","0.00000000"],["19116.75000000","0.00400000"],["19116.71000000","0.00000000"],["19116.70000000","0.10000000"],["19116.56000000","0.00000000"],["19116.24000000","0.25735000"],["19116.13000000","0.00000000"],["19116.06000000","0.99761000"],["19115.91000000","0.00000000"],["19115.86000000","0.00000000"],["19115.76000000","0.00000000"],["19115.33000000","0.00000000"],["19115.23000000","0.08414000"],["19115.01000000","0.00000000"],["19114.74000000","0.00000000"],["19114.70000000","0.00000000"],["19114.26000000","0.00000000"],["19114.19000000","0.00000000"],["19113.25000000","0.00000000"],["19112.68000000","0.07000000"],["19112.51000000","0.00000000"],["19112.45000000","0.04000000"],["19112.42000000","0.00000000"],["19112.39000000","0.00000000"],["19112.32000000","0.08685000"],["19112.25000000","0.91407000"],["19111.98000000","0.62791000"],["19111.42000000","0.00000000"],["19111.41000000","0.00000000"],["19110.97000000","0.03954000"],["19110.86000000","0.00000000"],["19110.50000000","0.23989000"],["19110.29000000","0.09071000"],["19109.84000000","0.01000000"],["19109.37000000","0.10460000"],["19109.00000000","0.00000000"],["19106.21000000","0.00000000"],["19105.49000000","1.00718000"],["19101.10000000","0.05959000"],["19090.23000000","0.00000000"],["19087.44000000","0.06990000"],["19084.53000000","0.00000000"],["19084.08000000","0.00525000"],["15003.00000000","3.50219000"]],"a":[["19120.02000000","0.02737000"],["19120.27000000","0.03145000"],["19120.61000000","0.05911000"],["19120.83000000","0.05807000"],["19121.20000000","0.00000000"],["19121.22000000","0.04000000"],["19121.26000000","0.02615000"],["19121.28000000","0.07359000"],["19121.29000000","0.04000000"],["19121.31000000","0.00000000"],["19121.32000000","0.00000000"],["19121.34000000","0.06686000"],["19122.07000000","0.21531000"],["19122.08000000","0.00000000"],["19122.09000000","0.02000000"],["19122.14000000","0.04000000"],["19122.20000000","0.02615000"],["19122.23000000","0.14000000"],["19122.33000000","0.00000000"],["19122.38000000","0.02615000"],["19122.43000000","0.00000000"],["19122.55000000","0.00000000"],["19122.81000000","0.00000000"],["19122.84000000","0.24513000"],["19122.87000000","0.00000000"],["19122.88000000","0.03875000"],["19123.13000000","0.00000000"],["19123.23000000","0.00900000"],["19123.30000000","0.59479000"],["19123.31000000","0.00000000"],["19123.32000000","0.00687000"],["19123.34000000","0.00000000"],["19123.35000000","0.00000000"],["19123.41000000","0.10553000"],["19123.42000000","0.00000000"],["19123.67000000","0.02480000"],["19123.70000000","0.00000000"],["19123.79000000","0.49407000"],["19123.80000000","0.00000000"],["19123.83000000","0.00000000"],["19123.84000000","0.09284000"],["19123.85000000","0.00000000"],["19123.86000000","0.00000000"],["19123.87000000","0.00000000"],["19123.89000000","0.00000000"],["19123.91000000","0.00669000"],["19124.25000000","0.00143000"],["19124.30000000","0.00000000"],["19124.31000000","0.00000000"],["19124.46000000","0.00000000"],["19124.49000000","0.03800000"],["19124.65000000","0.06000000"],["19124.70000000","0.00000000"],["19124.78000000","0.00672000"],["19125.02000000","0.00525000"],["19125.89000000","0.07251000"],["19126.09000000","0.00000000"],["19126.61000000","0.06846000"],["19126.65000000","0.10000000"],["19126.69000000","0.00653000"],["19126.70000000","0.08044000"],["19126.71000000","0.00000000"],["19126.78000000","0.00000000"],["19126.80000000","1.75155000"],["19127.29000000","0.08250000"],["19127.44000000","0.94262000"],["19127.47000000","0.00000000"],["19127.99000000","0.00000000"],["19128.01000000","0.02874000"],["19128.02000000","0.20000000"],["19128.05000000","0.09740000"],["19128.08000000","0.17250000"],["19128.24000000","0.05250000"],["19128.39000000","0.11250000"],["19128.52000000","0.03999000"],["19128.85000000","0.00000000"],["19128.96000000","0.42638000"],["19129.20000000","0.00000000"],["19129.29000000","0.00662000"],["19129.33000000","0.00000000"],["19129.34000000","0.01303000"],["19129.51000000","0.00000000"],["19129.94000000","0.12695000"],["19130.24000000","0.01007000"],["19130.26000000","0.00000000"],["19130.89000000","0.00000000"],["19130.99000000","0.00000000"],["19131.05000000","0.09412000"],["19131.22000000","0.47062000"],["19131.42000000","0.04000000"],["19131.65000000","0.01575000"],["19131.76000000","0.00000000"],["19131.86000000","0.00000000"],["19132.49000000","1.01162000"],["19132.74000000","0.00000000"],["19132.85000000","0.00000000"],["19133.25000000","0.00000000"],["19133.51000000","0.16000000"],["19133.79000000","0.00000000"],["19133.84000000","0.01000000"],["19134.07000000","0.00000000"],["19134.18000000","0.05137000"],["19135.00000000","0.07600000"],["19135.11000000","0.00000000"],["19135.17000000","1.22618000"],["19135.42000000","0.00000000"],["19137.00000000","0.00000000"],["19137.81000000","0.12181000"],["19140.61000000","0.00000000"],["19141.43000000","0.00000000"],["19142.27000000","1.01110000"],["19144.34000000","0.00000000"],["19146.24000000","0.00000000"],["19152.53000000","0.36541000"],["

.NET version

.NET Framework 6.0.x

Operating system

Windows

Environment

No response

dotnet --info

No response

Bug Report:

Reproduction steps

spotAccountTrade.NewOrder("AAVEUSDT", Side.BUY, OrderType.MARKET, quoteOrderQty: 0.01m) returns {"code":-1100,"msg":"Illegal characters found in parameter 'quoteOrderQty'; legal range is '^([0-9]{1,20})(\.[0-9]{1,20})?$'."}

Expected behavior

order is created

Actual Behavior

{"code":-1100,"msg":"Illegal characters found in parameter 'quoteOrderQty'; legal range is '^([0-9]{1,20})(\.[0-9]{1,20})?$'."}

.NET version

.NET Framework 6.0.x

Operating system

Windows

Environment

No response

dotnet --info

No response

Bug Report:

Reproduction steps

cannot connect and call spotaccounttrade since yesterday.
i have had test it with real and testnet api key.
everytime it throws a binanceclient exception.
since yesterday it works fine.
market works fine

Expected behavior

connect to spotaccounttrade and call accountinformation get string

Actual Behavior

connect to spotaccounttrade and call accountinformation get binanceclient exception
with new order the same

.NET version

.NET Framework 6.0.x

Operating system

Windows

Environment

No response

dotnet --info

.NET SDK:
Version: 7.0.203
Commit: 5b005c19f5

Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.203\

Host:
Version: 7.0.5
Architecture: x64
Commit: 8042d61b17

.NET SDKs installed:
7.0.203 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Adding support for Self Trade Prevention Mode in Spot Account Trade

There is no current support in Spot Trading API for Self Trade Prevention. I have pulled the repository and implemented the changes, but I belive I don't have permissions to push them. Is there something that can be done to push such changes? Or is it something that you guys take care of for implementing this?

Bug Report: BinanceClientException when calling NewOrder with (SELL, MARKET, quantity)

Reproduction steps

decimal quantity = 0.00128503M;
_spotAccountTrade.NewOrder(symbol:"BTCUSDT", side:SELL, type:MARKET, quantity:quantity);

quantity is a decimal variable with exactly value 0.00128503.
quantity.ToString() returns as expected "0.00128503".
Digital representation matches regex mentioned in the exception.
Yet, API throws error as bellow.

Expected behavior

No exception thrown. Result returned.

Actual Behavior

Exception thrown:

Binance.Common.BinanceClientException
HResult=0x80131500
Message=Illegal characters found in parameter 'quantity'; legal range is '^([0-9]{1,20})(.[0-9]{1,20})?$'.
Source=Common

.NET version

.NET Framework 6.0.x

Operating system

Windows

Environment

Set Culture to some that uses "," (comma) for decimal separator.

dotnet --info

No response

Missing permissions parameter in ExchangeInformation method

Reproduction steps

permissions | curl -X GET "https://api.binance.com/api/v3/exchangeInfo?permissions=SPOT"orcurl -X GET "https://api.binance.com/api/v3/exchangeInfo?permissions=%5B%22MARGIN%22%2C%22LEVERAGED%22%5D"orcurl -g -X GET 'https://api.binance.com/api/v3/exchangeInfo?permissions=["MARGIN","LEVERAGED"]'

Expected behavior

https://binance-docs.github.io/apidocs/spot/en/#exchange-information

Actual Behavior

.NET version

Other (specify in environment)

Operating system

Linux

Environment

No response

dotnet --info

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.