Value cannot be null. (Parameter 's')

Hi ,
Placing a paper trading orders using C#. This one is a buy order.
I do this every day without any issues.
This past Friday, the first order at 9:44 EST for SPY261016P00775000 using try/catch
returned the following Exception: Value cannot be null. (Parameter ‘s’).
Two questions

  • What is parameter ‘s’. The API does not seem to have such a parameter.
  • Perhaps random internet error, the HTTP request had missing characters.
    Do you this type of thing at all?

Thanks!
ptrader

@ptrader The error you received was most likely raised when the SDK was trying to parse the response to your order request, and that response was null. Your request was likely OK. As you noted, there is no ‘s’ parameter when sending an order. A null response can happen after a transient network failure, a timeout, or an empty error message. The code then tried to parse it and caused the error you are seeing.

While infrequent, an API request can return null. It’s good that you wrapped your order request in a try/catch block. Do not assume that a null response means the order was not created. A good practice is to 1) always assign a client_order_id when submitting orders. This must be unique across all orders, and a common approach is to use a timestamp. Save that client_order_id until the order is confirmed. Then 2) if you get an unknown error when submitting the order, query your orders for that client_order_id. If you find it, your order succeeded, and your code can continue. If it’s not found, then resend your order.

Hope this gives you some ideas.