Comments (8)
I'm receiving the exact same error on client.CreateOrder. This occurs no matter if it is a market buy or market sell. Also using BinanceDotNet v4.0.1. My ApiKey and Secret are valid.
var createOrderResponse = await client.CreateOrder(new BinanceExchange.API.Models.Request.CreateOrderRequest(){
Symbol = <<anycoinsymbol - I've tried multiple>>,
Side = <<BinanceExchange.API.Enums.OrderSide.Buy>> or <<BinanceExchange.API.Enums.OrderSide.Sell>>,
Type = <<BinanceExchange.API.Enums.OrderType.Market>>,
Quantity = <correctly calculated qty that meets rules in Exchange Info payload>>,
NewClientOrderId = <<my custom string>>
});
I've tried to catch all BinanceExchange.API.Models.Response.Errors, but all I get is this:
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0]
An unhandled exception has occurred while executing the request
System.ArgumentNullException: Value cannot be null.
Parameter name: The Guarded argument was null.
at BinanceExchange.API.Client.BinanceClient.<CreateOrder>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at TraderWeb.Controllers.NewApiOrderController.<Post>d__1.MoveNext() in {redacted file path}\NewApiOrderController.cs:line 154 {this is the line where client.CreateOrder exists}
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResourceFilter>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeFilterPipelineAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()
from binancedotnet.
Heres what i reckon is happening, based on the binance api docs (https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md), depending on the type of Order you are executing some parameters are required and some are not.
But the code here in BinanceDotNet requires that all parameters be passed into the CreateTestOrder() method.
I.e.
When you execute a Market Buy Order, as per the binance api, the only requirement is the QTY, but in the BinanceDotNet code, Time-In-Force is still a required parameter.
And since you passed in the Time-In-Force value, BinanceDotNet passes that parameter to the binance api which will cause a "Malformed Request" error
from binancedotnet.
@paolobriones @glitch100
So any idea as to the solution? I cannot make any Market orders without getting an error.
On my CreateOrderRequest object in the client.CreateOrder method:
- If I set
TimeInForce = BinanceExchange.API.Enums.TimeInForce.GTC
, I receive this:
Malformed requests are sent to the server. Please review the request object/string
- If I do not include
TimeInForce
, or if I setTimeInForce = null
, I receive this:
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0]
An unhandled exception has occurred while executing the request
System.ArgumentNullException: Value cannot be null.
Parameter name: The Guarded argument was null.
at BinanceExchange.API.Client.BinanceClient.<CreateOrder>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
from binancedotnet.
@ryanjhardinorders thats exactly what i said, its sending additional request parameters that causes the binance api to throw a malformed error
@glitch100 im working on a fix for it now, will send as soon as i can
from binancedotnet.
@glitch100 this bug is related to #10
from binancedotnet.
@paolobriones
OK Cool. I am new to git/github and also relatively new to C#, so if you could be kind enough to guide me a bit on how to implement your changes once posted, I would very much appreciate it. (I'll be a code contributor soon enough!) Thanks!
from binancedotnet.
I believe this fix is included in the #32 release . Please retest there.
If you are wondering it's because I have a deliberate Guard
in methods to prevent mandatory parameters being missed. It therefore saves a trip to the API. It appears Binance recently changed which parameters were mandatory. Please try the latest release and see if it fixes your issue
from binancedotnet.
@glitch100 @ryanjhardinorders
Confirmed, this bug is fixed with release #32
from binancedotnet.
Related Issues (20)
- example withdraw coin
- GetAccountInformation is doing an exception HOT 3
- DisposableBinanceWebSocketClient exception
- Question about order types
- Intermittent issue with HOT 1
- Signature generation error with HMAC SHA256 HOT 2
- CreateOrder and CancelOrder hang
- ConnectToDepthWebSocketCombinedPartial
- Recent Trades List endpoint missing in websocket
- Simple example request
- Malformed requests are sent to the server. Please review the request object/string HOT 1
- _
- Going to fork this off to active maintain and support new functions HOT 1
- OrderBook Limit
- conn.Client.GetExchangeInfo().Result "Unable to deserialize message from ..."
- Is this library up to date? HOT 2
- How to get funding rate for Futures contract
- How to get total funds per cyrpto own
- Does this API support latest Binance API features such as Futures
- BinanceExchange.API.Converter.KlineCandleSticksConverter.WriteJson System.NotImplementedException: The method or operation is not implemented
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binancedotnet.