Unknow Failure in making a Sell order

Using the example from the API documentation, I plugged in the “required” information for a “Market” order and copied it into my code. Here is the Body string from the example.



Digging a bit deeper into the return object, I found this:
message :
error_details :
preview_failure_reason : PREVIEW_INVALID_ORDER_CONFIG

Again, this is from the online API documentation example.

Any ideas?

Well, if that’s the exact code you used, you would want to take out the stuff with UNKNOWN_STOP_DIRECTION. The code builder in the docs includes some of that by default and doesn’t remove it if you do a different kind of trade.

Aside from that, it looks like you are trying to make a market order with the size in the base currency. For unknown reasons, this is not currently supported even though it seems to be in the docs.

I’m working around this for now by making a call to get the current price, multiply it to be higher/lower for buying/selling respectively, and putting in a limit order at that price with the base size specified. Unfortunately it requires me to have a little extra quote currency on hand when I buy, but it works. Hopefully they change it in the future.

Thank you jmicko. Always good to have a second set of eyes.

1 Like