Error 400 - Can't post orders (VB.NET code)

   Hi all,

I’m trying to post new order but not successfully

  1. I had create API keys
  2. Add API to the code
  3. Test account staus (/api/v3/account) - Working fine!
  4. Test new orders (/api/v3/order) - not successfully :frowning:
    ANY HELP?

=================================================================
Dim TimeStamp As String
TimeStamp = CLng((DateTime.UtcNow - #1970/01/01#).TotalMilliseconds).ToString

    Dim TotalParam As String
    TotalParam = "timestamp=" + TimeStamp
    Dim HashKey As String
    HashKey = HashString(TotalParam, SecretKey)

    Dim APIUrl As String
    APIUrl = "https://api.binance.com/api/v3/order?symbol=ADAUSDT&side=BUY&type=LIMIT&timeInForce=50000&quantity=100&price=0.500&" + TotalParam + "&signature=" + HashKey

    Dim Request As System.Net.HttpWebRequest
    Request = DirectCast(System.Net.HttpWebRequest.Create(APIUrl), System.Net.HttpWebRequest)
    Request.Headers.Add("X-MBX-APIKEY", ApiKey)
    Request.Method = "POST" 'GET / POST / DELETE
    Dim Response As System.Net.HttpWebResponse = DirectCast(Request.GetResponse(), System.Net.HttpWebResponse) '
    Dim Read = New System.IO.StreamReader(Response.GetResponseStream).ReadToEnd

is there any errors?

(400) Bad Request

what’s the error message? 400 is not enough to understand the problem

You are receiving an error most likely because timeInForce=50000 is not a valid value!
This should be either GTC, IOC or FOK. This is already mentioned in the docs:

Time in force (timeInForce):

This sets how long an order will be active before expiration (FYI, this doesn’t mean X s/ms, but one of the enums below)

Status Description
GTC Good Til Canceled - An order will be on the book unless the order is canceled.
IOC Immediate Or Cancel - An order will try to fill the order as much as it can before the order expires.
FOK Fill or Kill - An order will expire if the full order cannot be filled upon execution.

Yes, timeInForce can’t be an int value.